[FIX] repair: apply fiscal position account mapping
When creating an invoice from a repair order, the account mapping of the
fiscal position doesn't apply even though the tax one does
Steps to reproduce:
1. Install Repair and Accounting
2. Go to Accounting > Configuration > Invoicing > Fiscal Positions and
create a new fiscal position with:
- Name: 'FP test'
- Tax Mapping from 'Tax 15.00%' to a new tax 'Tax 10.00%'
- Account Mapping from '400000 Product Sales' to '450000 Other
Income'
3. Go to Sales > Products and create a new product 'Product A' with:
- Product Type: 'Consumable'
- Customer Taxes: 'Tax 15.00%'
- Income Account: '400000 Product Sales'
4. Create another product 'Product B' with same values except type which
is 'Service'
5. Go to Repairs and create a new repair order with:
- Any Product to Repair
- Any Customer (once set, edit the customer's fiscal position to 'FP
test')
- Invoice Method: 'Before Repair'
- Parts: add a line of type 'Add' with product 'Product A'
- Operations: add a line with product 'Product A'
6. Confirm the order, create an invoice and open it: the account mapping
of the fiscal position didn't apply (it should be '450000 Other
Income')
Solution:
Apply the fiscal position mapping on the income account of the product
opw-2902056
closes odoo/odoo#96038
X-original-commit: 02975a8a7b1803167a5ba8365cfbf29f80f84b2e
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
This commit is contained in:
@@ -418,7 +418,7 @@ class Repair(models.Model):
|
||||
else:
|
||||
name = operation.name
|
||||
|
||||
account = operation.product_id.product_tmpl_id._get_product_accounts()['income']
|
||||
account = operation.product_id.product_tmpl_id.get_product_accounts(fiscal_pos=fpos)['income']
|
||||
if not account:
|
||||
raise UserError(_('No account defined for product "%s".', operation.product_id.name))
|
||||
|
||||
@@ -460,7 +460,7 @@ class Repair(models.Model):
|
||||
if not fee.product_id:
|
||||
raise UserError(_('No product defined on fees.'))
|
||||
|
||||
account = fee.product_id.product_tmpl_id._get_product_accounts()['income']
|
||||
account = fee.product_id.product_tmpl_id.get_product_accounts(fiscal_pos=fpos)['income']
|
||||
if not account:
|
||||
raise UserError(_('No account defined for product "%s".', fee.product_id.name))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user