diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-09-27 09:04:51 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-09-27 09:04:51 +0700 |
| commit | 59354f566bc4d735f5a4a7bd96d663247d1990e2 (patch) | |
| tree | c4c9a2c4dda3176fdd7e8973a2f37372a4e14bbf | |
| parent | 7ae5b8b7baafb9ed302c3c3e54f3f44664651c06 (diff) | |
Update purchase_order.py
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 889fc80e..a9d9cc6b 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -7,12 +7,6 @@ class PurchaseOrder(models.Model): sale_order_id = fields.Many2one('sale.order', string='Sale Order') procurement_status = fields.Char(string='Procurement Status', compute='get_procurement_status', readonly=True) - total_margin = fields.Float( - 'Total Margin', compute='compute_total_margin', - help="Total Margin in Sales Order Header") - total_percent_margin = fields.Float( - 'Total Percent Margin', compute='compute_total_margin', - help="Total % Margin in Sales Order Header") approval_status = fields.Selection([ ('pengajuan1', 'Approval Manager'), #siapa? darren - 11 ('pengajuan2', 'Approval Pimpinan'), #akbar - 7 @@ -77,23 +71,6 @@ class PurchaseOrder(models.Model): amount += line.price_total order.delivery_amount = amount - def compute_total_margin(self): - for po in self: - po.total_margin = 0 - po.total_percent_margin = 0 - for po in self: - total_margin = total_percent_margin = 0 - for line in po.order_line: - if not line.product_id: - po.total_margin = 0 - po.total_percent_margin = 0 - continue - total_margin += line.item_margin - po.total_margin = total_margin - if po.amount_untaxed > 0: - total_percent_margin = round((total_margin / po.amount_untaxed), 2) * 100 - po.total_percent_margin = total_percent_margin - def button_confirm(self): res = super(PurchaseOrder, self).button_confirm() @@ -111,9 +88,9 @@ class PurchaseOrder(models.Model): real_tax_amount += tax.amount if (sale_order_line.purchase_tax_id.amount != real_tax_amount or count_real_tax > 1 \ or real_tax.price_include != sale_order_line.purchase_tax_id.price_include) and (self.env.user.id != 6): - raise UserError("Beda tax amount dengan Sales, harus Approval Pak Tyas") + raise UserError("Beda tax amount dengan Sales, harus Approval Manager") elif est_purchase_price != real_purchase_price and self.env.user.id != 6: - raise UserError("Beda Price dengan Sales, harus Approval Pak Tyas") + raise UserError("Beda Price dengan Sales, harus Approval Manager") self.approval_status = 'approved' return res |
