diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-02-10 14:45:54 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-02-10 14:45:54 +0700 |
| commit | 3de9e2a7e2b9b455fa85e33231612996538830f4 (patch) | |
| tree | c31cd2576cc20a1655af84eda29335d67b216c90 /indoteknik_custom/models/sale_order.py | |
| parent | 519d2466e550ccf382466b8bb46af84169f3267b (diff) | |
| parent | dec973e8e6b8647e8762ab6ce32d90df371cd24b (diff) | |
Merge branch 'release' of bitbucket.org:altafixco/indoteknik-addons into release
Diffstat (limited to 'indoteknik_custom/models/sale_order.py')
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 7d7eb86c..f21554f7 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -67,6 +67,14 @@ class SaleOrder(models.Model): ('authorize', 'Authorize'), ], string='Payment Status', help='Payment Gateway Status / Midtrans / Web, https://docs.midtrans.com/en/after-payment/status-cycle') + def calculate_line_no(self): + line_no = 0 + for line in self.order_line: + if line.product_id.type == 'product': + line_no += 1 + line.line_no = line_no + # _logger.info('Calculate PO Line No %s' % line.id) + def calculate_so_status_beginning(self): so_state = ['sale'] sales = self.env['sale.order'].search([ @@ -273,6 +281,7 @@ class SaleOrder(models.Model): raise UserError("Harus diapprove oleh Manager") else: order.approval_status = 'approved' + order.calculate_line_no() return res @@ -331,6 +340,7 @@ class SaleOrderLine(models.Model): domain=['|', ('active', '=', False), ('active', '=', True)]) delivery_amt_line = fields.Float('DeliveryAmtLine', compute='compute_delivery_amt_line') fee_third_party_line = fields.Float('FeeThirdPartyLine', compute='compute_fee_third_party_line', default=0) + line_no = fields.Integer('No', default=0) def compute_item_margin(self): for line in self: |
