[FIX] l10n_eu_service: make use of the new tax model
closes odoo/odoo#40526 X-original-commit: 87f2aae6c91e70f4f4102bf7ea41858db7dee16f Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
This commit is contained in:
@@ -70,6 +70,16 @@ class l10n_eu_service(models.TransientModel):
|
||||
'res.country', 'l10n_eu_service_country_rel_todo', default=_default_todo_country_ids,
|
||||
string='EU Customers From', required=True)
|
||||
|
||||
def _get_repartition_line_copy_values(self, original_rep_lines):
|
||||
return [(0, 0, {
|
||||
'factor_percent': line.factor_percent,
|
||||
'repartition_type': line.repartition_type,
|
||||
'account_id': line.repartition_type == 'tax' and (self.account_collected_id.id or line.account_id.id) or None,
|
||||
'tag_ids': [(6, 0, line.tag_ids.ids)],
|
||||
'company_id': line.company_id.id,
|
||||
'sequence': line.sequence,
|
||||
}) for line in original_rep_lines]
|
||||
|
||||
def generate_eu_service(self):
|
||||
tax_rate = self.env["l10n_eu_service.service_tax_rate"]
|
||||
account_tax = self.env['account.tax']
|
||||
@@ -81,8 +91,8 @@ class l10n_eu_service(models.TransientModel):
|
||||
data_tax = {
|
||||
'name': tax_name,
|
||||
'amount': tax_rate.search([('country_id', '=', country.id)]).rate,
|
||||
'account_id': self.account_collected_id.id or self.tax_id.account_id.id,
|
||||
'refund_account_id': self.account_collected_id.id or self.tax_id.refund_account_id.id,
|
||||
'invoice_repartition_line_ids': self._get_repartition_line_copy_values(self.tax_id.invoice_repartition_line_ids),
|
||||
'refund_repartition_line_ids': self._get_repartition_line_copy_values(self.tax_id.refund_repartition_line_ids),
|
||||
'type_tax_use': 'sale',
|
||||
'description': "EU-VAT-%s-S" % country.code,
|
||||
'sequence': 1000,
|
||||
|
||||
@@ -23,14 +23,13 @@
|
||||
<field name="tax_id"
|
||||
domain="[('type_tax_use', '=', 'sale'),
|
||||
('amount_type', '=', 'percent'),
|
||||
('account_id', '!=', False),
|
||||
('company_id','=', company_id)]"
|
||||
options="{'no_create': True}"/>
|
||||
<field name="account_collected_id"
|
||||
<field name="account_collected_id"
|
||||
placeholder="Keep empty to use current Service VAT account"/>
|
||||
<field name="done_country_ids" widget="many2many_tags" readonly="1"
|
||||
<field name="done_country_ids" widget="many2many_tags" readonly="1"
|
||||
attrs="{'invisible': [('done_country_ids', '=', [(6, False, [])])]}"/>
|
||||
<field name="todo_country_ids" widget="many2many_tags"
|
||||
<field name="todo_country_ids" widget="many2many_tags"
|
||||
domain="[('country_group_ids', 'in', %(base.europe)d)]"/>
|
||||
</group>
|
||||
<footer>
|
||||
|
||||
Reference in New Issue
Block a user