diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-09-26 14:18:59 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-09-26 14:18:59 +0700 |
| commit | 0b48304775255b09de9c2aeba55cd958a860954c (patch) | |
| tree | 7b4c707ca470f0714bc6319b23995692bae96cbf | |
| parent | 300b62f3ca9898d31254c53dda267a6cc8feaaef (diff) | |
Update sale_order.py
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index c643aa6d..ad50712f 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -18,14 +18,14 @@ class SaleOrder(models.Model): ('approved', 'Approved'), ], string='Approval Status', readonly=True, copy=False, index=True, tracking=3) carrier_id = fields.Many2one('delivery.carrier', string='Shipping Method') - have_visit_service = fields.Boolean(string='Have Visit Service', help='To compute is customer get visit service', compute='_compute_have_visit_service') + have_visit_service = fields.Boolean(string='Have Visit Service', help='To compute is customer get visit service', + compute='_compute_have_visit_service') count_line_product = fields.Float('Count Line Product', compute='compute_count_line_product') delivery_amount = fields.Float('Delivery Amount', compute='compute_delivery_amount') shipping_cost_covered = fields.Boolean('Shipping Cost Covered', help='Centang jika Shipping Cost ditanggung oleh ' 'Indoteknik, jika dicentang akan ' 'mempengaruhi margin') - def _compute_have_visit_service(self): limit = 20000000 self.have_visit_service = False @@ -41,9 +41,11 @@ class SaleOrder(models.Model): for line in order.order_line: 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 + if (line.item_percent_margin <= 15) and ( + self.env.user.id != 6 and self.env.user.id != 7): # akbar or tyas approval2 += 1 - elif line.item_percent_margin <= 25 and (self.env.user.id != 19 and self.env.user.id != 6 and self.env.user.id != 7): + elif line.item_percent_margin <= 25 and ( + self.env.user.id != 19 and self.env.user.id != 6 and self.env.user.id != 7): approval1 += 1 if approval2 > 0: order.approval_status = 'pengajuan2' @@ -67,9 +69,11 @@ class SaleOrder(models.Model): for line in order.order_line: 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 + 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? + 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? approval1 += 1 if approval2 > 0: raise UserError("Harus diapprove oleh Pimpinan (Akbar / Tyas)") @@ -127,7 +131,7 @@ class SaleOrderLine(models.Model): domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", ) purchase_price = fields.Float('Purchase', required=True, digits='Product Price', default=0.0) purchase_tax_id = fields.Many2one('account.tax', string='Tax', - domain=['|', ('active', '=', False), ('active', '=', True)]) + domain=['|', ('active', '=', False), ('active', '=', True)]) def compute_item_margin(self): for line in self: |
