Skip to content

Commit a1a02dd

Browse files
migration-bot-adhocjjscarafia
authored andcommitted
[MIG] l10n_ar_sale: Migration to 19.0
1 parent 873bc04 commit a1a02dd

7 files changed

Lines changed: 27 additions & 34 deletions

File tree

l10n_ar_sale/__manifest__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Argentinian Sale Total Fields",
3-
"version": "18.0.1.7.0",
3+
"version": "19.0.1.0.0",
44
"category": "Localization/Argentina",
55
"sequence": 14,
66
"author": "ADHOC SA",
@@ -20,7 +20,7 @@
2020
"wizards/res_config_settings_view.xml",
2121
],
2222
"demo": [],
23-
"installable": False,
23+
"installable": True,
2424
"auto_install": False,
2525
"application": False,
2626
}

l10n_ar_sale/models/sale_order.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def _compute_tax_totals(self):
3838
return
3939

4040
for order in self.filtered(lambda x: not x.vat_discriminated):
41-
tax_groups = order.order_line.mapped("tax_id.tax_group_id")
41+
tax_groups = order.order_line.mapped("tax_ids.tax_group_id")
4242
if not tax_groups:
4343
continue
4444
to_remove_ids = tax_groups.filtered(lambda x: x.l10n_ar_vat_afip_code).ids
@@ -110,10 +110,10 @@ def _l10n_ar_recompute_fiscal_position_taxes(self):
110110
date = fields.Date.to_date(fields.Datetime.context_timestamp(rec, rec.date_order))
111111
new_taxes = rec.fiscal_position_id._l10n_ar_add_taxes(rec.partner_id, rec.company_id, date, "perception")
112112
for line in rec.order_line:
113-
to_unlink = line.tax_id.filtered(lambda x: x.tax_group_id in fp_tax_groups)
113+
to_unlink = line.tax_ids.filtered(lambda x: x.tax_group_id in fp_tax_groups)
114114
if to_unlink._origin != new_taxes:
115-
line.tax_id = [(3, tax.id) for tax in to_unlink] + [
116-
(4, tax.id) for tax in new_taxes if tax not in line.tax_id
115+
line.tax_ids = [(3, tax.id) for tax in to_unlink] + [
116+
(4, tax.id) for tax in new_taxes if tax not in line.tax_ids
117117
]
118118

119119
def copy(self, default=None):

l10n_ar_sale/models/sale_order_line.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ def _compute_report_price_reduce(self):
4444
line.report_price_reduce = price_type / line.product_uom_qty if line.product_uom_qty else 0.0
4545

4646
@api.depends(
47-
"tax_id.tax_group_id.l10n_ar_vat_afip_code",
47+
"tax_ids.tax_group_id.l10n_ar_vat_afip_code",
4848
)
4949
def _compute_vat_tax_id(self):
5050
for rec in self:
51-
vat_tax_id = rec.tax_id.filtered(lambda x: x.tax_group_id.l10n_ar_vat_afip_code)
51+
vat_tax_id = rec.tax_ids.filtered(lambda x: x.tax_group_id.l10n_ar_vat_afip_code)
5252
if len(vat_tax_id) > 1:
5353
raise UserError(_("Only one vat tax allowed per line"))
5454
rec.vat_tax_id = vat_tax_id
@@ -59,17 +59,17 @@ def _compute_report_prices_and_taxes(self):
5959
order = line.order_id
6060
taxes_included = not order.vat_discriminated
6161
price_digits = 10 ** self.env["decimal.precision"].precision_get("Product Price")
62-
price_unit = line.tax_id.compute_all(
62+
price_unit = line.tax_ids.compute_all(
6363
line.price_unit * price_digits, order.currency_id, 1.0, line.product_id, order.partner_shipping_id
6464
)
6565
if not taxes_included:
6666
report_price_unit = price_unit["total_excluded"] / price_digits
6767
report_price_subtotal = line.price_subtotal
68-
not_included_taxes = line.tax_id
68+
not_included_taxes = line.tax_ids
6969
report_price_net = report_price_unit * (1 - (line.discount or 0.0) / 100.0)
7070
else:
71-
included_taxes = line.tax_id.filtered(lambda x: x.tax_group_id.l10n_ar_vat_afip_code)
72-
not_included_taxes = line.tax_id - included_taxes
71+
included_taxes = line.tax_ids.filtered(lambda x: x.tax_group_id.l10n_ar_vat_afip_code)
72+
not_included_taxes = line.tax_ids - included_taxes
7373
report_price_unit = (
7474
included_taxes.compute_all(
7575
line.price_unit * price_digits,
@@ -112,9 +112,8 @@ def check_vat_tax(self):
112112
and x.company_id.country_id == self.env.ref("base.ar")
113113
and x.company_id.l10n_ar_company_requires_vat
114114
and x.product_type in ["consu", "service"]
115-
and x.product_type != "combo"
116115
):
117-
vat_taxes = rec.tax_id.filtered(lambda x: x.tax_group_id.l10n_ar_vat_afip_code)
116+
vat_taxes = rec.tax_ids.filtered(lambda x: x.tax_group_id.l10n_ar_vat_afip_code)
118117
if len(vat_taxes) != 1:
119118
raise UserError(
120119
_(
@@ -128,18 +127,18 @@ def check_vat_tax(self):
128127
def write(self, vals):
129128
res = super(SaleOrderLine, self).write(vals)
130129
# for performance we only check if tax or company is on vals
131-
if "tax_id" in vals or "company_id" in vals:
130+
if "tax_ids" in vals or "company_id" in vals:
132131
self.check_vat_tax()
133132
return res
134133

135-
def _compute_tax_id(self):
134+
def _compute_tax_ids(self):
136135
"""Agregado de taxes de modulo l10n_ar_tax segun fiscal position"""
137-
super()._compute_tax_id()
136+
super()._compute_tax_ids()
138137

139138
for rec in self.with_context(tz="America/Argentina/Buenos_Aires").filtered(
140139
"order_id.fiscal_position_id.l10n_ar_tax_ids"
141140
):
142141
date = fields.Date.to_date(fields.Datetime.context_timestamp(rec, rec.order_id.date_order))
143-
rec.tax_id += rec.order_id.fiscal_position_id._l10n_ar_add_taxes(
142+
rec.tax_ids += rec.order_id.fiscal_position_id._l10n_ar_add_taxes(
144143
rec.order_partner_id, rec.company_id, date, "perception"
145144
)

l10n_ar_sale/security/invoice_sale_security.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
<record id="sale_price_unit_with_tax" model="res.groups">
55
<field name="name">Sale Unit Prices w/ Taxes</field>
6-
<field name="category_id" ref="base.module_category_hidden"/>
76
</record>
87

98
</odoo>

l10n_ar_sale/views/l10n_ar_sale_templates.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
<odoo>
22
<template id="sale_order_portal_content" inherit_id="sale.sale_order_portal_content" name="Sales Order">
33

4-
<t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" position="attributes">
5-
<attribute name="t-value">current_subtotal + line.report_price_subtotal</attribute>
6-
</t>
7-
84
<xpath expr="//div[@t-field='line.price_unit']" position="attributes">
95
<attribute name="t-field">line.report_price_unit</attribute>
106
</xpath>
117
<xpath expr="//span[@t-field='line.price_subtotal']" position="attributes">
128
<attribute name="t-field">line.report_price_subtotal</attribute>
139
</xpath>
1410

15-
<xpath expr="//span[contains(@t-out, 'line.tax_id')]" position="attributes">
11+
<xpath expr="//span[contains(@t-out, 'line.tax_ids')]" position="attributes">
1612
<attribute name="t-out">', '.join(map(lambda x: (x.invoice_label or x.name), line.report_tax_id))</attribute>
1713
</xpath>
1814

@@ -25,7 +21,7 @@
2521
<!-- use column vat instead of taxes and only list vat taxes-->
2622
<td t-attf-class="text-end {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}" position="replace">
2723
<td id="taxes" t-if="sale_order.vat_discriminated" t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
28-
<span t-out="', '.join(map(lambda x: (x.invoice_label or x.name), line.tax_id.filtered(lambda x: x.tax_group_id.l10n_ar_vat_afip_code)))"/>
24+
<span t-out="', '.join(map(lambda x: (x.invoice_label or x.name), line.tax_ids.filtered(lambda x: x.tax_group_id.l10n_ar_vat_afip_code)))"/>
2925
</td>
3026
</td>
3127

l10n_ar_sale/views/sale_report_templates.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,25 @@
6262
<attribute name="t-value">', '.join([(tax.invoice_label or tax.name) for tax in line.report_tax_id])</attribute>
6363
</t>
6464

65-
<t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" position="attributes">
65+
<!-- NOTE: current_subtotal element no longer exists in Odoo 19.0, so we remove this inheritance -->
66+
<!-- <t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" position="attributes">
6667
<attribute name="t-value">current_subtotal + line.report_price_subtotal</attribute>
67-
</t>
68+
</t> -->
6869

6970
<span t-field="line.price_subtotal" position="attributes">
7071
<attribute name="t-field">line.report_price_subtotal</attribute>
7172
</span>
7273

7374
<!-- use column vat instead of taxes and only if vat discriminated -->
7475
<th name="th_taxes" position="replace">
75-
<th t-if="doc.vat_discriminated" name="th_taxes" t-attf-class="text-left {{ 'd-md-table-cell' if report_type == 'html' else '' }}"><span>% VAT</span></th>
76+
<th t-if="doc.vat_discriminated" name="th_taxes" t-attf-class="text-end {{ 'd-md-table-cell' if report_type == 'html' else '' }}"><span>% VAT</span></th>
7677
</th>
7778
<!-- use column vat instead of taxes and only list vat taxes-->
78-
<td name="td_taxes" position="attributes">
79+
<td name="td_product_taxes" position="attributes">
7980
<attribute name="t-if">doc.vat_discriminated</attribute>
8081
</td>
8182
<t t-set="taxes" position="attributes">
82-
<attribute name="t-value">', '.join([(tax.invoice_label or tax.name) for tax in line.tax_id.filtered(lambda x: x.tax_group_id.l10n_ar_vat_afip_code)])</attribute>
83+
<attribute name="t-value">', '.join([(tax.invoice_label or tax.name) for tax in line.tax_ids.filtered(lambda x: x.tax_group_id.l10n_ar_vat_afip_code)])</attribute>
8384
</t>
8485

8586
<!-- We change the name of the column depending on the tax discrimination -->

l10n_ar_sale/views/sale_view.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@
88
<group name="sale_info">
99
<field name="vat_discriminated"/>
1010
</group>
11-
<xpath expr="//field[@name='order_line']/list//field[@name='tax_id']" position="after">
11+
<xpath expr="//field[@name='order_line']/list//field[@name='tax_ids']" position="after">
1212
<field name="price_unit_with_tax" groups="l10n_ar_sale.sale_price_unit_with_tax" widget="monetary"/>
13-
<!-- <field name="currency_id" invisible="1"/> -->
1413
</xpath>
15-
<xpath expr="//field[@name='order_line']/form//field[@name='tax_id']" position="after">
14+
<xpath expr="//field[@name='order_line']/form//field[@name='tax_ids']" position="after">
1615
<field name="price_unit_with_tax" groups="l10n_ar_sale.sale_price_unit_with_tax" widget="monetary"/>
17-
<!-- <field name="currency_id" invisible="1"/> -->
1816
</xpath>
1917
</field>
2018
</record>

0 commit comments

Comments
 (0)