From b0152e913e55d4061abe1a0e96c558f62a99a830 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 30 Jan 2025 13:48:19 +0700 Subject: cr on account move line and add tracking on shipping paid by and shipping covered by on sale order --- indoteknik_custom/models/account_move_line.py | 6 ++++++ indoteknik_custom/models/sale_order.py | 4 ++-- indoteknik_custom/views/account_move.xml | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/account_move_line.py b/indoteknik_custom/models/account_move_line.py index a4b25109..c4a65209 100644 --- a/indoteknik_custom/models/account_move_line.py +++ b/indoteknik_custom/models/account_move_line.py @@ -7,6 +7,12 @@ class AccountMoveLine(models.Model): cost_centre_id = fields.Many2one('cost.centre', string='Cost Centre') is_required = fields.Boolean(string='Is Required', compute='_compute_is_required') analytic_account_ids = fields.Many2many('account.analytic.account', string='Analytic Account') + line_no = fields.Integer('No', default=0, compute='_compute_line_no') + + def _compute_line_no(self): + if self.move_id: + for index, line in enumerate(self.move_id.invoice_line_ids, start=1): + line.line_no = index @api.onchange('account_id') def _onchange_account_id(self): diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 98468c4b..132aa397 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -28,11 +28,11 @@ class SaleOrder(models.Model): shipping_cost_covered = fields.Selection([ ('indoteknik', 'Indoteknik'), ('customer', 'Customer') - ], string='Shipping Covered by', help='Siapa yang menanggung biaya ekspedisi?', copy=False) + ], string='Shipping Covered by', help='Siapa yang menanggung biaya ekspedisi?', copy=False, tracking=3) shipping_paid_by = fields.Selection([ ('indoteknik', 'Indoteknik'), ('customer', 'Customer') - ], string='Shipping Paid by', help='Siapa yang talangin dulu Biaya ekspedisi-nya?', copy=False) + ], string='Shipping Paid by', help='Siapa yang talangin dulu Biaya ekspedisi-nya?', copy=False, tracking=3) sales_tax_id = fields.Many2one('account.tax', string='Tax', domain=['|', ('active', '=', False), ('active', '=', True)]) have_outstanding_invoice = fields.Boolean('Have Outstanding Invoice', compute='_have_outstanding_invoice') have_outstanding_picking = fields.Boolean('Have Outstanding Picking', compute='_have_outstanding_picking') diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml index 36b292e8..50a34e11 100644 --- a/indoteknik_custom/views/account_move.xml +++ b/indoteknik_custom/views/account_move.xml @@ -137,6 +137,9 @@ {'column_invisible': [('parent.move_type', '!=', 'in_invoice')]} + + + -- cgit v1.2.3