diff --git a/addons/repair/models/repair.py b/addons/repair/models/repair.py index 3c072d8904c..8b9e2fbfbc2 100644 --- a/addons/repair/models/repair.py +++ b/addons/repair/models/repair.py @@ -630,7 +630,8 @@ class RepairLine(models.Model): domain="[('type', 'in', ['product', 'consu']), '|', ('company_id', '=', company_id), ('company_id', '=', False)]") invoiced = fields.Boolean('Invoiced', copy=False, readonly=True) price_unit = fields.Float('Unit Price', required=True, digits='Product Price') - price_subtotal = fields.Float('Subtotal', compute='_compute_price_subtotal', store=True, digits=0) + price_subtotal = fields.Float('Subtotal', compute='_compute_price_total_and_subtotal', store=True, digits=0) + price_total = fields.Float('Total', compute='_compute_price_total_and_subtotal', store=True, digits=0) tax_id = fields.Many2many( 'account.tax', 'repair_operation_line_tax', 'repair_operation_line_id', 'tax_id', 'Taxes', domain="[('type_tax_use','=','sale'), ('company_id', '=', company_id)]", check_company=True) @@ -665,11 +666,12 @@ class RepairLine(models.Model): help='The status of a repair line is set automatically to the one of the linked repair order.') tracking = fields.Selection(string='Product Tracking', related="product_id.tracking") - @api.depends('price_unit', 'repair_id', 'product_uom_qty', 'product_id', 'repair_id.invoice_method') - def _compute_price_subtotal(self): + @api.depends('price_unit', 'repair_id', 'product_uom_qty', 'product_id', 'tax_id', 'repair_id.invoice_method') + def _compute_price_total_and_subtotal(self): for line in self: taxes = line.tax_id.compute_all(line.price_unit, line.repair_id.pricelist_id.currency_id, line.product_uom_qty, line.product_id, line.repair_id.partner_id) line.price_subtotal = taxes['total_excluded'] + line.price_total = taxes['total_included'] @api.onchange('type') def onchange_operation_type(self): @@ -764,18 +766,20 @@ class RepairFee(models.Model): price_unit = fields.Float('Unit Price', required=True, digits='Product Price') product_uom = fields.Many2one('uom.uom', 'Product Unit of Measure', required=True, domain="[('category_id', '=', product_uom_category_id)]") product_uom_category_id = fields.Many2one(related='product_id.uom_id.category_id') - price_subtotal = fields.Float('Subtotal', compute='_compute_price_subtotal', store=True, digits=0) + price_subtotal = fields.Float('Subtotal', compute='_compute_price_total_and_subtotal', store=True, digits=0) + price_total = fields.Float('Total', compute='_compute_price_total_and_subtotal', store=True, digits=0) tax_id = fields.Many2many( 'account.tax', 'repair_fee_line_tax', 'repair_fee_line_id', 'tax_id', 'Taxes', domain="[('type_tax_use','=','sale'), ('company_id', '=', company_id)]", check_company=True) invoice_line_id = fields.Many2one('account.move.line', 'Invoice Line', copy=False, readonly=True, check_company=True) invoiced = fields.Boolean('Invoiced', copy=False, readonly=True) - @api.depends('price_unit', 'repair_id', 'product_uom_qty', 'product_id') - def _compute_price_subtotal(self): + @api.depends('price_unit', 'repair_id', 'product_uom_qty', 'product_id', 'tax_id') + def _compute_price_total_and_subtotal(self): for fee in self: taxes = fee.tax_id.compute_all(fee.price_unit, fee.repair_id.pricelist_id.currency_id, fee.product_uom_qty, fee.product_id, fee.repair_id.partner_id) fee.price_subtotal = taxes['total_excluded'] + fee.price_total = taxes['total_included'] @api.onchange('repair_id', 'product_id', 'product_uom_qty') def onchange_product_id(self): diff --git a/addons/repair/views/repair_views.xml b/addons/repair/views/repair_views.xml index 9815559852c..88bfdb1018d 100644 --- a/addons/repair/views/repair_views.xml +++ b/addons/repair/views/repair_views.xml @@ -145,7 +145,8 @@ - + + @@ -189,7 +190,8 @@ - + +