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 | |
| parent | d023b4f2564c7d2fbe3d61a2348250569f182dc4 (diff) | |
change approval sales to vita and po to akbar and tyas
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 12 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 14 |
2 files changed, 16 insertions, 10 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index cffeff69..ca106a68 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -91,9 +91,10 @@ class PurchaseOrder(models.Model): real_tax = tax 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): + or real_tax.price_include != sale_order_line.purchase_tax_id.price_include) \ + and (self.env.user.id != 6 and self.env.user.id != 7): raise UserError("Beda tax amount dengan Sales, harus Approval Manager") - elif est_purchase_price < real_purchase_price and self.env.user.id != 6: + elif est_purchase_price < real_purchase_price and self.env.user.id != 6 and self.env.user.id != 7: raise UserError("Beda Price dengan Sales, harus Approval Manager") # elif line.product_id.type == 'service' and self.env.user_id != 6: # raise UserError("Ada tambahan Ongkos kirim, harus Approval Manager") @@ -121,11 +122,12 @@ class PurchaseOrder(models.Model): real_tax = tax 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: + or real_tax.price_include != sale_order_line.purchase_tax_id.price_include) \ + and (self.env.user.id != 6 and self.env.user.id != 7): approval += 1 - elif est_purchase_price != real_purchase_price and self.env.user.id != 6: + elif est_purchase_price != real_purchase_price and self.env.user.id != 6 and self.env.user.id != 7: approval += 1 - elif line.product_id.type == 'service' and self.env.user.id != 6: + elif line.product_id.type == 'service' and self.env.user.id != 6 and self.env.user.id != 7: approval += 1 if approval > 0: self.approval_status = "pengajuan1" 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)") |
