Skip to content

Commit

Permalink
[MIG] l10n_it_account_stamp: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jado95 committed Nov 10, 2022
1 parent adfa9b2 commit 65bf942
Show file tree
Hide file tree
Showing 9 changed files with 160 additions and 192 deletions.
2 changes: 1 addition & 1 deletion l10n_it_account_stamp/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

{
"name": "ITA - Imposta di bollo",
"version": "14.0.1.1.0",
"version": "16.0.1.0.0",
"category": "Localization/Italy",
"summary": "Gestione automatica dell'imposta di bollo",
"author": "Ermanno Gnan, Sergio Corato, Enrico Ganzaroli, "
Expand Down
48 changes: 23 additions & 25 deletions l10n_it_account_stamp/data/data.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data noupdate="1">
<odoo noupdate="1">

<record id="l10n_it_account_stamp_2_euro" model="product.product">
<field name="name">Tax Stamp 2 euro</field>
<field name="type">service</field>
<field name="list_price" eval="2.0" />
<field name="standard_price" eval="2.0" />
<field
name="description_sale"
>Stamp duty payment under the terms of Art. 6, Subsection 2 of MEF Decree June
17, 2014
</field>
<field name="is_stamp" eval="True" />
<field name="auto_compute" eval="True" />
<field name="stamp_apply_min_total_base" eval="77.47" />
<field name="taxes_id" eval="[(6, 0, [])]" />
<field name="supplier_taxes_id" eval="[(6, 0, [])]" />
</record>
<record id="l10n_it_account_stamp_2_euro" model="product.product">
<field name="name">Tax Stamp 2 euro</field>
<field name="type">service</field>
<field name="list_price" eval="2.0" />
<field name="standard_price" eval="2.0" />
<field
name="description_sale"
>Stamp duty payment under the terms of Art. 6, Subsection 2 of MEF Decree June
17, 2014
</field>
<field name="is_stamp" eval="True" />
<field name="auto_compute" eval="True" />
<field name="stamp_apply_min_total_base" eval="77.47" />
<field name="taxes_id" eval="[(6, 0, [])]" />
<field name="supplier_taxes_id" eval="[(6, 0, [])]" />
</record>

<record id="base.main_company" model="res.company">
<field
name="tax_stamp_product_id"
ref="l10n_it_account_stamp.l10n_it_account_stamp_2_euro"
/>
</record>
<record id="base.main_company" model="res.company">
<field
name="tax_stamp_product_id"
ref="l10n_it_account_stamp.l10n_it_account_stamp_2_euro"
/>
</record>

</data>
</odoo>
2 changes: 1 addition & 1 deletion l10n_it_account_stamp/i18n/it.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-12-24 15:03+0000\n"
"PO-Revision-Date: 2021-05-06 21:47+0000\n"
Expand Down
19 changes: 0 additions & 19 deletions l10n_it_account_stamp/migrations/13.0.1.0.0/post-migrate.py

This file was deleted.

10 changes: 4 additions & 6 deletions l10n_it_account_stamp/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
class AccountMove(models.Model):
_inherit = "account.move"

tax_stamp = fields.Boolean(
"Tax Stamp", readonly=False, compute="_compute_tax_stamp", store=True
)
tax_stamp = fields.Boolean(readonly=False, compute="_compute_tax_stamp", store=True)
auto_compute_stamp = fields.Boolean(
related="company_id.tax_stamp_product_id.auto_compute"
)
Expand Down Expand Up @@ -81,9 +79,9 @@ def add_tax_stamp_line(self):
"account_id": stamp_account.id,
"price_unit": stamp_product_id.list_price,
"quantity": 1,
"display_type": "product",
"product_uom_id": stamp_product_id.uom_id.id,
"tax_ids": [(6, 0, stamp_product_id.taxes_id.ids)],
"analytic_account_id": None,
}
inv.write({"invoice_line_ids": [(0, 0, invoice_line_vals)]})

Expand Down Expand Up @@ -125,7 +123,7 @@ def _build_tax_stamp_lines(self, product):
"date": self.invoice_date,
"debit": 0,
"credit": product.list_price,
"exclude_from_invoice_tab": True,
"display_type": "cogs",
"currency_id": self.currency_id.id,
}
if self.move_type == "out_refund":
Expand All @@ -141,7 +139,7 @@ def _build_tax_stamp_lines(self, product):
"date": self.invoice_date,
"debit": product.list_price,
"credit": 0,
"exclude_from_invoice_tab": True,
"display_type": "cogs",
"currency_id": self.currency_id.id,
}
if self.move_type == "out_refund":
Expand Down
4 changes: 2 additions & 2 deletions l10n_it_account_stamp/tests/test_account_stamp_invoicing.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def setUp(self):
[
("company_id", "=", self.env.company.id),
(
"user_type_id",
"account_type",
"=",
self.env.ref("account.data_account_type_revenue").id,
"income",
),
],
limit=1,
Expand Down
97 changes: 46 additions & 51 deletions l10n_it_account_stamp/views/account_move_view.xml
Original file line number Diff line number Diff line change
@@ -1,57 +1,52 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>

