From 492e97d019dbdabe97422f9ca606df90f16d4151 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 6 Jan 2026 09:31:00 +0700 Subject: push --- fixco_custom/models/purchase_order.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'fixco_custom/models/purchase_order.py') diff --git a/fixco_custom/models/purchase_order.py b/fixco_custom/models/purchase_order.py index f2a6c3e..357550a 100644 --- a/fixco_custom/models/purchase_order.py +++ b/fixco_custom/models/purchase_order.py @@ -227,8 +227,12 @@ class PurchaseOrder(models.Model): unique_soo = list(set(soo_numbers)) if len(unique_soo) == 1: order.soo_number = unique_soo[0] + if not order.picking_ids.soo_number: + order.picking_ids[0].soo_number = unique_soo[0] elif len(unique_soo) > 1: order.soo_number = ", ".join(unique_soo) + if not order.picking_ids.soo_number: + order.picking_ids[0].soo_number = ", ".join(unique_soo) else: order.soo_number = False -- cgit v1.2.3 From 3c885bec3b51b35c77c983444a949783cb53e198 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 6 Jan 2026 13:01:13 +0700 Subject: queuing job --- fixco_custom/models/purchase_order.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'fixco_custom/models/purchase_order.py') diff --git a/fixco_custom/models/purchase_order.py b/fixco_custom/models/purchase_order.py index 357550a..2dbb3e9 100644 --- a/fixco_custom/models/purchase_order.py +++ b/fixco_custom/models/purchase_order.py @@ -227,13 +227,12 @@ class PurchaseOrder(models.Model): unique_soo = list(set(soo_numbers)) if len(unique_soo) == 1: order.soo_number = unique_soo[0] - if not order.picking_ids.soo_number: - order.picking_ids[0].soo_number = unique_soo[0] + if not order.picking_ids.number_soo: + order.picking_ids[0].number_soo = unique_soo[0] elif len(unique_soo) > 1: order.soo_number = ", ".join(unique_soo) - if not order.picking_ids.soo_number: - order.picking_ids[0].soo_number = ", ".join(unique_soo) - + if not order.picking_ids.number_soo: + order.picking_ids[0].number_soo = ", ".join(unique_soo) else: order.soo_number = False -- cgit v1.2.3 From 5230d59fcd311ff5d3fa53c3907e971e97d4fb44 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Tue, 6 Jan 2026 15:24:55 +0700 Subject: fix discount total not showing in amount discount --- fixco_custom/models/purchase_order.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'fixco_custom/models/purchase_order.py') diff --git a/fixco_custom/models/purchase_order.py b/fixco_custom/models/purchase_order.py index f2a6c3e..92d31a2 100644 --- a/fixco_custom/models/purchase_order.py +++ b/fixco_custom/models/purchase_order.py @@ -428,7 +428,9 @@ class PurchaseOrder(models.Model): super(PurchaseOrder, self)._amount_all() for order in self: + total_discount = order._get_line_discount_total + order.discount_total amount_total = order.amount_untaxed + order.amount_tax + order.biaya_lain_lain - order.discount_total + order.amount_discount = total_discount order.amount_total = order.currency_id.round(amount_total) @api.depends('order_line.discount_amount') -- cgit v1.2.3 From aa9d8c2961bb69f88802ad305c7d623138c27cc5 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Tue, 6 Jan 2026 16:26:18 +0700 Subject: fix disc po formula --- fixco_custom/models/purchase_order.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'fixco_custom/models/purchase_order.py') diff --git a/fixco_custom/models/purchase_order.py b/fixco_custom/models/purchase_order.py index b4adb7d..43fe8f6 100644 --- a/fixco_custom/models/purchase_order.py +++ b/fixco_custom/models/purchase_order.py @@ -1,3 +1,4 @@ +from shutil import copy from odoo import fields, models, api, _ from odoo.exceptions import AccessError, UserError, ValidationError from dateutil.relativedelta import relativedelta @@ -55,7 +56,7 @@ class PurchaseOrder(models.Model): soo_price = fields.Float('SOO Price', copy=False) soo_discount = fields.Float('SOO Discount', copy=False) soo_tax = fields.Float('SOO Tax', copy=False) - discount_total = fields.Float('Discount Total', help = 'Total Discount for Each Product') + discount_total = fields.Float('Discount Total', help = 'Total Discount for Each Product', copy=False, default=0.0) def _get_fixco_token(self, source='auto'): ICP = self.env['ir.config_parameter'].sudo() @@ -426,14 +427,18 @@ class PurchaseOrder(models.Model): 'domain': [('id', 'in', journals.ids)], } - @api.depends('order_line.price_total', 'biaya_lain_lain', 'discount_total') + @api.depends('order_line.price_total', 'biaya_lain_lain', 'discount_total', 'amount_tax', 'amount_discount') def _amount_all(self): super(PurchaseOrder, self)._amount_all() for order in self: - total_discount = order._get_line_discount_total + order.discount_total + line_discount = 0.0 + for line in order.order_line: + if line.discount > 0: + line_discount += line.discount_amount + amount_total = order.amount_untaxed + order.amount_tax + order.biaya_lain_lain - order.discount_total - order.amount_discount = total_discount + order.amount_discount = order.discount_total + line_discount order.amount_total = order.currency_id.round(amount_total) @api.depends('order_line.discount_amount') -- cgit v1.2.3