Contributors mailing list archives

contributors@odoo-community.org

Avatar

Tax and account mapping depending of the product/category

by
Akretion France, Sébastien Beau
- 11/07/2022 07:43:02

Hi all I have created a discussion on github here (maybe easier to discuss and to keep an history)

https://github.com/OCA/account-fiscal-rule/discussions/298


I copy/paste the description of the discussion


Issue

When selling in Europe (or only in France but with some special dom-tom case), you need to apply local tax when reaching a certain amount. And sometime you need to map the tax (and also the account) depending of the product.

For example you sell products A and B with the tax 20% in France
But you need to sell it with a tax 13% for product A and 16% for product B in some fiscal position.

Right now it's impossible to do it



Solution

I would like to introduce a new module account_fiscal_product_rule

That will have the following data models


class AccountFiscalPositionProductRule():

    name = fields.Char()
    fiscal_position_id = fields.Many2one("account.fiscal.position")
    product_tmpl_ids = fields.Many2many("product.template")
    category_ids = fields.Many2many("product.category")
    account_income_id = fields.Many2one("account.account")
    account_expense_id = fields.Many2one("account.account")
    seller_tax_ids = fields.Many2Many("account.tax")
    supplier_tax_ids = fields.Many2Many("account.tax")


class ProductCategory():

    fiscal_position_product_rule_ids = fields.Many2many("account.fiscal.position.product.rule")


class ProductTemplate():

    fiscal_position_product_rule_ids = fields.Many2many("account.fiscal.position.product.rule")


Then we can inherit the mapping logic (tax and account) to apply first this "specific rule" and if not rule match apply native rules

Describe alternatives you've considered

I had thinking about adding product_ids and category_ids on "account.fiscal.position.account" and "account.fiscal.position.tax". But the UI not really good for end user (too much configuration), and code will be not so easy to inherit.



Thanks for your feedback (please put it in github)

Follow-Ups