[FIX] account, l10n_eu_oss: make OSS report work with cash basis OSS taxes
Before this fix, a cash basis OSS tax used together with a product using the "non-EU origin" tag didn't appear properly in the OSS import report. This was due to the fact the product tag was not copied on the cash basis move: it only appeared on the invoice, on non exigible lines. To fix that, we make the choice to keep the product tag as markup on the invoice, and to copy it to the cash basis lines created from move lines containing this tag. We therefore need a non-ambiguous way to identify account.account.tag objects that are used on products, since we don't want to copy tags used by taxes. Hence, we introduct a new value for the 'applicability' field of account.account.tag, limitating their use to products. closes odoo/odoo#76626 X-original-commit: 0dd712b876844c3e342447e4cf26b324fcaffc37 Related: odoo/enterprise#20916 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com> Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
This commit is contained in:
@@ -8,7 +8,7 @@ class AccountAccountTag(models.Model):
|
||||
_description = 'Account Tag'
|
||||
|
||||
name = fields.Char('Tag Name', required=True)
|
||||
applicability = fields.Selection([('accounts', 'Accounts'), ('taxes', 'Taxes')], required=True, default='accounts')
|
||||
applicability = fields.Selection([('accounts', 'Accounts'), ('taxes', 'Taxes'), ('products', 'Products')], required=True, default='accounts')
|
||||
color = fields.Integer('Color Index')
|
||||
active = fields.Boolean(default=True, help="Set active to false to hide the Account Tag without removing it.")
|
||||
tax_report_line_ids = fields.Many2many(string="Tax Report Lines", comodel_name='account.tax.report.line', relation='account_tax_report_line_tags_rel', help="The tax report lines using this tag")
|
||||
|
||||
@@ -232,6 +232,9 @@ class AccountPartialReconcile(models.Model):
|
||||
account = base_line.company_id.account_cash_basis_base_account_id or base_line.account_id
|
||||
tax_ids = base_line.tax_ids.filtered(lambda x: x.tax_exigibility == 'on_payment')
|
||||
is_refund = base_line.belongs_to_refund()
|
||||
tax_tags = tax_ids.get_tax_tags(is_refund, 'base')
|
||||
product_tags = base_line.tax_tag_ids.filtered(lambda x: x.applicability == 'products')
|
||||
all_tags = tax_tags + product_tags
|
||||
|
||||
return {
|
||||
'name': base_line.move_id.name,
|
||||
@@ -242,7 +245,7 @@ class AccountPartialReconcile(models.Model):
|
||||
'partner_id': base_line.partner_id.id,
|
||||
'account_id': account.id,
|
||||
'tax_ids': [Command.set(tax_ids.ids)],
|
||||
'tax_tag_ids': [Command.set(tax_ids.get_tax_tags(is_refund, 'base').ids)],
|
||||
'tax_tag_ids': [Command.set(all_tags.ids)],
|
||||
'tax_tag_invert': base_line.tax_tag_invert,
|
||||
}
|
||||
|
||||
@@ -277,7 +280,8 @@ class AccountPartialReconcile(models.Model):
|
||||
'''
|
||||
tax_ids = tax_line.tax_ids.filtered(lambda x: x.tax_exigibility == 'on_payment')
|
||||
base_tags = tax_ids.get_tax_tags(tax_line.tax_repartition_line_id.refund_tax_id, 'base')
|
||||
all_tags = base_tags + tax_line.tax_repartition_line_id.tag_ids
|
||||
product_tags = tax_line.tax_tag_ids.filtered(lambda x: x.applicability == 'products')
|
||||
all_tags = base_tags + tax_line.tax_repartition_line_id.tag_ids + product_tags
|
||||
|
||||
return {
|
||||
'name': tax_line.name,
|
||||
|
||||
@@ -39,7 +39,7 @@ class ProductTemplate(models.Model):
|
||||
account_tag_ids = fields.Many2many(
|
||||
string="Account Tags",
|
||||
comodel_name='account.account.tag',
|
||||
domain="[('tax_report_line_ids', '=', False), ('applicability', '=', 'taxes')]",
|
||||
domain="[('applicability', '=', 'products')]",
|
||||
help="Tags to be set on the base and tax journal items created for this product.")
|
||||
|
||||
def _get_product_accounts(self):
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
<group>
|
||||
<field name="user_type_id" widget="account_hierarchy_selection"/>
|
||||
<field name="tax_ids" widget="many2many_tags" domain="[('company_id','=',company_id)]" attrs="{'invisible': [('internal_group', '=', 'off_balance')]}"/>
|
||||
<field name="tag_ids" widget="many2many_tags" domain="[('applicability', '!=', 'taxes')]" context="{'default_applicability': 'accounts'}" options="{'no_create_edit': True}"/>
|
||||
<field name="tag_ids" widget="many2many_tags" domain="[('applicability', '=', 'accounts')]" context="{'default_applicability': 'accounts'}" options="{'no_create_edit': True}"/>
|
||||
<field name="allowed_journal_ids" widget="many2many_tags" domain="[('company_id','=',company_id)]" options="{'no_create_edit': True}"/>
|
||||
</group>
|
||||
<group>
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
<newline/>
|
||||
<field name="user_type_id" widget="account_hierarchy_selection"/>
|
||||
<field name="currency_id" options="{'no_create': True}" groups="base.group_multi_currency"/>
|
||||
<field name="tag_ids" domain="[('applicability', '!=', 'taxes')]" widget="many2many_tags" context="{'default_applicability': 'accounts'}"/>
|
||||
<field name="tag_ids" domain="[('applicability', '=', 'accounts')]" widget="many2many_tags" context="{'default_applicability': 'accounts'}"/>
|
||||
<field name="reconcile"/>
|
||||
<field name="chart_template_id"/>
|
||||
</group>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<record id="tag_eu_import" model="account.account.tag">
|
||||
<field name="name">non-EU origin</field>
|
||||
<field name="applicability">taxes</field>
|
||||
<field name="applicability">products</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
Reference in New Issue
Block a user