-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] l10n_be_intrastat: adapt to new regulation for belgian intrastat
This is essentially a backport of module l10n_be_intrastat_2019 made for Enterprise v12 + the refactoring needed on the original v10 module to allow the changes to apply where needed. Was requested by opw-1887019 closes odoo#30400
- Loading branch information
Showing
8 changed files
with
233 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# -*- coding: utf-8 -*- | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
{ | ||
'name': 'Belgian Intrastat Declaration - Complement for 2019', | ||
'category': 'Accounting', | ||
'description': """ | ||
Adds the possibility to specify the origin country of goods and the partner VAT in the Intrastat XML report. | ||
""", | ||
'depends': ['l10n_be_intrastat'], | ||
'data': [ | ||
'views/account_invoice_line_view.xml', | ||
], | ||
'auto_install': True, | ||
} |
32 changes: 32 additions & 0 deletions
32
addons/l10n_be_intrastat_2019/i18n/l10n_be_intrastat_2019.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * l10n_be_intrastat_2019 | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 10.0+e\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2019-01-21 11:04+0000\n" | ||
"PO-Revision-Date: 2019-01-21 11:04+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: l10n_be_intrastat_2019 | ||
#: model:ir.model,name:l10n_be_intrastat_2019.model_l10n_be_intrastat_xml_xml_decl | ||
msgid "Intrastat XML Declaration" | ||
msgstr "" | ||
|
||
#. module: l10n_be_intrastat_2019 | ||
#: model:ir.model,name:l10n_be_intrastat_2019.model_account_invoice_line | ||
msgid "Invoice Line" | ||
msgstr "" | ||
|
||
#. module: l10n_be_intrastat_2019 | ||
#: model:ir.model.fields,field_description:l10n_be_intrastat_2019.field_account_invoice_line_intrastat_product_origin_country_id | ||
msgid "Origin Country of Product" | ||
msgstr "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import account_intrastat_report | ||
from . import account_invoice_line |
33 changes: 33 additions & 0 deletions
33
addons/l10n_be_intrastat_2019/models/account_intrastat_report.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# -*- coding: utf-8 -*- | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
from odoo import models | ||
from collections import namedtuple | ||
|
||
|
||
class XmlDeclaration(models.TransientModel): | ||
""" | ||
Intrastat XML Declaration | ||
""" | ||
_inherit = "l10n_be_intrastat_xml.xml_decl" | ||
|
||
def _build_intrastat_line(self, numlgn, item, linekey, amounts, dispatchmode, extendedmode): | ||
super(XmlDeclaration, self)._build_intrastat_line(numlgn, item, linekey, amounts, dispatchmode, extendedmode) | ||
if dispatchmode: | ||
self._set_Dim(item, 'EXCNTORI', unicode(linekey.EXCNTORI)) | ||
self._set_Dim(item, 'PARTNERID', unicode(linekey.PARTNERID)) | ||
|
||
def _get_intrastat_linekey(self, declcode, inv_line, dispatchmode, extendedmode): | ||
res = super(XmlDeclaration, self)._get_intrastat_linekey(declcode, inv_line, dispatchmode, extendedmode) | ||
if res and dispatchmode: | ||
res_dict = res._asdict() | ||
res_dict['EXCNTORI'] = inv_line.intrastat_product_origin_country_id.code or 'QU' | ||
res_dict['PARTNERID'] = inv_line.invoice_id.partner_id.vat or 'QV999999999999' | ||
return namedtuple('intrastatkey', res_dict.keys())(**res_dict) | ||
return res | ||
|
||
def _get_expedition_code(self, extended): | ||
return 'INTRASTAT_X_E' if extended else 'INTRASTAT_X_S' | ||
|
||
def _get_expedition_form(self, extended): | ||
return 'INTRASTAT_X_EF' if extended else 'INTRASTAT_X_SF' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- coding: utf-8 -*- | ||
# Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
||
from odoo import api, fields, models | ||
|
||
class AccountInvoiceLine(models.Model): | ||
_inherit = 'account.invoice.line' | ||
|
||
intrastat_product_origin_country_id = fields.Many2one('res.country', string='Origin Country of Product') |
13 changes: 13 additions & 0 deletions
13
addons/l10n_be_intrastat_2019/views/account_invoice_line_view.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="invoice_line_be_intrastat_data_form" model="ir.ui.view"> | ||
<field name="name">account.invoice.form.inherit.account.be.intrastat</field> | ||
<field name="model">account.invoice</field> | ||
<field name="inherit_id" ref="account.invoice_form"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='invoice_line_ids']//field[@name='quantity']" position="before"> | ||
<field name="intrastat_product_origin_country_id" options="{'no_create_edit': True}"/> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |