From 06afce2162894ef23163062092daf00882de8a85 Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Fri, 20 Jun 2025 09:04:18 +0700 Subject: (andri) revisi penamaan field pada jika commision type adalah cashback --- indoteknik_custom/models/commision.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/indoteknik_custom/models/commision.py b/indoteknik_custom/models/commision.py index 03d32d2d..215e2ded 100644 --- a/indoteknik_custom/models/commision.py +++ b/indoteknik_custom/models/commision.py @@ -175,10 +175,19 @@ class CustomerCommision(models.Model): ('approved', 'Approved'), ('reject', 'Rejected'), ], string='Status') - commision_percent = fields.Float(string='Commision %', tracking=3) - commision_amt = fields.Float(string='Commision Amount', tracking=3) - cashback = fields.Float(string='Cashback', compute="compute_cashback") - total_commision = fields.Float(string='Total Commision', compute="compute_cashback") + + # commision_percent = fields.Float(string='Commision %', tracking=3) + commision_percent = fields.Float(string='Cashback %', tracking=3) + + # commision_amt = fields.Float(string='Commision Amount', tracking=3) + commision_amt = fields.Float(string='Cashback', tracking=3) + + # cashback = fields.Float(string='Cashback', compute="compute_cashback") + cashback = fields.Float(string='PPh Cashback', compute="compute_cashback") + + # total_commision = fields.Float(string='Total Commision', compute="compute_cashback") + total_commision = fields.Float(string='Cashback yang dibayarkan', compute="compute_cashback") + total_cashback = fields.Float(string='Total Cashback') commision_amt_text = fields.Char(string='Commision Amount Text', compute='compute_delivery_amt_text') total_dpp = fields.Float(string='Total DPP', compute='_compute_total_dpp') -- cgit v1.2.3 From 8a3717c34e0968f3f6ddd7d0cc4fb18aeb218bfe Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Fri, 20 Jun 2025 10:04:01 +0700 Subject: (andri) ganti no dokumen yang lama (CC) sesuai dengan commision type yang dipilih (RB/FE/CB) --- indoteknik_custom/models/commision.py | 35 ++++++++++++++++++++++++--------- indoteknik_custom/views/ir_sequence.xml | 32 +++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 10 deletions(-) diff --git a/indoteknik_custom/models/commision.py b/indoteknik_custom/models/commision.py index 215e2ded..46718397 100644 --- a/indoteknik_custom/models/commision.py +++ b/indoteknik_custom/models/commision.py @@ -175,7 +175,7 @@ class CustomerCommision(models.Model): ('approved', 'Approved'), ('reject', 'Rejected'), ], string='Status') - + # commision_percent = fields.Float(string='Commision %', tracking=3) commision_percent = fields.Float(string='Cashback %', tracking=3) @@ -357,14 +357,31 @@ class CustomerCommision(models.Model): @api.model def create(self, vals): - vals['number'] = self.env['ir.sequence'].next_by_code('customer.commision') or '0' - # if vals['commision_amt'] > 0: - # commision_amt = vals['commision_amt'] - # total_dpp = vals['total_dpp'] - # commision_percent = commision_amt / total_dpp * 100 - # vals['commision_percent'] = commision_percent - result = super(CustomerCommision, self).create(vals) - return result + commision_type = vals.get('commision_type') + + if commision_type == 'cashback': + sequence_code = 'customer.commision.cashback' + elif commision_type == 'fee': + sequence_code = 'customer.commision.fee' + elif commision_type == 'rebate': + sequence_code = 'customer.commision.rebate' + else: + raise UserError('Tipe komisi tidak dikenal!') + + vals['number'] = self.env['ir.sequence'].next_by_code(sequence_code) or '0' + + return super(CustomerCommision, self).create(vals) + + # @api.model + # def create(self, vals): + # vals['number'] = self.env['ir.sequence'].next_by_code('customer.commision') or '0' + # # if vals['commision_amt'] > 0: + # # commision_amt = vals['commision_amt'] + # # total_dpp = vals['total_dpp'] + # # commision_percent = commision_amt / total_dpp * 100 + # # vals['commision_percent'] = commision_percent + # result = super(CustomerCommision, self).create(vals) + # return result def action_confirm_customer_commision(self): jakarta_tz = pytz.timezone('Asia/Jakarta') diff --git a/indoteknik_custom/views/ir_sequence.xml b/indoteknik_custom/views/ir_sequence.xml index 97bf40bb..bb8848c4 100644 --- a/indoteknik_custom/views/ir_sequence.xml +++ b/indoteknik_custom/views/ir_sequence.xml @@ -131,7 +131,7 @@ 1 - + + + + Customer Commision Cashback + customer.commision.cashback + CB/%(year)s/ + 5 + 1 + 1 + True + + + + Customer Commision Fee + customer.commision.fee + FE/%(year)s/ + 5 + 1 + 1 + True + + + + Customer Commision Rebate + customer.commision.rebate + RB/%(year)s/ + 5 + 1 + 1 + True -- cgit v1.2.3 From 6ae8ac2d0a560d850e7e8dc2ce87157f3e5a9669 Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Mon, 23 Jun 2025 10:10:51 +0700 Subject: (andri) menu commision customer menjadi commision benefits --- indoteknik_custom/models/commision.py | 1 + indoteknik_custom/views/customer_commision.xml | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/indoteknik_custom/models/commision.py b/indoteknik_custom/models/commision.py index 46718397..199aa106 100644 --- a/indoteknik_custom/models/commision.py +++ b/indoteknik_custom/models/commision.py @@ -148,6 +148,7 @@ class CustomerCommision(models.Model): _order = 'id desc' _inherit = ['mail.thread'] _rec_name = 'number' + _description = 'Customer Benefits' number = fields.Char(string='Document No', index=True, copy=False, readonly=True) date_from = fields.Date(string='Date From', required=True) diff --git a/indoteknik_custom/views/customer_commision.xml b/indoteknik_custom/views/customer_commision.xml index 4be0840f..d5fb1d70 100644 --- a/indoteknik_custom/views/customer_commision.xml +++ b/indoteknik_custom/views/customer_commision.xml @@ -70,7 +70,7 @@ statusbar_visible="draft,pengajuan1,pengajuan2,pengajuan3,pengajuan4,approved" statusbar_colors='{"reject":"red"}'/> - +
@@ -173,7 +173,7 @@ - Customer Commision + Customer Benefits ir.actions.act_window customer.commision @@ -181,14 +181,14 @@ Date: Tue, 24 Jun 2025 09:43:15 +0700 Subject: (andri) fix date reserved di SO --- indoteknik_custom/models/sale_order.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index c8d4a712..c1cdf2ed 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -382,13 +382,13 @@ class SaleOrder(models.Model): # Simpan ke field sebagai UTC-naive datetime (standar Odoo) order.et_products = eta_datetime.astimezone(pytz.utc).replace(tzinfo=None) - @api.depends('picking_ids.state', 'picking_ids.date_reserved') + @api.depends('picking_ids.state', 'picking_ids.date_done') def _compute_eta_date_reserved(self): for order in self: pickings = order.picking_ids.filtered( - lambda p: p.state == 'assigned' and p.date_reserved and 'BU/PICK/' in (p.name or '') + lambda p: p.state in ('assigned', 'done') and p.date_reserved and 'BU/PICK/' in (p.name or '') ) - order.eta_date_reserved = min(pickings.mapped('date_reserved')) if pickings else False + order.eta_date_reserved = min(pickings.mapped('date_done')) if pickings else False @api.onchange('shipping_cost_covered') def _onchange_shipping_cost_covered(self): -- cgit v1.2.3 From 6a913c0025c64903536fa6c9aeda526b609d27e6 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 24 Jun 2025 11:23:36 +0700 Subject: change request coretax down payment --- indoteknik_custom/models/account_move.py | 3 +- indoteknik_custom/models/coretax_fatur.py | 83 +++++++++++++++++++++---------- indoteknik_custom/models/sale_order.py | 1 + indoteknik_custom/views/account_move.xml | 1 + 4 files changed, 62 insertions(+), 26 deletions(-) diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 66020a69..ece47236 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -70,6 +70,7 @@ class AccountMove(models.Model): reklas_misc_id = fields.Many2one('account.move', string='Journal Entries Reklas') # Di model account.move bill_id = fields.Many2one('account.move', string='Vendor Bill', domain=[('move_type', '=', 'in_invoice')], help='Bill asal dari proses reklas ini') + down_payment = fields.Boolean('Down Payments?') # def name_get(self): @@ -441,7 +442,7 @@ class AccountMove(models.Model): # Panggil model coretax.faktur untuk menghasilkan XML coretax_faktur = self.env['coretax.faktur'].create({}) - response = coretax_faktur.export_to_download(invoices=valid_invoices) + response = coretax_faktur.export_to_download(invoices=valid_invoices, down_payments=valid_invoices.down_payment) current_time = datetime.utcnow() # Tandai faktur sebagai sudah diekspor diff --git a/indoteknik_custom/models/coretax_fatur.py b/indoteknik_custom/models/coretax_fatur.py index 92ff1a72..54eb0f8e 100644 --- a/indoteknik_custom/models/coretax_fatur.py +++ b/indoteknik_custom/models/coretax_fatur.py @@ -32,7 +32,7 @@ class CoretaxFaktur(models.Model): return cleaned_number - def generate_xml(self, invoices=None): + def generate_xml(self, invoices=None, down_payments=False): # Buat root XML root = ET.Element('TaxInvoiceBulk', { 'xmlns:xsi': "http://www.w3.org/2001/XMLSchema-instance", @@ -72,42 +72,76 @@ class CoretaxFaktur(models.Model): ET.SubElement(tax_invoice, 'BuyerEmail').text = invoice.partner_id.email or '' ET.SubElement(tax_invoice, 'BuyerIDTKU').text = buyerIDTKU - # Filter product - product_lines = invoice.invoice_line_ids.filtered( - lambda l: not l.display_type and hasattr(l, 'account_id') and - l.account_id and l.product_id and - l.account_id.id != self.DISCOUNT_ACCOUNT_ID and - l.quantity != -1 - ) + # Handle product lines based on down_payments flag + if down_payments and invoice.invoice_origin: + # Get from sale.order.line for down payment + sale_order = invoice.sale_id + if sale_order: + product_lines = sale_order.order_line.filtered( + lambda l: l.product_id and not l.is_downpayment and not l.display_type and not l.product_id.id == 229625 + ) + # Convert sale order lines to invoice-like format + converted_lines = [] + for line in product_lines: + converted_lines.append({ + 'name': line.name, + 'product_id': line.product_id, + 'price_subtotal': line.price_subtotal, + 'quantity': line.product_uom_qty, + 'price_unit': line.price_unit, + 'account_id': line.order_id.analytic_account_id or False, + }) + product_lines = converted_lines + else: + product_lines = [] + else: + # Normal case - get from invoice lines + product_lines = invoice.invoice_line_ids.filtered( + lambda l: not l.display_type and hasattr(l, 'account_id') and + l.account_id and l.product_id and + l.account_id.id != self.DISCOUNT_ACCOUNT_ID and + l.quantity != -1 + ) - # Filter discount + # Filter discount (always from invoice) discount_lines = invoice.invoice_line_ids.filtered( lambda l: not l.display_type and ( - (hasattr(l, 'account_id') and l.account_id and - l.account_id.id == self.DISCOUNT_ACCOUNT_ID) or - (l.quantity == -1) + (hasattr(l, 'account_id') and l.account_id and + l.account_id.id == self.DISCOUNT_ACCOUNT_ID) or + (l.quantity == -1) ) ) - # Calculate total product amount (before discount) - total_product_amount = sum(line.price_subtotal for line in product_lines) + # Calculate totals + total_product_amount = sum(line.get('price_subtotal', 0) if isinstance(line, dict) + else line.price_subtotal for line in product_lines) if total_product_amount == 0: total_product_amount = 1 # Avoid division by zero - # Calculate total discount amount total_discount_amount = abs(sum(line.price_subtotal for line in discount_lines)) # Tambahkan elemen ListOfGoodService list_of_good_service = ET.SubElement(tax_invoice, 'ListOfGoodService') for line in product_lines: + # Handle both dict (converted sale lines) and normal invoice lines + if isinstance(line, dict): + line_price_subtotal = line['price_subtotal'] + line_quantity = line['quantity'] + line_name = line['name'] + line_price_unit = line['price_unit'] + else: + line_price_subtotal = line.price_subtotal + line_quantity = line.quantity + line_name = line.name + line_price_unit = line.price_unit + # Calculate prorated discount - line_proportion = line.price_subtotal / total_product_amount + line_proportion = line_price_subtotal / total_product_amount line_discount = total_discount_amount * line_proportion - # unit_price = line.price_unit - subtotal = line.price_subtotal - quantity = line.quantity + subtotal = line_price_subtotal + quantity = line_quantity total_discount = round(line_discount, 2) # Calculate other tax values @@ -118,13 +152,12 @@ class CoretaxFaktur(models.Model): good_service = ET.SubElement(list_of_good_service, 'GoodService') ET.SubElement(good_service, 'Opt').text = 'A' ET.SubElement(good_service, 'Code').text = '000000' - ET.SubElement(good_service, 'Name').text = line.name + ET.SubElement(good_service, 'Name').text = line_name ET.SubElement(good_service, 'Unit').text = 'UM.0018' - ET.SubElement(good_service, 'Price').text = str(round(subtotal / quantity, 2)) if subtotal else '0' + ET.SubElement(good_service, 'Price').text = str(round(line_price_unit, 2)) if line_price_unit else '0' ET.SubElement(good_service, 'Qty').text = str(quantity) ET.SubElement(good_service, 'TotalDiscount').text = str(total_discount) - ET.SubElement(good_service, 'TaxBase').text = str( - round(subtotal)) if subtotal else '0' + ET.SubElement(good_service, 'TaxBase').text = str(round(subtotal)) if subtotal else '0' ET.SubElement(good_service, 'OtherTaxBase').text = str(otherTaxBase) ET.SubElement(good_service, 'VATRate').text = '12' ET.SubElement(good_service, 'VAT').text = str(vat_amount) @@ -136,9 +169,9 @@ class CoretaxFaktur(models.Model): xml_pretty = minidom.parseString(xml_str).toprettyxml(indent=" ") return xml_pretty - def export_to_download(self, invoices): + def export_to_download(self, invoices, down_payments): # Generate XML content - xml_content = self.generate_xml(invoices) + xml_content = self.generate_xml(invoices, down_payments) # Encode content to Base64 xml_encoded = base64.b64encode(xml_content.encode('utf-8')) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index c1cdf2ed..85228901 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -1592,6 +1592,7 @@ class SaleOrder(models.Model): 'campaign_id': self.campaign_id.id, 'medium_id': self.medium_id.id, 'source_id': self.source_id.id, + 'down_payment': 229625 in [line.product_id.id for line in self.order_line], 'user_id': self.user_id.id, 'sale_id': self.id, 'invoice_user_id': self.user_id.id, diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml index 0fc62293..e8061862 100644 --- a/indoteknik_custom/views/account_move.xml +++ b/indoteknik_custom/views/account_move.xml @@ -60,6 +60,7 @@ + -- cgit v1.2.3 From e1e281f6f43b9ba22443845484422cd0c5b1fb30 Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Tue, 24 Jun 2025 12:08:57 +0700 Subject: (andri) penambahan field pada respartner --- indoteknik_custom/models/res_partner.py | 17 +++++++++++++++++ indoteknik_custom/views/res_partner.xml | 5 +++++ 2 files changed, 22 insertions(+) diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index 9986b9c0..98aac7eb 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -165,6 +165,23 @@ class ResPartner(models.Model): "this feature", tracking=3) telegram_id = fields.Char(string="Telegram") + avg_aging= fields.Float(string='Average Aging') + payment_difficulty = fields.Selection([('bermasalah', 'Bermasalah'),('sulit', 'Sulit'),('agak_sulit', 'Agak Sulit'),('normal', 'Normal')], string='Payment Difficulty', tracking=3, compute='_compute_payment_difficulty', inverse='_inverse_payment_difficulty', store=True) + payment_history_url = fields.Text(string='Payment History URL') + + @api.depends('parent_id.payment_difficulty') + def _compute_payment_difficulty(self): + for partner in self: + if partner.parent_id: + partner.payment_difficulty = partner.parent_id.payment_difficulty + + def _inverse_payment_difficulty(self): + for partner in self: + if not partner.parent_id: + partner.child_ids.write({ + 'payment_difficulty': partner.payment_difficulty + }) + @api.model def _default_payment_term(self): return self.env.ref('__export__.account_payment_term_26_484409e2').id diff --git a/indoteknik_custom/views/res_partner.xml b/indoteknik_custom/views/res_partner.xml index 30b5ca36..6115587b 100644 --- a/indoteknik_custom/views/res_partner.xml +++ b/indoteknik_custom/views/res_partner.xml @@ -181,6 +181,11 @@ + + + + + -- cgit v1.2.3 From 01c70504c6359d305327921a0329e59a269c868c Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Tue, 24 Jun 2025 13:32:02 +0700 Subject: (andri) add field di respartner --- indoteknik_custom/views/res_partner.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/views/res_partner.xml b/indoteknik_custom/views/res_partner.xml index 6115587b..ca48acf3 100644 --- a/indoteknik_custom/views/res_partner.xml +++ b/indoteknik_custom/views/res_partner.xml @@ -181,11 +181,11 @@ - + -- cgit v1.2.3 From c60fa8f74b019b677d8e9ce513bcd7875a9b00de Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Tue, 24 Jun 2025 13:34:37 +0700 Subject: (andri) add field pada view --- indoteknik_custom/views/res_partner.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/views/res_partner.xml b/indoteknik_custom/views/res_partner.xml index ca48acf3..6115587b 100644 --- a/indoteknik_custom/views/res_partner.xml +++ b/indoteknik_custom/views/res_partner.xml @@ -181,11 +181,11 @@ - + -- cgit v1.2.3 From e921762879216dbe8df4e36dfa294ae4ccf293ee Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Tue, 24 Jun 2025 13:39:12 +0700 Subject: (andri) fix --- indoteknik_custom/models/res_partner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index 98aac7eb..d23ab824 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -166,7 +166,7 @@ class ResPartner(models.Model): telegram_id = fields.Char(string="Telegram") avg_aging= fields.Float(string='Average Aging') - payment_difficulty = fields.Selection([('bermasalah', 'Bermasalah'),('sulit', 'Sulit'),('agak_sulit', 'Agak Sulit'),('normal', 'Normal')], string='Payment Difficulty', tracking=3, compute='_compute_payment_difficulty', inverse='_inverse_payment_difficulty', store=True) + payment_difficulty = fields.Selection([('bermasalah', 'Bermasalah'),('sulit', 'Sulit'),('agak_sulit', 'Agak Sulit'),('normal', 'Normal')], string='Payment Difficulty', tracking=3, compute='_compute_payment_difficulty', inverse='_inverse_payment_difficulty') payment_history_url = fields.Text(string='Payment History URL') @api.depends('parent_id.payment_difficulty') -- cgit v1.2.3 From a7139584557cc8c0d881bafc25b4cbbdb1c93ffc Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Tue, 24 Jun 2025 13:59:07 +0700 Subject: (andri) ganti compute field menjadi field biasa --- indoteknik_custom/models/res_partner.py | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index d23ab824..d439c7a8 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -164,23 +164,22 @@ class ResPartner(models.Model): "Set its value to 0.00 to disable " "this feature", tracking=3) telegram_id = fields.Char(string="Telegram") - avg_aging= fields.Float(string='Average Aging') - payment_difficulty = fields.Selection([('bermasalah', 'Bermasalah'),('sulit', 'Sulit'),('agak_sulit', 'Agak Sulit'),('normal', 'Normal')], string='Payment Difficulty', tracking=3, compute='_compute_payment_difficulty', inverse='_inverse_payment_difficulty') + payment_difficulty = fields.Selection([('bermasalah', 'Bermasalah'),('sulit', 'Sulit'),('agak_sulit', 'Agak Sulit'),('normal', 'Normal')], string='Payment Difficulty', tracking=3) payment_history_url = fields.Text(string='Payment History URL') - @api.depends('parent_id.payment_difficulty') - def _compute_payment_difficulty(self): - for partner in self: - if partner.parent_id: - partner.payment_difficulty = partner.parent_id.payment_difficulty + # @api.depends('parent_id.payment_difficulty') + # def _compute_payment_difficulty(self): + # for partner in self: + # if partner.parent_id: + # partner.payment_difficulty = partner.parent_id.payment_difficulty - def _inverse_payment_difficulty(self): - for partner in self: - if not partner.parent_id: - partner.child_ids.write({ - 'payment_difficulty': partner.payment_difficulty - }) + # def _inverse_payment_difficulty(self): + # for partner in self: + # if not partner.parent_id: + # partner.child_ids.write({ + # 'payment_difficulty': partner.payment_difficulty + # }) @api.model def _default_payment_term(self): @@ -209,6 +208,10 @@ class ResPartner(models.Model): for rec in self: if 'latitude' in vals or 'longtitude' in vals: rec._update_address_from_coords() + + # Sinkronisasi payment_difficulty ke semua anak jika partner ini adalah parent + if not rec.parent_id and 'payment_difficulty' in vals: + rec.child_ids.write({'payment_difficulty': vals['payment_difficulty']}) # # # if 'property_payment_term_id' in vals: # # if not self.env.user.is_accounting and vals['property_payment_term_id'] != 26: @@ -227,6 +230,8 @@ class ResPartner(models.Model): for rec in records: if vals.get('latitude') and vals.get('longtitude'): rec._update_address_from_coords() + if rec.parent_id and not vals.get('payment_difficulty'): + rec.payment_difficulty = rec.parent_id.payment_difficulty return records @api.constrains('name') -- cgit v1.2.3 From 7e42b0fdd1735df03e249f1362e58c169236465d Mon Sep 17 00:00:00 2001 From: "Indoteknik ." Date: Tue, 24 Jun 2025 15:08:37 +0700 Subject: (andri) fix download xml invoice --- indoteknik_custom/models/account_move.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index ece47236..af24f93e 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -437,18 +437,18 @@ class AccountMove(models.Model): return invoices def export_faktur_to_xml(self): - valid_invoices = self - # Panggil model coretax.faktur untuk menghasilkan XML coretax_faktur = self.env['coretax.faktur'].create({}) - response = coretax_faktur.export_to_download(invoices=valid_invoices, down_payments=valid_invoices.down_payment) - current_time = datetime.utcnow() - # Tandai faktur sebagai sudah diekspor + response = coretax_faktur.export_to_download( + invoices=valid_invoices, + down_payments=[inv.down_payment for inv in valid_invoices], + ) + valid_invoices.write({ 'is_efaktur_exported': True, - 'date_efaktur_exported': current_time, # Set tanggal ekspor + 'date_efaktur_exported': datetime.utcnow(), }) - return response + return response \ No newline at end of file -- cgit v1.2.3