Skip to content

Commit

Permalink
[MIG] l10n_ar_sale: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasperalta1 authored and pablohmontenegro committed Feb 5, 2024
1 parent b250820 commit 3790e63
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 61 deletions.
4 changes: 2 additions & 2 deletions l10n_ar_sale/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
'name': 'Argentinian Sale Total Fields',
'version': "16.0.1.5.0",
'version': "17.0.1.0.0",
'category': 'Localization/Argentina',
'sequence': 14,
'author': 'ADHOC SA',
Expand All @@ -24,7 +24,7 @@
],
'demo': [
],
'installable': False,
'installable': True,
'auto_install': False,
'application': False,
}
2 changes: 1 addition & 1 deletion l10n_ar_sale/models/account_chart_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from odoo import models, api


class AccountChartTemplate(models.Model):
class AccountChartTemplate(models.AbstractModel):
_inherit = 'account.chart.template'

def _load_template(
Expand Down
2 changes: 1 addition & 1 deletion l10n_ar_sale/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SaleOrder(models.Model):
sale_checkbook_id = fields.Many2one(
'sale.checkbook',
readonly=True,
states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
# states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
)

@api.depends(
Expand Down
19 changes: 11 additions & 8 deletions l10n_ar_sale/views/l10n_ar_sale_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,25 @@
<t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" position="attributes">
<attribute name="t-value">current_subtotal + line.report_price_subtotal</attribute>
</t>
<t t-set="current_subtotal" t-value="current_subtotal + line.price_total" position="attributes">
<attribute name="t-value">current_subtotal + line.report_price_subtotal</attribute>
</t>

<xpath expr="//div[@t-field='line.price_unit']" position="attributes">
<attribute name="t-field">line.report_price_unit</attribute>
</xpath>
<xpath expr="//span[@t-field='line.price_subtotal']" position="attributes">
<attribute name="t-field">line.report_price_subtotal</attribute>
</xpath>
<span groups="account.group_show_line_subtotals_tax_included" position="replace">

<!-- no van mas -->
<!-- <span groups="account.group_show_line_subtotals_tax_included" position="replace">
<span groups="account.group_show_line_subtotals_tax_included">Amount</span>
</span>
<xpath expr="//span[@t-field='line.price_total']" position="attributes">
</span> -->
<!-- <xpath expr="//span[@t-field='line.price_total']" position="attributes">
<attribute name="t-field">line.report_price_subtotal</attribute>
</xpath>
</xpath> -->
<!-- <t t-set="current_subtotal" t-value="current_subtotal + line.price_total" position="attributes">
<attribute name="t-value">current_subtotal + line.report_price_subtotal</attribute>
</t> -->

<xpath expr="//span[contains(@t-out, 'line.tax_id')]" position="attributes">
<attribute name="t-out">', '.join(map(lambda x: (x.description or x.name), line.report_tax_id))</attribute>
</xpath>
Expand All @@ -37,7 +40,7 @@
</td>
</td>

<xpath expr="//div[@id='shipping_address']" position="before">
<xpath expr="//span[@id='shipping_address']" position="before">
<div class="mb-3 col-6" groups="l10n_ar_sale.group_delivery_date_on_report_online">
<strong>Delivery Date:</strong> <span t-field="sale_order.commitment_date" t-options="{&quot;widget&quot;: &quot;date&quot;}"/>
</div>
Expand Down
32 changes: 21 additions & 11 deletions l10n_ar_sale/views/sale_report_templates.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<template id="report_saleorder" inherit_id="sale.report_saleorder">
<template id="report_saleorder_raw" inherit_id="sale.report_saleorder_raw">
<t t-call="sale.report_saleorder_document" position="attributes">
<attribute name="t-call">#{ doc._get_name_sale_report('sale.report_saleorder_document') }</attribute>
</t>
Expand Down Expand Up @@ -65,21 +65,22 @@
<attribute name="t-value">current_subtotal + line.report_price_subtotal</attribute>
</t>

<t t-set="current_subtotal" t-value="current_subtotal + line.price_total" position="attributes">
<!-- no van mas -->
<!-- <t t-set="current_subtotal" t-value="current_subtotal + line.price_total" position="attributes">
<attribute name="t-value">current_subtotal + line.report_price_subtotal</attribute>
</t>
</t> -->

<span groups="account.group_show_line_subtotals_tax_included" position="replace">
<!-- <span groups="account.group_show_line_subtotals_tax_included" position="replace">
<span groups="account.group_show_line_subtotals_tax_included">Amount</span>
</span>
</span> -->

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

<span t-field="line.price_total" position="attributes">
<!-- <span t-field="line.price_total" position="attributes">
<attribute name="t-field">line.report_price_subtotal</attribute>
</span>
</span> -->

<!-- use column vat instead of taxes and only if vat discriminated -->
<th name="th_taxes" position="replace">
Expand All @@ -91,6 +92,15 @@
<span t-out="', '.join(map(lambda x: (x.description or x.name), line.tax_id.filtered(lambda x: x.tax_group_id.l10n_ar_vat_afip_code)))" id="line_tax_ids"/>
</td>
</td>
<!-- We change the name of the column depending on the tax discrimination -->
<th name="th_subtotal" class="text-end" position="replace">
<td t-if="doc.vat_discriminated" class="text-end" >
<span>SubTotal</span>
</td>
<td t-else="" class="text-end">
<span>Total</span>
</td>
</th>

<div id="informations" position="replace">
<div id="informations" class="row mt8 mb8">
Expand Down Expand Up @@ -144,7 +154,7 @@

</div>
</div>
<t t-call="account.document_tax_totals" position="attributes">
<t t-call="sale.document_tax_totals" position="attributes">
<attribute name="t-call">l10n_ar_sale.document_tax_totals</attribute>
</t>

Expand All @@ -159,7 +169,7 @@

<!-- Solo mostramos el "amount untaxed"" si corresponde discriminar iva. Probamos hacer esto directamente editando el computo de tax_totals pero no fue tan directo porque luego en la vista odoo se fija en esa key para terminar agregando impuestos y otras complicaciones (vista document_tax_totals)-->
<template id="document_tax_totals" inherit_id="account.document_tax_totals" primary="True">
<xpath expr="//t[@t-foreach]/tr" position="attributes">
<xpath expr="//t[@t-foreach]" position="attributes">
<attribute name="t-if">doc.vat_discriminated</attribute>
</xpath>
</template>
Expand All @@ -174,9 +184,9 @@
<t t-set="tax_totals" position="after">
<t t-set="doc" t-value="sale_order"/>
</t>
<t t-call="account.document_tax_totals" position="attributes">
<!-- <t t-call="sale.document_tax_totals" position="attributes">
<attribute name="t-call">l10n_ar_sale.document_tax_totals</attribute>
</t>
</t> -->
</template>

</odoo>
2 changes: 1 addition & 1 deletion l10n_ar_sale/views/sale_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<!-- <field name="currency_id" invisible="1"/> -->
</xpath>
<field name="payment_term_id" position="before">
<field name="sale_checkbook_id" domain="[('company_id','in', [company_id, False])]" groups="l10n_ar_sale.use_sale_checkbook"/>
<field name="sale_checkbook_id" domain="[('company_id','in', [company_id, False])]" groups="l10n_ar_sale.use_sale_checkbook" readonly="state not in ['draft', 'sent']"/>
</field>
</field>
</record>
Expand Down
51 changes: 14 additions & 37 deletions l10n_ar_sale/wizards/res_config_settings_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,23 @@

<record model="ir.ui.view" id="res_config_settings_view_form">
<field name="name">res.config.settings.view.form.inherit.l10n_ar_account</field>
<field name="inherit_id" ref="sale.res_config_settings_view_form"/>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="sale.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@data-key='sale_management']//div[hasclass('row','mt16', 'o_settings_container')][2]">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="group_price_unit_with_tax"/>
</div>
<div class="o_setting_right_pane">
<label for="group_price_unit_with_tax"/>
<div class="text-muted">
Show Unit Price with Taxes included On sale Order Lines
</div>
</div>
</div>
<xpath expr="//setting[@id='show_margins']" position="after">
<setting id="group_price_unit_with_tax" help="Show Unit Price with Taxes included On sale Order Lines" title="Show Unit Price with Taxes included On sale Order Lines.">
<field name="group_price_unit_with_tax"/>
</setting>
</xpath>

<xpath expr="//setting[@id='proforma_configuration']" position="after">
<setting id="group_use_sale_checkbook" help="Show Checkbook in Sale Order." title="Show Checkbook in Sale Order.">
<field name="group_use_sale_checkbook"/>
</setting>
<setting id="group_delivery_date" help="Shows the delivery date field in the budget report and in the online budget." title="Shows the delivery date field in the budget report and in the online budget.">
<field name="group_delivery_date"/>
</setting>
</xpath>
<div id="sale_config_online_confirmation_sign" position="before">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="group_use_sale_checkbook"/>
</div>
<div class="o_setting_right_pane">
<label for="group_use_sale_checkbook"/>
<div class="text-muted">
Show Checkbook in Sale Order.
</div>
</div>
</div>
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="group_delivery_date"/>
</div>
<div class="o_setting_right_pane">
<label for="group_delivery_date"/>
<div class="text-muted">
Shows the delivery date field in the budget report and in the online budget.
</div>
</div>
</div>
</div>
</field>
</record>

Expand Down

0 comments on commit 3790e63

Please sign in to comment.