diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-09-28 11:14:28 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-09-28 11:14:28 +0700 |
| commit | 7e27706cca01443b8476afeaa856fa2cc3c12deb (patch) | |
| tree | 796ba2c9207ac378f75ef49df16cf44f4f222362 /indoteknik_custom/models/sale_order.py | |
| parent | d023b4f2564c7d2fbe3d61a2348250569f182dc4 (diff) | |
change approval sales to vita and po to akbar and tyas
Diffstat (limited to 'indoteknik_custom/models/sale_order.py')
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 1cd358ab..d1200de2 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -44,6 +44,8 @@ class SaleOrder(models.Model): for order in self: if order.state == 'cancel' or order.state == 'done' or order.state == 'sale': raise UserError("Status harus draft atau sent") + if not order.sales_tax_id: + raise UserError("Tax di Header harus diisi") approval1 = approval2 = 0 for line in order.order_line: if not line.product_id or line.product_id.type == 'service': @@ -71,20 +73,22 @@ class SaleOrder(models.Model): def action_confirm(self): res = super(SaleOrder, self).action_confirm() - for line in self.order_line: - if line.product_id.id == 232383: - raise UserError(_('Tidak bisa Confirm menggunakan Produk Sementara')) - for order in self: + if not order.sales_tax_id: + raise UserError("Tax di Header harus diisi") approval1 = approval2 = 0 for line in order.order_line: + if line.product_id.id == 232383: + raise UserError(_('Tidak bisa Confirm menggunakan Produk Sementara')) + if not line.vendor_id or not line.purchase_price or not line.purchase_tax_id: + raise UserError(_('Isi Vendor, Harga Beli, dan Tax sebelum Request Approval')) if not line.product_id or line.product_id.type == 'service': continue if (line.item_percent_margin <= 15) and ( self.env.user.id != 6 and self.env.user.id != 7): # akbar or tyas will approve approval2 += 1 elif line.item_percent_margin <= 25 and ( - self.env.user.id != 6 and self.env.user.id != 7 and self.env.user.id != 19): # darren? + self.env.user.id != 6 and self.env.user.id != 7 and self.env.user.id != 377): # vita approval1 += 1 if approval2 > 0: raise UserError("Harus diapprove oleh Pimpinan (Akbar / Tyas)") |
