Skip to content

Commit

Permalink
[MIG] l10n_it_intrastat_statement: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Borruso committed Oct 3, 2023
1 parent d244908 commit 501deea
Show file tree
Hide file tree
Showing 18 changed files with 61 additions and 99 deletions.
14 changes: 7 additions & 7 deletions l10n_it_intrastat_statement/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ ITA - Dichiarazione Intrastat
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_intrastat_statement
:target: https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_intrastat_statement
:alt: OCA/l10n-italy
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_intrastat_statement
:target: https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_intrastat_statement
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/122/14.0
:alt: Try me on Runbot
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/l10n-italy&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Expand Down Expand Up @@ -100,7 +100,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-italy/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_intrastat_statement%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_intrastat_statement%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -138,6 +138,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_intrastat_statement>`_ project on GitHub.
This module is part of the `OCA/l10n-italy <https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_intrastat_statement>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion l10n_it_intrastat_statement/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "ITA - Dichiarazione Intrastat",
"version": "14.0.1.3.0",
"version": "16.0.1.0.0",
"category": "Account",
"summary": "Dichiarazione Intrastat per l'Agenzia delle Dogane",
"author": "Openforce, Link IT srl, Agile Business Group, "
Expand Down

This file was deleted.

This file was deleted.

20 changes: 11 additions & 9 deletions l10n_it_intrastat_statement/models/intrastat_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ def _compute_amount_section(self, section_type, section_number):
]
):
raise UserError(
_("Wrong section type %s or number %s") % (section_type, section_number)
_(
"Wrong section type %(section_type)s or number %(section_number)s",
section_type=section_type,
section_number=section_number,
)
)
for statement in self:
op_number = len(statement[section_ids_field])
Expand Down Expand Up @@ -197,7 +201,6 @@ def _get_sequence(self):
("M", "Month"),
("T", "Quarter"),
],
string="Period Type",
default="M",
required=True,
)
Expand All @@ -222,7 +225,6 @@ def _get_sequence(self):
"Change Period in quarter: only first and second month " "operations",
),
],
string="Content Type",
required=True,
default="0",
)
Expand All @@ -233,7 +235,6 @@ def _get_sequence(self):
("9", "First Statement in Ceasing Activity or Changing VAT Number"),
("0", "None of the above cases"),
],
string="Special Cases",
required=True,
default="0",
)
Expand Down Expand Up @@ -410,11 +411,12 @@ def _get_sequence(self):
compute="_compute_amount_purchase_s4",
)

@api.model
def create(self, vals):
statement = super().create(vals)
statement._normalize_statement()
return statement
@api.model_create_multi
def create(self, vals_list):
statements = super().create(vals_list)
for statement in statements:
statement._normalize_statement()
return statements

def write(self, vals):
res = super().write(vals)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class IntrastatStatementPurchaseSection1(models.Model):
default=lambda m: m._default_transaction_nature_b_id(),
)
weight_kg = fields.Integer(string="Net Mass (kg)")
additional_units = fields.Integer(string="Additional Units")
additional_units = fields.Integer()
additional_units_required = fields.Boolean(
string="Additional Unit Required",
store=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _prepare_statement_line(self, inv_intra_line, statement_id=None):
return res

def _export_line_checks(self, section_label, section_number):
super(IntrastatStatementPurchaseSection2, self)._export_line_checks(
res = super(IntrastatStatementPurchaseSection2, self)._export_line_checks(
section_label, section_number
)
if not self.year_id:
Expand All @@ -102,6 +102,7 @@ def _export_line_checks(self, section_label, section_number):
"on 'Purchases - Section 2' adjustment"
)
)
return res

def _prepare_export_line(self):
self._export_line_checks(_("Purchase"), self.get_section_number())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@ class IntrastatStatementPurchaseSection3(models.Model):
_name = "account.intrastat.statement.purchase.section3"
_description = "Intrastat Statement - Purchases Section 3"