<!-- Form: Invoice Customer -->
<record id="account_move_form_stamp" model="ir.ui.view">
<field name="name">account.move.form.stamp</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form" />
<field name="arch" type="xml">
<xpath
expr="//field[@name='invoice_line_ids']/tree/field[@name='sequence']"
position="after"
>
<field name="is_stamp_line" invisible="1" />
</xpath>
<xpath
expr="//field[@name='invoice_line_ids']/tree"
position="attributes"
>
<attribute name="colors">CadetBlue:is_stamp_line==True;</attribute>
</xpath>
<xpath expr="//group[@id='header_right_group']" position="inside">
<field name="auto_compute_stamp" invisible="1" />
<field name="tax_stamp" string="Tax stamp" invisible="1" />
<field
name="manually_apply_tax_stamp"
attrs="{'invisible': [('auto_compute_stamp', '=', True)]}"
/>
</xpath>
<field name="narration" position="before">
<img
src="/l10n_it_account_stamp/static/description/icon.png"
alt="Tax stamp"
attrs="{'invisible': [('tax_stamp', '=', False)]}"
/>
<button
class="oe_edit_only"
type="object"
string="Add tax stamp line"
name="add_tax_stamp_line"
attrs="{'invisible': ['|',('tax_stamp', '=', False),('state', 'not in', 'draft')]}"
/>
<!--move narration down-->
<div />
</field>
<xpath
expr="//form/sheet/notebook/page[@id='invoice_tab']/field/form/sheet/group/field[@name='product_id']"
position="after"
>
<field name="is_stamp_line" invisible="1" />
</xpath>
<!-- Form: Invoice Customer -->
<record id="account_move_form_stamp" model="ir.ui.view">
<field name="name">account.move.form.stamp</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form" />
<field name="arch" type="xml">
<xpath
expr="//field[@name='invoice_line_ids']/tree/field[@name='sequence']"
position="after"
>
<field name="is_stamp_line" invisible="1" />
</xpath>
<xpath expr="//field[@name='invoice_line_ids']/tree" position="attributes">
<attribute name="colors">CadetBlue:is_stamp_line==True;</attribute>
</xpath>
<xpath expr="//group[@id='header_right_group']" position="inside">
<field name="auto_compute_stamp" invisible="1" />
<field name="tax_stamp" string="Tax stamp" invisible="1" />
<field
name="manually_apply_tax_stamp"
attrs="{'invisible': [('auto_compute_stamp', '=', True)]}"
/>
</xpath>
<field name="narration" position="before">
<img
src="/l10n_it_account_stamp/static/description/icon.png"
alt="Tax stamp"
attrs="{'invisible': [('tax_stamp', '=', False)]}"
/>
<button
class="oe_edit_only"
type="object"
string="Add tax stamp line"
name="add_tax_stamp_line"
attrs="{'invisible': ['|',('tax_stamp', '=', False),('state', 'not in', 'draft')]}"
/>
<!--move narration down-->
<div />
</field>
</record>
<xpath
expr="//form/sheet/notebook/page[@id='invoice_tab']/field/form/sheet/group/field[@name='product_id']"
position="after"
>
<field name="is_stamp_line" invisible="1" />
</xpath>
</field>
</record>

</data>
</odoo>
75 changes: 37 additions & 38 deletions l10n_it_account_stamp/views/company_view.xml
Original file line number Diff line number Diff line change
@@ -1,45 +1,44 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<record model="ir.ui.view" id="view_account_config_settings_stamp">
<field name="name">view_account_config_settings_stamp</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form" />
<field name="arch" type="xml">
<div id="eu_service" position="after">
<div
class="col-12 col-lg-6 o_setting_box"
title="Configuration for Tax stamp"
>
<div class="o_setting_left_pane" />
<div class="o_setting_right_pane">
<span
class="o_form_label"
>Configuration for Tax stamp</span>
<span
class="fa fa-lg fa-building-o"
title="Values set here are company-specific."
aria-label="Values set here are company-specific."
groups="base.group_multi_company"
role="img"
/>
<div class="text-muted">
Product used as Tax Stamp in customer invoices
</div>
<div class="content-group">
<div class="row mt16">
<label
string="Tax Stamp Product"
for="tax_stamp_product_id"
class="col-lg-3 o_light_label"
/>
<field name="tax_stamp_product_id" />
</div>

<record model="ir.ui.view" id="view_account_config_settings_stamp">
<field name="name">view_account_config_settings_stamp</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form" />
<field name="arch" type="xml">
<div id="eu_service" position="after">
<div
class="col-12 col-lg-6 o_setting_box"
title="Configuration for Tax stamp"
>
<div class="o_setting_left_pane" />
<div class="o_setting_right_pane">
<span class="o_form_label">Configuration for Tax stamp
</span>
<span
class="fa fa-lg fa-building-o"
title="Values set here are company-specific."
aria-label="Values set here are company-specific."
groups="base.group_multi_company"
role="img"
/>
<div class="text-muted">
Product used as Tax Stamp in customer invoices
</div>
<div class="content-group">
<div class="row mt16">
<label
string="Tax Stamp Product"
for="tax_stamp_product_id"
class="col-lg-3 o_light_label"
/>
<field name="tax_stamp_product_id" />
</div>
</div>
</div>
</div>
</field>
</record>
</data>
</div>
</field>
</record>

</odoo>
Loading

0 comments on commit 65bf942

Please sign in to comment.