[FIX] repair: Respect account.group_show_line_subtotals_tax_included
Steps to follow - Enable group_show_line_subtotals_tax_included - Create a repair order and add a tax to a line -> The subtotal doesn't contain the tax amount opw-2513287 closes odoo/odoo#78631 X-original-commit: 133888a1859d81a252177b58b046b54d22ba5ca8 Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com> Signed-off-by: Hubert Van De Walle <hubvd@users.noreply.github.com>
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -145,7 +145,8 @@
|
||||
<field name="product_uom" string="UoM" groups="uom.group_uom" optional="show"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="tax_id" widget="many2many_tags" optional="show"/>
|
||||
<field name="price_subtotal" widget="monetary"/>
|
||||
<field name="price_subtotal" widget="monetary" groups="account.group_show_line_subtotals_tax_excluded"/>
|
||||
<field name="price_total" widget="monetary" groups="account.group_show_line_subtotals_tax_included"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
@@ -189,7 +190,8 @@
|
||||
<field name="product_uom" string="Unit of Measure" groups="uom.group_uom" optional="show"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="tax_id" widget="many2many_tags" optional="show"/>
|
||||
<field name="price_subtotal" widget="monetary"/>
|
||||
<field name="price_subtotal" widget="monetary" groups="account.group_show_line_subtotals_tax_excluded"/>
|
||||
<field name="price_total" widget="monetary" groups="account.group_show_line_subtotals_tax_included"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user