invoice_number = fields.Char(string="Invoice Number")
invoice_date = fields.Date(string="Invoice Date")
supply_method = fields.Selection(
selection=[("I", "Instant"), ("R", "Repeated")], string="Supply Method"
)
invoice_number = fields.Char()
invoice_date = fields.Date()
supply_method = fields.Selection(selection=[("I", "Instant"), ("R", "Repeated")])
payment_method = fields.Selection(
selection=[("B", "Bank Transfer"), ("A", "Credit"), ("X", "Other")],
string="Payment Method",
)
country_payment_id = fields.Many2one(
comodel_name="res.country", string="Payment Country"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@ class IntrastatStatementPurchaseSection4(models.Model):
string="Progressive to Adjust ID",
)
progressive_to_modify = fields.Integer(string="Progressive to Adjust")
invoice_number = fields.Char(string="Invoice Number")
invoice_date = fields.Date(string="Invoice Date")
invoice_number = fields.Char()
invoice_date = fields.Date()
supply_method = fields.Selection(
selection=[("I", "Instant"), ("R", "Repeated")], string="Supply Method"
selection=[("I", "Instant"), ("R", "Repeated")],
)
payment_method = fields.Selection(
selection=[("B", "Bank Transfer"), ("A", "Credit"), ("X", "Other")],
string="Payment Method",
)
country_payment_id = fields.Many2one(
comodel_name="res.country", string="Payment Country"
Expand Down Expand Up @@ -65,7 +64,7 @@ def _prepare_statement_line(self, inv_intra_line, statement_id=None):
return res

def _export_line_checks(self, section_label, section_number):
super(IntrastatStatementPurchaseSection4, self)._export_line_checks(
res = super(IntrastatStatementPurchaseSection4, self)._export_line_checks(
section_label, section_number
)
if not self.year_id:
Expand All @@ -88,6 +87,7 @@ def _export_line_checks(self, section_label, section_number):
raise ValidationError(
_("Missing payment country on 'Purchases - Section 4'")
)
return res

def _prepare_export_line(self):
self._export_line_checks(_("Purchase"), 4)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class IntrastatStatementSaleSection1(models.Model):
default=lambda m: m._default_transaction_nature_id(),
)
weight_kg = fields.Integer(string="Net Mass (kg)")
additional_units = fields.Integer(string="Additional Units")
additional_units = fields.Integer()
additional_units_required = fields.Boolean(
string="Additional Unit Required",
store=True,
Expand Down Expand Up @@ -49,7 +49,6 @@ class IntrastatStatementSaleSection1(models.Model):
comodel_name="res.country", string="Origin Country"
)
triangulation = fields.Boolean(
string="Triangulation",
default=False,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def _prepare_statement_line(self, inv_intra_line, statement_id=None):
return res

def _export_line_checks(self, section_label, section_number):
super(IntrastatStatementSaleSection2, self)._export_line_checks(
res = super(IntrastatStatementSaleSection2, self)._export_line_checks(
section_label, section_number
)
if not self.year_id:
Expand All @@ -88,6 +88,7 @@ def _export_line_checks(self, section_label, section_number):
raise ValidationError(
_("Missing reference quarter on 'Sales - Section 2' adjustment")
)
return res

@api.model
def _prepare_export_line(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ class IntrastatStatementSaleSection3(models.Model):
_name = "account.intrastat.statement.sale.section3"
_description = "Intrastat Statement - Sales Section 3"

invoice_number = fields.Char(string="Invoice Number")
invoice_date = fields.Date(string="Invoice Date")
invoice_number = fields.Char()
invoice_date = fields.Date()
supply_method = fields.Selection(
selection=[("I", "Instant"), ("R", "Repeated")], string="Supply Method"
selection=[("I", "Instant"), ("R", "Repeated")],
)
payment_method = fields.Selection(
selection=[("B", "Bank Transfer"), ("A", "Credit"), ("X", "Other")],
string="Payment Method",
)
country_payment_id = fields.Many2one(
comodel_name="res.country", string="Payment Country"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,18 @@ class IntrastatStatementSaleSection4(models.Model):
year_id = fields.Integer(string="Ref. Year")
protocol = fields.Integer(string="Protocol Number")
progressive_to_modify = fields.Integer(string="Progressive to Adjust")
invoice_number = fields.Char(string="Invoice Number")
invoice_date = fields.Date(string="Invoice Date")
invoice_number = fields.Char()
invoice_date = fields.Date()
supply_method = fields.Selection(
selection=[("I", "Instant"), ("R", "Repeated")], string="Supply Method"
selection=[("I", "Instant"), ("R", "Repeated")],
)
payment_method = fields.Selection(
selection=[("B", "Bank Transfer"), ("A", "Credit"), ("X", "Other")],
string="Payment Method",
)
country_payment_id = fields.Many2one(
comodel_name="res.country", string="Payment Country"
)
cancellation = fields.Boolean(
string="Cancellation",
help="The Adjustment is intended for cancellation",
)

Expand Down Expand Up @@ -66,7 +64,7 @@ def _prepare_statement_line(self, inv_intra_line, statement_id=None):
return res

def _export_line_checks(self, section_label, section_number):
super(IntrastatStatementSaleSection4, self)._export_line_checks(
res = super(IntrastatStatementSaleSection4, self)._export_line_checks(
section_label, section_number
)
if not self.year_id:
Expand All @@ -81,6 +79,7 @@ def _export_line_checks(self, section_label, section_number):
)
if not self.country_payment_id and not self.cancellation:
raise ValidationError(_("Missing payment country on 'Sales - Section 4'"))
return res

@api.model
def _prepare_export_line(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,13 @@ def _export_line_checks(self, section_label, section_number):
self.ensure_one()
if not self.vat_code and section_number != 4:
raise ValidationError(
_("Missing vat code for %s on '%s - Section %s'")
% (self.partner_id.display_name, section_label, section_number)
_(
"Missing vat code for %(display_name)s on "
"'%(section_label)s - Section %(section_number)s'",
display_name=self.partner_id.display_name,
section_label=section_label,
section_number=section_number,
)
)
country_id = self.country_partner_id or self.partner_id.country_id
if country_id:
Expand Down
8 changes: 4 additions & 4 deletions l10n_it_intrastat_statement/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>ITA - Dichiarazione Intrastat</title>
<style type="text/css">

Expand Down Expand Up @@ -367,7 +367,7 @@ <h1 class="title">ITA - Dichiarazione Intrastat</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_intrastat_statement"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/l10n-italy-14-0/l10n-italy-14-0-l10n_it_intrastat_statement"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/122/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_intrastat_statement"><img alt="OCA/l10n-italy" src="https://img.shields.io/badge/github-OCA%2Fl10n--italy-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/l10n-italy-16-0/l10n-italy-16-0-l10n_it_intrastat_statement"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/webui/builds.html?repo=OCA/l10n-italy&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><strong>Italiano</strong></p>
<p>Questo modulo si occupa di generare la dichiarazione Intrastat e le relative stampe.</p>
<p>Le specifiche per tali stampe e i file da inviare sono in <a class="reference external" href="https://www.adm.gov.it/portale/-/determinazione-n-c2-b0-493869-del-23-dicembre-2021-nuovi-modelli-degli-elenchi-riepilogativi-delle-cessioni-e-degli-acquisti-intracomunitari-di-beni-e-delle-prestazioni-di-servizio-rese-e-ricevute-in-ambito-comunitario-periodi-di-riferimento-decorrenti-da">https://www.adm.gov.it/portale/-/determinazione-n-c2-b0-493869-del-23-dicembre-2021-nuovi-modelli-degli-elenchi-riepilogativi-delle-cessioni-e-degli-acquisti-intracomunitari-di-beni-e-delle-prestazioni-di-servizio-rese-e-ricevute-in-ambito-comunitario-periodi-di-riferimento-decorrenti-da</a>.</p>
Expand Down Expand Up @@ -438,7 +438,7 @@ <h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-italy/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_intrastat_statement%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/l10n-italy/issues/new?body=module:%20l10n_it_intrastat_statement%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -470,7 +470,7 @@ <h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/14.0/l10n_it_intrastat_statement">OCA/l10n-italy</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-italy/tree/16.0/l10n_it_intrastat_statement">OCA/l10n-italy</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
Loading

0 comments on commit 501deea

Please sign in to comment.