Skip to content

Commit

Permalink
[MIG] l10n_it_reverse_charge: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
are-agilebg committed May 11, 2023
1 parent c16d962 commit c0c5c36
Show file tree
Hide file tree
Showing 12 changed files with 88 additions and 289 deletions.
2 changes: 1 addition & 1 deletion l10n_it_reverse_charge/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

{
"name": "ITA - Inversione contabile",
"version": "14.0.1.2.2",
"version": "16.0.1.0.0",
"category": "Localization/Italy",
"summary": "Inversione contabile",
"author": "Odoo Italia Network, Odoo Community Association (OCA)",
Expand Down
18 changes: 8 additions & 10 deletions l10n_it_reverse_charge/data/rc_type.xml
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data noupdate="1">

<record id="account_rc_type_1" model="account.rc.type">
<field name="name">Intra-EU (VAT Integration)</field>
<field name="method">integration</field>
<field
name="description"
>Configuration of Intra-EU trade using the VAT Integration method</field>
name="description"
>Configuration of Intra-EU trade using the VAT Integration method</field>
</record>

<record id="account_rc_type_2" model="account.rc.type">
<field name="name">Extra-EU (VAT Integration)</field>
<field name="method">integration</field>
<field
name="description"
>Configuration of Extra-EU trade using the VAT Integration method</field>
name="description"
>Configuration of Extra-EU trade using the VAT Integration method</field>
</record>

<record id="account_rc_type_3" model="account.rc.type">
<field name="name">Extra-EU (Self-invoice)</field>
<field name="method">selfinvoice</field>
<field
name="description"
>Configuration of Extra-EU trade using the self-invoice method</field>
name="description"
>Configuration of Extra-EU trade using the self-invoice method</field>
</record>

<record id="account_rc_type_4" model="account.rc.type">
<field name="name">Intra-EU (Self-invoice)</field>
<field name="method">selfinvoice</field>
<field
name="description"
>Configuration of Intra-EU trade using the self-invoice method</field>
name="description"
>Configuration of Intra-EU trade using the self-invoice method</field>
</record>

</data>
</odoo>
13 changes: 0 additions & 13 deletions l10n_it_reverse_charge/migrations/13.0.1.0.0/noupdate_changes.xml

This file was deleted.

37 changes: 0 additions & 37 deletions l10n_it_reverse_charge/migrations/13.0.1.0.0/post-migration.py

This file was deleted.

187 changes: 0 additions & 187 deletions l10n_it_reverse_charge/migrations/13.0.1.0.0/pre-migration.py

This file was deleted.

17 changes: 9 additions & 8 deletions l10n_it_reverse_charge/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AccountMoveLine(models.Model):
"tax_ids",
)
def _compute_rc_flag(self):
for line in self.filtered(lambda r: not r.exclude_from_invoice_tab):
for line in self.filtered(lambda r: r.display_type == "product"):
if line.move_id.is_purchase_document():
line.rc = bool(line.move_id.fiscal_position_id.rc_type_id)

Expand Down Expand Up @@ -75,11 +75,11 @@ def rc_inv_vals(self, partner, rc_type, lines, currency):

narration = _(
"Reverse charge self invoice.\n"
"Supplier: %s\n"
"Reference: %s\n"
"Date: %s\n"
"Internal reference: %s"
) % (
"Supplier: {}\n"
"Reference: {}\n"
"Date: {}\n"
"Internal reference: {}"
).format(
self.partner_id.display_name,
self.invoice_origin or self.ref or "",
self.date,
Expand Down Expand Up @@ -235,8 +235,9 @@ def generate_self_invoice(self):
line_tax_ids = line.tax_ids
if not line_tax_ids:
raise UserError(
_("Invoice %s, line\n%s\nis RC but has not tax")
% ((self.name or self.partner_id.display_name), line.name)
_("Invoice {}, line\n{}\nis RC but has not tax").format(
(self.name or self.partner_id.display_name), line.name
)
)
mapped_taxes = rc_type.map_tax(
line_tax_ids,
Expand Down
5 changes: 2 additions & 3 deletions l10n_it_reverse_charge/models/account_rc_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,9 @@ class AccountRCType(models.Model):
_name = "account.rc.type"
_description = "Reverse Charge Type"

name = fields.Char("Name", required=True)
name = fields.Char(required=True)
method = fields.Selection(
selection=[("integration", "VAT Integration"), ("selfinvoice", "Self Invoice")],
string="Method",
required=True,
)
partner_type = fields.Selection(
Expand Down Expand Up @@ -113,7 +112,7 @@ class AccountRCType(models.Model):
string="Self Invoice Tax Mapping",
copy=False,
)
description = fields.Text("Description")
description = fields.Text()
self_invoice_text = fields.Text("Text in Self Invoice")
company_id = fields.Many2one(
"res.company",
Expand Down
10 changes: 4 additions & 6 deletions l10n_it_reverse_charge/security/reverse_charge_security.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data noupdate="1">

<record id="rc_type_comp_rule" model="ir.rule">
<field name="name">Reverse Charge Type multi-company</field>
<field name="model_id" ref="model_account_rc_type" />
<field name="global" eval="True" />
<field
name="domain_force"
>['|',('company_id','=',False),('company_id','in',company_ids)]
name="domain_force"
>['|',('company_id','=',False),('company_id','in',company_ids)]
</field>
</record>
<record id="rc_type_tax_comp_rule" model="ir.rule">
<field name="name">Tax Mapping for self invoices multi-company</field>
<field name="model_id" ref="model_account_rc_type_tax" />
<field name="global" eval="True" />
<field
name="domain_force"
>['|',('company_id','=',False),('company_id','in',company_ids)]
name="domain_force"
>['|',('company_id','=',False),('company_id','in',company_ids)]
</field>
</record>

</data>
</odoo>
Loading

0 comments on commit c0c5c36

Please sign in to comment.