From ce59f61a020fa165b5a9f045d9ad6dee3d1510cb Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 28 Nov 2014 23:51:23 +0100 Subject: [PATCH 01/48] [ADD] intrastat_product Rename report.intrastat.product to l10n.fr.report.intrastat.product (same for service and for lines) + migration scripts Rename field country_id to origin_country_id (TODO : write mig script) and move this field from l10n_fr_intrastat_product to intrastat_product Move intrastat_code and uom_id of report.intrastat.code from l10n_fr_intrastat_product to intrastat_product, as discussed with Luc de Meyer Use display_name instead of an inherit of name_get (better use of new API) Inherit write and create of intrastat codes to remove spaces (patch by Luc De Meyer from Noviat) Add O2M fields from intrastat code to products and product categs --- intrastat_product/__init__.py | 23 +++ intrastat_product/__openerp__.py | 45 ++++++ intrastat_product/i18n/intrastat_product.pot | 122 ++++++++++++++++ intrastat_product/intrastat.py | 131 ++++++++++++++++++ intrastat_product/intrastat_demo.xml | 88 ++++++++++++ intrastat_product/intrastat_view.xml | 101 ++++++++++++++ .../security/ir.model.access.csv | 3 + 7 files changed, 513 insertions(+) create mode 100644 intrastat_product/__init__.py create mode 100644 intrastat_product/__openerp__.py create mode 100644 intrastat_product/i18n/intrastat_product.pot create mode 100644 intrastat_product/intrastat.py create mode 100644 intrastat_product/intrastat_demo.xml create mode 100644 intrastat_product/intrastat_view.xml create mode 100644 intrastat_product/security/ir.model.access.csv diff --git a/intrastat_product/__init__.py b/intrastat_product/__init__.py new file mode 100644 index 0000000..64a3431 --- /dev/null +++ b/intrastat_product/__init__.py @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Intrastat product module for OpenERP +# Copyright (C) 2011-2014 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from . import intrastat diff --git a/intrastat_product/__openerp__.py b/intrastat_product/__openerp__.py new file mode 100644 index 0000000..6224d37 --- /dev/null +++ b/intrastat_product/__openerp__.py @@ -0,0 +1,45 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Intrastat Product module for Odoo +# Copyright (C) 2011-2015 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +{ + 'name': 'Intrastat Product', + 'version': '1.1', + 'category': 'Localisation/Report Intrastat', + 'license': 'AGPL-3', + 'summary': 'Base module for Intrastat Product', + 'description': """ +This module contains the common objects for the Intrastat Product. +This module is country-independant. + +This module has been written by Alexis de Lattre from Akretion + + """, + 'author': 'Akretion', + 'website': 'http://www.akretion.com', + 'depends': ['intrastat_base'], + 'data': [ + 'intrastat_view.xml', + 'security/ir.model.access.csv', + ], + 'demo': ['intrastat_demo.xml'], + 'installable': True, +} diff --git a/intrastat_product/i18n/intrastat_product.pot b/intrastat_product/i18n/intrastat_product.pot new file mode 100644 index 0000000..15505ac --- /dev/null +++ b/intrastat_product/i18n/intrastat_product.pot @@ -0,0 +1,122 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * intrastat_product +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-11-28 22:48+0000\n" +"PO-Revision-Date: 2014-11-28 22:48+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: intrastat_product +#: help:product.category,intrastat_id:0 +msgid "Code from the Harmonised System. If this code is not set on the product itself, it will be read here, on the related product category." +msgstr "" + +#. module: intrastat_product +#: help:product.template,intrastat_id:0 +msgid "Code from the Harmonised System. Nomenclature is available from the World Customs Organisation, see http://www.wcoomd.org/. Some countries have made their own extensions to this nomenclature." +msgstr "" + +#. module: intrastat_product +#: field:report.intrastat.code,create_uid:0 +msgid "Created by" +msgstr "" + +#. module: intrastat_product +#: field:report.intrastat.code,create_date:0 +msgid "Created on" +msgstr "" + +#. module: intrastat_product +#: field:report.intrastat.code,description:0 +msgid "Description" +msgstr "" + +#. module: intrastat_product +#: help:report.intrastat.code,name:0 +msgid "Full length Harmonized System code (digits only). Full list is available from the World Customs Organisation, see http://www.wcoomd.org" +msgstr "" + +#. module: intrastat_product +#: model:ir.model,name:intrastat_product.model_report_intrastat_code +msgid "H.S. Code" +msgstr "" + +#. module: intrastat_product +#: field:report.intrastat.code,name:0 +msgid "H.S. code" +msgstr "" + +#. module: intrastat_product +#: code:addons/intrastat_product/intrastat.py:56 +#, python-format +msgid "H.S. codes should only contain digits. It is not the case of H.S. code '%s'." +msgstr "" + +#. module: intrastat_product +#: field:report.intrastat.code,id:0 +msgid "ID" +msgstr "" + +#. module: intrastat_product +#: model:ir.actions.act_window,name:intrastat_product.product_intrastat_code_act +#: model:ir.ui.menu,name:intrastat_product.product_intrastat_code_menu +#: field:product.category,intrastat_id:0 +#: field:product.template,intrastat_id:0 +#: view:report.intrastat.code:intrastat_product.product_intrastat_code_form +msgid "Intrastat Code" +msgstr "" + +#. module: intrastat_product +#: view:report.intrastat.code:intrastat_product.product_intrastat_code_tree +msgid "Intrastat Codes" +msgstr "" + +#. module: intrastat_product +#: view:product.category:intrastat_product.product_category_form_view +msgid "Intrastat Properties" +msgstr "" + +#. module: intrastat_product +#: field:report.intrastat.code,write_uid:0 +msgid "Last Updated by" +msgstr "" + +#. module: intrastat_product +#: field:report.intrastat.code,write_date:0 +msgid "Last Updated on" +msgstr "" + +#. module: intrastat_product +#: model:ir.model,name:intrastat_product.model_product_category +msgid "Product Category" +msgstr "" + +#. module: intrastat_product +#: model:ir.model,name:intrastat_product.model_product_template +msgid "Product Template" +msgstr "" + +#. module: intrastat_product +#: view:report.intrastat.code:intrastat_product.product_intrastat_code_search +msgid "Search Intrastat Codes" +msgstr "" + +#. module: intrastat_product +#: help:report.intrastat.code,description:0 +msgid "Short text description of the H.S. category" +msgstr "" + +#. module: intrastat_product +#: sql_constraint:report.intrastat.code:0 +msgid "This H.S. code already exists in Odoo !" +msgstr "" + diff --git a/intrastat_product/intrastat.py b/intrastat_product/intrastat.py new file mode 100644 index 0000000..efbfe37 --- /dev/null +++ b/intrastat_product/intrastat.py @@ -0,0 +1,131 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Intrastat Product module for OpenERP +# Copyright (C) 2004-2009 Tiny SPRL (http://tiny.be) +# Copyright (C) 2010-2014 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models, fields, api, _ +from openerp.exceptions import ValidationError + + +class ReportIntrastatCode(models.Model): + _name = "report.intrastat.code" + _description = "H.S. Code" + _order = "name" + _rec_name = "display_name" + + @api.one + @api.depends('name', 'description') + def _compute_display_name(self): + display_name = self.name or '' + if self.description: + display_name += ' ' + self.description + self.display_name = display_name + + name = fields.Char( + string='H.S. code', + help="Full length Harmonized System code (digits only). Full list is " + "available from the World Customs Organisation, see " + "http://www.wcoomd.org") + description = fields.Char( + 'Description', help="Short text description of the H.S. category") + display_name = fields.Char( + compute='_compute_display_name', string="Display Name", readonly=True) + intrastat_code = fields.Char( + string='European Intrastat Code', size=9, required=True, + help="Code used for the Intrastat declaration. Must be part " + "of the 'Combined Nomenclature' (CN), cf " + "http://en.wikipedia.org/wiki/Combined_Nomenclature" + "Must have 8 digits with sometimes a 9th digit.") + intrastat_uom_id = fields.Many2one( + 'product.uom', string='UoM for Intrastat Report', + help="Select the unit of measure if one is required for " + "this particular Intrastat Code (other than the weight in Kg). " + "If no particular unit of measure is required, leave empty.") + active = fields.Boolean(default=True) + product_categ_ids = fields.One2many( + 'product.category', 'intrastat_id', string='Product Categories') + product_tmpl_ids = fields.One2many( + 'product.template', 'intrastat_id', string='Products') + + @api.constrains('name', 'intrastat_code') + def _hs_code(self): + if self.name and not self.name.isdigit(): + raise ValidationError( + _("H.S. codes should only contain digits. It is not the case " + "of H.S. code '%s'.") % self.name) + if self.intrastat_code and not self.intrastat_code.isdigit(): + raise ValidationError( + _("The field Intrastat Code should only contain digits. " + "It is not the case of Intrastat Code '%s'.") + % self.intrastat_code) + if self.intrastat_code and len(self.intrastat_code) not in (8, 9): + raise ValidationError( + _("The field Intrastat Code should " + "contain 8 or 9 digits. It is not the case of " + "Intrastat Code '%s'.") + % self.intrastat_code) + + _sql_constraints = [( + 'hs_code_uniq', + 'unique(name)', + 'This H.S. code already exists in Odoo !' + )] + + @api.model + @api.returns('self', lambda value: value.id) + def create(self, vals): + if vals.get('intrastat_code'): + vals['intrastat_code'] = vals['intrastat_code'].replace(' ', '') + return super(ReportIntrastatCode, self).create(vals) + + @api.multi + def write(self, vals): + if vals.get('intrastat_code'): + vals['intrastat_code'] = vals['intrastat_code'].replace(' ', '') + return super(ReportIntrastatCode, self).write(vals) + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + intrastat_id = fields.Many2one( + 'report.intrastat.code', string='Intrastat Code', + help="Code from the Harmonised System. Nomenclature is " + "available from the World Customs Organisation, see " + "http://www.wcoomd.org/. Some countries have made their own " + "extensions to this nomenclature.") + origin_country_id = fields.Many2one( + 'res.country', string='Country of Origin', + help="Country of origin of the product i.e. product " + "'made in ____'. If you have different countries of origin " + "depending on the supplier from which you purchased the product, " + "leave this field empty and use the equivalent field on the " + "'product supplier info' form.") + + +class ProductCategory(models.Model): + _inherit = "product.category" + + intrastat_id = fields.Many2one( + 'report.intrastat.code', string='Intrastat Code', + help="Code from the Harmonised System. If this code is not " + "set on the product itself, it will be read here, on the " + "related product category.") diff --git a/intrastat_product/intrastat_demo.xml b/intrastat_product/intrastat_demo.xml new file mode 100644 index 0000000..b5ae41b --- /dev/null +++ b/intrastat_product/intrastat_demo.xml @@ -0,0 +1,88 @@ + + + + + + + + + 84715000 + 84715000 + + Automatic data-processing machines (computers) + + + + 84717050 + 84717050 + + Storage units + + + + 85340090 + 85340090 + Printed circuits + + + + + + 5 + + + + + + 6 + + + + + + 6.5 + + + + + + 0.5 + + + + + + 0.5 + + + + + + 0.5 + + + + + + 0.7 + + + + + + 0.8 + + + + + + 2 + + + + + diff --git a/intrastat_product/intrastat_view.xml b/intrastat_product/intrastat_view.xml new file mode 100644 index 0000000..b62c280 --- /dev/null +++ b/intrastat_product/intrastat_view.xml @@ -0,0 +1,101 @@ + + + + + + + + + + intrastat.product.template.form + product.template + + + + + + + + + + + + intrastat.product.category.form + product.category + + + + + + + + + + + + + intrastat.product.intrastat.code.search + report.intrastat.code + + + + + + + + + + intrastat.product.intrastat.code.tree + report.intrastat.code + + + + + + + + + + + + + fr.intrastat.product.intrastat.code.form + report.intrastat.code + +
+ + + + + + + + + + + + + +
+
+
+ + + + Intrastat Code + report.intrastat.code + tree,form + + + + + +
+
diff --git a/intrastat_product/security/ir.model.access.csv b/intrastat_product/security/ir.model.access.csv new file mode 100644 index 0000000..1708adf --- /dev/null +++ b/intrastat_product/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_report_intrastat_code_sale_manager,Full access on report.intrastat.code to sale manager,model_report_intrastat_code,base.group_sale_manager,1,1,1,1 +access_report_intrastat_code_employee,Read access on report.intrastat.code to employee,model_report_intrastat_code,base.group_user,1,0,0,0 From 36f17b323b61001a3469c2834fd1bdad06d4e376 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Fri, 15 May 2015 11:46:46 +0200 Subject: [PATCH 02/48] display_name must be stored as it is used as _rec_name, otherwise we cant, for instance, import files with name_search --- intrastat_product/intrastat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/intrastat_product/intrastat.py b/intrastat_product/intrastat.py index efbfe37..5242514 100644 --- a/intrastat_product/intrastat.py +++ b/intrastat_product/intrastat.py @@ -47,7 +47,8 @@ class ReportIntrastatCode(models.Model): description = fields.Char( 'Description', help="Short text description of the H.S. category") display_name = fields.Char( - compute='_compute_display_name', string="Display Name", readonly=True) + compute='_compute_display_name', string="Display Name", readonly=True, + store=True) intrastat_code = fields.Char( string='European Intrastat Code', size=9, required=True, help="Code used for the Intrastat declaration. Must be part " From 626c9a54b3bdb86d5d96cf30eb71284709e54671 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 27 May 2015 21:32:43 +0200 Subject: [PATCH 03/48] [IMP] intrastat_product: Several things: * Update README.rst and translation files * Add index=True on some fields on which we often search, as suggested by Yannick * Remove description in __openerp__.py * Move ACL from l10n_fr_intrastat_product module to intrastat_product module * Large code re-engineering following the Akretion-Noviat code sprint on intrastat This code has been written both by Luc de Meyer and myself. * Add first draft of code to generate decl lines --- intrastat_product/README.rst | 41 + intrastat_product/__init__.py | 24 +- intrastat_product/__openerp__.py | 30 +- intrastat_product/account_invoice.py | 88 +++ intrastat_product/account_invoice_view.xml | 44 ++ .../data/intrastat_transport_mode.xml | 53 ++ intrastat_product/data/intrastat_unit.xml | 125 +++ intrastat_product/i18n/intrastat_product.pot | 70 +- intrastat_product/intrastat.py | 182 +++-- intrastat_product/intrastat_declaration.py | 724 ++++++++++++++++++ .../intrastat_declaration_view.xml | 177 +++++ intrastat_product/intrastat_demo.xml | 77 +- intrastat_product/intrastat_view.xml | 266 +++++-- intrastat_product/res_company.py | 67 ++ intrastat_product/res_company_view.xml | 21 + .../security/intrastat_security.xml | 12 + .../security/ir.model.access.csv | 11 +- intrastat_product/stock.py | 40 + intrastat_product/stock_view.xml | 28 + 19 files changed, 1793 insertions(+), 287 deletions(-) create mode 100644 intrastat_product/README.rst create mode 100644 intrastat_product/account_invoice.py create mode 100644 intrastat_product/account_invoice_view.xml create mode 100644 intrastat_product/data/intrastat_transport_mode.xml create mode 100644 intrastat_product/data/intrastat_unit.xml create mode 100644 intrastat_product/intrastat_declaration.py create mode 100644 intrastat_product/intrastat_declaration_view.xml create mode 100644 intrastat_product/res_company.py create mode 100644 intrastat_product/res_company_view.xml create mode 100644 intrastat_product/security/intrastat_security.xml create mode 100644 intrastat_product/stock.py create mode 100644 intrastat_product/stock_view.xml diff --git a/intrastat_product/README.rst b/intrastat_product/README.rst new file mode 100644 index 0000000..455c358 --- /dev/null +++ b/intrastat_product/README.rst @@ -0,0 +1,41 @@ +Intrastat Product Module +======================== + +This module contains common objects and fields for the Intrastat Product reporting, such as the *H.S. codes* (if you are not familiar with H.S. codes, read `Wikipedia `) and the *country of origin* on the products. + +It should be used in combination with country-specific Intrastat Product reporting modules +such as: + +- *l10n_fr_intrastat_product*: + the module for the *Déclaration d'Echange de Biens* (DEB) for France + +These country-specific modules can be found in the OCA localization for those countries. + +Installation +============ + +WARNING: +This module conflicts with the module *report_intrastat* from the official addons. +If you have already installed the module *report_intrastat*, +you should uninstall it before installing this module. + +Credits +======= + +Contributors +------------ + +* Alexis de Lattre, Akretion + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://odoo-community.org + +This module is maintained by the OCA. + +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. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/intrastat_product/__init__.py b/intrastat_product/__init__.py index 64a3431..063edb0 100644 --- a/intrastat_product/__init__.py +++ b/intrastat_product/__init__.py @@ -1,23 +1,7 @@ # -*- encoding: utf-8 -*- -############################################################################## -# -# Intrastat product module for OpenERP -# Copyright (C) 2011-2014 Akretion (http://www.akretion.com) -# @author Alexis de Lattre -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +from . import res_company from . import intrastat +from . import intrastat_declaration +from . import stock +from . import account_invoice diff --git a/intrastat_product/__openerp__.py b/intrastat_product/__openerp__.py index 6224d37..7a593e8 100644 --- a/intrastat_product/__openerp__.py +++ b/intrastat_product/__openerp__.py @@ -3,7 +3,9 @@ # # Intrastat Product module for Odoo # Copyright (C) 2011-2015 Akretion (http://www.akretion.com) +# Copyright (C) 2015 Noviat (http://www.noviat.com) # @author Alexis de Lattre +# @author Luc de Meyer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -22,23 +24,27 @@ { 'name': 'Intrastat Product', - 'version': '1.1', - 'category': 'Localisation/Report Intrastat', + 'version': '1.3', + 'category': 'Intrastat', 'license': 'AGPL-3', 'summary': 'Base module for Intrastat Product', - 'description': """ -This module contains the common objects for the Intrastat Product. -This module is country-independant. - -This module has been written by Alexis de Lattre from Akretion - - """, - 'author': 'Akretion', - 'website': 'http://www.akretion.com', - 'depends': ['intrastat_base'], + 'author': 'Akretion, Noviat, Odoo Community Association (OCA)', + 'depends': [ + 'intrastat_base', + 'product_harmonized_system', + 'stock', + ], + 'conflicts': ['report_intrastat'], 'data': [ 'intrastat_view.xml', + 'intrastat_declaration_view.xml', + 'res_company_view.xml', + 'account_invoice_view.xml', + 'stock_view.xml', + 'security/intrastat_security.xml', 'security/ir.model.access.csv', + 'data/intrastat_transport_mode.xml', + 'data/intrastat_unit.xml', ], 'demo': ['intrastat_demo.xml'], 'installable': True, diff --git a/intrastat_product/account_invoice.py b/intrastat_product/account_invoice.py new file mode 100644 index 0000000..3179012 --- /dev/null +++ b/intrastat_product/account_invoice.py @@ -0,0 +1,88 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2012-2015 Noviat nv/sa (www.noviat.com) +# Copyright (C) 2015 Akretion (http://www.akretion.com) +# @author Luc de Meyer +# @author Alexis de Lattre +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models, fields, api + + +class AccountInvoice(models.Model): + _inherit = 'account.invoice' + + @api.model + def _default_intrastat_transaction(self): + """ placeholder for localisation modules """ + return self.env['intrastat.transaction'].browse([]) + + intrastat_transaction_id = fields.Many2one( + 'intrastat.transaction', string='Intrastat Transaction Type', + default=_default_intrastat_transaction, ondelete='restrict', + help="Intrastat nature of transaction") + intrastat_transport_id = fields.Many2one( + 'intrastat.transport_mode', string='Intrastat Transport Mode', + ondelete='restrict') + src_dest_country_id = fields.Many2one( + 'res.country', string='Origin/Destination Country', + ondelete='restrict') + intrastat_country = fields.Boolean( + related='src_dest_country_id.intrastat', + store=True, string='Intrastat Country', readonly=True) + intrastat = fields.Char( + string='Intrastat Declaration', + related='company_id.intrastat', store=True, readonly=True) + + @api.multi + def onchange_partner_id( + self, type, partner_id, date_invoice=False, + payment_term=False, partner_bank_id=False, company_id=False): + res = super(AccountInvoice, self).onchange_partner_id( + type, partner_id, date_invoice=date_invoice, + payment_term=payment_term, partner_bank_id=partner_bank_id, + company_id=company_id) + if partner_id: + partner = self.env['res.partner'].browse(partner_id) + res['value']['src_dest_country_id'] = partner.country_id.id + return res + + +class AccountInvoiceLine(models.Model): + _inherit = 'account.invoice.line' + + hs_code_id = fields.Many2one( + 'hs.code', string='Intrastat Code', ondelete='restrict') + + @api.multi + def product_id_change( + self, product, uom_id, qty=0, name='', type='out_invoice', + partner_id=False, fposition_id=False, price_unit=False, + currency_id=False, company_id=None): + res = super(AccountInvoiceLine, self).product_id_change( + product, uom_id, qty=qty, name=name, type=type, + partner_id=partner_id, fposition_id=fposition_id, + price_unit=price_unit, currency_id=currency_id, + company_id=company_id) + + if product: + product = self.env['product.product'].browse(product) + hs_code = product.get_hs_code_recursively() + if hs_code: + res['value']['hs_code_id'] = hs_code.id + return res diff --git a/intrastat_product/account_invoice_view.xml b/intrastat_product/account_invoice_view.xml new file mode 100644 index 0000000..cccb557 --- /dev/null +++ b/intrastat_product/account_invoice_view.xml @@ -0,0 +1,44 @@ + + + + + + intrastat.invoice.form + account.invoice + + + + + + + + + + + + + + + + intrastat.invoice.supplier.form + account.invoice + + + + + + + + + + + + + + + + diff --git a/intrastat_product/data/intrastat_transport_mode.xml b/intrastat_product/data/intrastat_transport_mode.xml new file mode 100644 index 0000000..4b4d245 --- /dev/null +++ b/intrastat_product/data/intrastat_transport_mode.xml @@ -0,0 +1,53 @@ + + + + + + 1 + Sea + Sea Transport (including wagons, motor vehicles, trailers, semi-trailers and lighters on board of a ship) + + + 2 + Rail + Railway transport (including lorries on railway wagons) + + + 3 + Road + Road Transport + + + 4 + Air + Air Transport + + + 5 + Post + Postal consignments + + + 7 + Fixed installations + Fixed transport installations (e.g. pipelines, high-tension cables) + + + + 8 + Inland waterway + Inland waterway transport + + + 9 + Own propulsion + Own propulsion (imported or exported means of transport crossing the border under their own power, e.g. aircraft, lorries, boats, etc.) + + + + + + + + + diff --git a/intrastat_product/data/intrastat_unit.xml b/intrastat_product/data/intrastat_unit.xml new file mode 100644 index 0000000..a6fbaff --- /dev/null +++ b/intrastat_product/data/intrastat_unit.xml @@ -0,0 +1,125 @@ + + + + + + + + c/k + Carats - 1 metric carat = 2 × 10exp(–4) kg + + + ce/el + Number of cells + + + ct/l + Carrying capacity in tonnes + + + g + Gram + + + + gi F/S + Gram of fissile isotopes + + + kg H2O2 + Kilogram of hydrogen peroxide + + + kg K2O + Kilogram of potassium oxide + + + kg KOH + Kilogram of potassium hydroxide (caustic potash) + + + kg met.am. + Kilogram of methylamines + + + kg N + Kilogram of nitrogen + + + kg NaOH + Kilogram of sodium hydroxide (caustic soda) + + + kg/net eda + Kilogram drained net weight + + + kg P2O5 + Kilogram of diphosphorus pentaoxide + + + kg 90 pct sdt + Kilogram of substance 90 % dry + + + kg U + Kilogram of uranium + + + 1000 kWh + Thousand kilowatt hours + + + l + Litre + + + + 1000 l + Thousand litres + + + l alc. 100 pct + Litre pure (100 %) alcohol + + + m + Metre + + + + m2 + Square metre + + + m3 + Cubic metre + + + 1000 m3 + Thousand cubic metres + + + pa + Number of pairs + + + items + Number of items + + + + 100 items + Hundred items + + + 1000 items + Thousand items + + + TJ + Terajoule (gross calorific value) + + + + diff --git a/intrastat_product/i18n/intrastat_product.pot b/intrastat_product/i18n/intrastat_product.pot index 15505ac..6b1f00f 100644 --- a/intrastat_product/i18n/intrastat_product.pot +++ b/intrastat_product/i18n/intrastat_product.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-11-28 22:48+0000\n" -"PO-Revision-Date: 2014-11-28 22:48+0000\n" +"POT-Creation-Date: 2015-05-27 18:43+0000\n" +"PO-Revision-Date: 2015-05-27 18:43+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -15,6 +15,11 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: \n" +#. module: intrastat_product +#: field:report.intrastat.code,active:0 +msgid "Active" +msgstr "" + #. module: intrastat_product #: help:product.category,intrastat_id:0 msgid "Code from the Harmonised System. If this code is not set on the product itself, it will be read here, on the related product category." @@ -25,6 +30,21 @@ msgstr "" msgid "Code from the Harmonised System. Nomenclature is available from the World Customs Organisation, see http://www.wcoomd.org/. Some countries have made their own extensions to this nomenclature." msgstr "" +#. module: intrastat_product +#: help:report.intrastat.code,intrastat_code:0 +msgid "Code used for the Intrastat declaration. Must be part of the 'Combined Nomenclature' (CN), cf http://en.wikipedia.org/wiki/Combined_NomenclatureMust have 8 digits with sometimes a 9th digit." +msgstr "" + +#. module: intrastat_product +#: field:product.template,origin_country_id:0 +msgid "Country of Origin" +msgstr "" + +#. module: intrastat_product +#: help:product.template,origin_country_id:0 +msgid "Country of origin of the product i.e. product 'made in ____'. If you have different countries of origin depending on the supplier from which you purchased the product, leave this field empty and use the equivalent field on the 'product supplier info' form." +msgstr "" + #. module: intrastat_product #: field:report.intrastat.code,create_uid:0 msgid "Created by" @@ -40,6 +60,16 @@ msgstr "" msgid "Description" msgstr "" +#. module: intrastat_product +#: field:report.intrastat.code,display_name:0 +msgid "Display Name" +msgstr "" + +#. module: intrastat_product +#: field:report.intrastat.code,intrastat_code:0 +msgid "European Intrastat Code" +msgstr "" + #. module: intrastat_product #: help:report.intrastat.code,name:0 msgid "Full length Harmonized System code (digits only). Full list is available from the World Customs Organisation, see http://www.wcoomd.org" @@ -56,7 +86,7 @@ msgid "H.S. code" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/intrastat.py:56 +#: code:addons/intrastat_product/intrastat.py:73 #, python-format msgid "H.S. codes should only contain digits. It is not the case of H.S. code '%s'." msgstr "" @@ -95,6 +125,12 @@ msgstr "" msgid "Last Updated on" msgstr "" +#. module: intrastat_product +#: view:report.intrastat.code:intrastat_product.product_intrastat_code_form +#: field:report.intrastat.code,product_categ_ids:0 +msgid "Product Categories" +msgstr "" + #. module: intrastat_product #: model:ir.model,name:intrastat_product.model_product_category msgid "Product Category" @@ -105,18 +141,46 @@ msgstr "" msgid "Product Template" msgstr "" +#. module: intrastat_product +#: view:report.intrastat.code:intrastat_product.product_intrastat_code_form +#: field:report.intrastat.code,product_tmpl_ids:0 +msgid "Products" +msgstr "" + #. module: intrastat_product #: view:report.intrastat.code:intrastat_product.product_intrastat_code_search msgid "Search Intrastat Codes" msgstr "" +#. module: intrastat_product +#: help:report.intrastat.code,intrastat_uom_id:0 +msgid "Select the unit of measure if one is required for this particular Intrastat Code (other than the weight in Kg). If no particular unit of measure is required, leave empty." +msgstr "" + #. module: intrastat_product #: help:report.intrastat.code,description:0 msgid "Short text description of the H.S. category" msgstr "" +#. module: intrastat_product +#: code:addons/intrastat_product/intrastat.py:82 +#, python-format +msgid "The field Intrastat Code should contain 8 or 9 digits. It is not the case of Intrastat Code '%s'." +msgstr "" + +#. module: intrastat_product +#: code:addons/intrastat_product/intrastat.py:77 +#, python-format +msgid "The field Intrastat Code should only contain digits. It is not the case of Intrastat Code '%s'." +msgstr "" + #. module: intrastat_product #: sql_constraint:report.intrastat.code:0 msgid "This H.S. code already exists in Odoo !" msgstr "" +#. module: intrastat_product +#: field:report.intrastat.code,intrastat_uom_id:0 +msgid "UoM for Intrastat Report" +msgstr "" + diff --git a/intrastat_product/intrastat.py b/intrastat_product/intrastat.py index 5242514..b87953a 100644 --- a/intrastat_product/intrastat.py +++ b/intrastat_product/intrastat.py @@ -1,10 +1,11 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# Intrastat Product module for OpenERP -# Copyright (C) 2004-2009 Tiny SPRL (http://tiny.be) -# Copyright (C) 2010-2014 Akretion (http://www.akretion.com) +# Intrastat Product module for Odoo +# Copyright (C) 2011-2015 Akretion (http://www.akretion.com) +# Copyright (C) 2015 Noviat (http://www.noviat.com) # @author Alexis de Lattre +# @author Luc de Meyer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -25,108 +26,97 @@ from openerp import models, fields, api, _ from openerp.exceptions import ValidationError -class ReportIntrastatCode(models.Model): - _name = "report.intrastat.code" - _description = "H.S. Code" - _order = "name" - _rec_name = "display_name" - - @api.one - @api.depends('name', 'description') - def _compute_display_name(self): - display_name = self.name or '' - if self.description: - display_name += ' ' + self.description - self.display_name = display_name +class IntrastatUnit(models.Model): + _name = 'intrastat.unit' + _description = 'Intrastat Supplementary Units' name = fields.Char( - string='H.S. code', - help="Full length Harmonized System code (digits only). Full list is " - "available from the World Customs Organisation, see " - "http://www.wcoomd.org") + string='Name', required=True) description = fields.Char( - 'Description', help="Short text description of the H.S. category") - display_name = fields.Char( - compute='_compute_display_name', string="Display Name", readonly=True, - store=True) - intrastat_code = fields.Char( - string='European Intrastat Code', size=9, required=True, - help="Code used for the Intrastat declaration. Must be part " - "of the 'Combined Nomenclature' (CN), cf " - "http://en.wikipedia.org/wiki/Combined_Nomenclature" - "Must have 8 digits with sometimes a 9th digit.") - intrastat_uom_id = fields.Many2one( - 'product.uom', string='UoM for Intrastat Report', - help="Select the unit of measure if one is required for " - "this particular Intrastat Code (other than the weight in Kg). " - "If no particular unit of measure is required, leave empty.") - active = fields.Boolean(default=True) - product_categ_ids = fields.One2many( - 'product.category', 'intrastat_id', string='Product Categories') - product_tmpl_ids = fields.One2many( - 'product.template', 'intrastat_id', string='Products') + string='Description', required=True) + uom_id = fields.Many2one( + 'product.uom', string='Regular UoM', + help="Select the regular Unit of Measure of Odoo that corresponds " + "to this Intrastat Supplementary Unit.") + active = fields.Boolean( + string='Active', default=True) - @api.constrains('name', 'intrastat_code') + +class HSCode(models.Model): + _inherit = "hs.code" + + intrastat_unit_id = fields.Many2one( + 'intrastat.unit', string='Intrastat Supplementary Unit') + + @api.constrains('local_code') def _hs_code(self): - if self.name and not self.name.isdigit(): - raise ValidationError( - _("H.S. codes should only contain digits. It is not the case " - "of H.S. code '%s'.") % self.name) - if self.intrastat_code and not self.intrastat_code.isdigit(): - raise ValidationError( - _("The field Intrastat Code should only contain digits. " - "It is not the case of Intrastat Code '%s'.") - % self.intrastat_code) - if self.intrastat_code and len(self.intrastat_code) not in (8, 9): - raise ValidationError( - _("The field Intrastat Code should " - "contain 8 or 9 digits. It is not the case of " - "Intrastat Code '%s'.") - % self.intrastat_code) + if self.company_id.country_id.intrastat: + if not self.local_code.isdigit(): + raise ValidationError( + _("Intrastat Codes should only contain digits. " + "This is not the case for code '%s'.") + % self.local_code) + if len(self.local_code) != 8: + raise ValidationError( + _("Intrastat Codes should " + "contain 8 digits. This is not the case for " + "Intrastat Code '%s' which has %d digits.") + % (self.local_code, len(self.local_code))) + + +class IntrastatTransaction(models.Model): + _name = 'intrastat.transaction' + _description = "Intrastat Transaction" + _order = 'code' + _rec_name = 'display_name' + + @api.one + @api.depends('code', 'description') + def _compute_display_name(self): + display_name = self.code + if self.description: + display_name += ' ' + self.description + self.display_name = len(display_name) > 55 \ + and display_name[:55] + '...' \ + or display_name + + code = fields.Char(string='Code', required=True) + description = fields.Text(string='Description') + display_name = fields.Char( + compute='_compute_display_name', string="Display Name", readonly=True) + company_id = fields.Many2one( + 'res.company', string='Company', + default=lambda self: self.env['res.company']._company_default_get( + 'intrastat.transaction')) _sql_constraints = [( - 'hs_code_uniq', - 'unique(name)', - 'This H.S. code already exists in Odoo !' - )] - - @api.model - @api.returns('self', lambda value: value.id) - def create(self, vals): - if vals.get('intrastat_code'): - vals['intrastat_code'] = vals['intrastat_code'].replace(' ', '') - return super(ReportIntrastatCode, self).create(vals) - - @api.multi - def write(self, vals): - if vals.get('intrastat_code'): - vals['intrastat_code'] = vals['intrastat_code'].replace(' ', '') - return super(ReportIntrastatCode, self).write(vals) + 'intrastat_transaction_code_unique', + 'UNIQUE(code, company_id)', + 'Code must be unique.')] -class ProductTemplate(models.Model): - _inherit = "product.template" +class IntrastatTransportMode(models.Model): + _name = 'intrastat.transport_mode' + _description = "Intrastat Transport Mode" + _rec_name = 'display_name' + _order = 'code' - intrastat_id = fields.Many2one( - 'report.intrastat.code', string='Intrastat Code', - help="Code from the Harmonised System. Nomenclature is " - "available from the World Customs Organisation, see " - "http://www.wcoomd.org/. Some countries have made their own " - "extensions to this nomenclature.") - origin_country_id = fields.Many2one( - 'res.country', string='Country of Origin', - help="Country of origin of the product i.e. product " - "'made in ____'. If you have different countries of origin " - "depending on the supplier from which you purchased the product, " - "leave this field empty and use the equivalent field on the " - "'product supplier info' form.") + @api.one + @api.depends('name', 'code') + def _display_name(self): + print "display_name self=", self + print "self.code=", self.code + print "self.name=", self.name + self.display_name = '%s. %s' % (self.code, self.name) + display_name = fields.Char( + string='Display Name', compute='_display_name', store=True, + readonly=True) + code = fields.Char(string='Code', required=True) + name = fields.Char(string='Name', required=True, translate=True) + description = fields.Char(string='Description', translate=True) -class ProductCategory(models.Model): - _inherit = "product.category" - - intrastat_id = fields.Many2one( - 'report.intrastat.code', string='Intrastat Code', - help="Code from the Harmonised System. If this code is not " - "set on the product itself, it will be read here, on the " - "related product category.") + _sql_constraints = [( + 'intrastat_transport_code_unique', + 'UNIQUE(code)', + 'Code must be unique.')] diff --git a/intrastat_product/intrastat_declaration.py b/intrastat_product/intrastat_declaration.py new file mode 100644 index 0000000..9f4f731 --- /dev/null +++ b/intrastat_product/intrastat_declaration.py @@ -0,0 +1,724 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Intrastat Product module for Odoo +# Copyright (C) 2011-2015 Akretion (http://www.akretion.com) +# Copyright (C) 2011-2015 Noviat (http://www.noviat.com) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models, fields, api, _ +from openerp.exceptions import Warning, RedirectWarning, ValidationError +import openerp.addons.decimal_precision as dp +from datetime import datetime, date +from dateutil.relativedelta import relativedelta +import logging + +_logger = logging.getLogger(__name__) + + +class IntrastatProductDeclaration(models.Model): + _name = 'intrastat.product.declaration' + _description = "Intrastat Product Report Base Object" + _rec_name = 'year_month' + _inherit = ['mail.thread', 'intrastat.common'] + _order = 'year_month desc, type, revision' + _track = { + 'state': { + 'intrastat_product.declaration_done': + lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done', + } + } + + @api.model + def _get_type(self): + res = [] + company = self.env.user.company_id + arrivals = company.intrastat_arrivals + dispatches = company.intrastat_dispatches + if arrivals != 'exempt': + res.append(('arrivals', _('Declaration for Arrivals'))) + if dispatches != 'exempt': + res.append(('dispatches', _('Declaration for Dispatches'))) + return res + + @api.model + def _get_reporting_level(self): + return [ + ('standard', _('Standard')), + ('extended', _('Extended'))] + + @api.onchange('type') + def _onchange_type(self): + if self.type == 'arrivals': + self.reporting_level = \ + self.company_id.intrastat_arrivals == 'extended' \ + and 'extended' or 'standard' + if self.type == 'dispatches': + self.reporting_level = \ + self.company_id.intrastat_dispatches == 'extended' \ + and 'extended' or 'standard' + + @api.model + def _get_company(self): + return self.env.user.company_id + + @api.model + def _get_year(self): + if datetime.now().month == 1: + return datetime.now().year - 1 + else: + return datetime.now().year + + @api.model + def _get_month(self): + if datetime.now().month == 1: + return 12 + else: + return datetime.now().month - 1 + + @api.model + def _get_action(self): + return [ + ('replace', 'Replace'), + ('append', 'Append'), + ('nihil', 'Nihil')] + + @api.model + def _get_default_action(self): + return 'replace' + + company_id = fields.Many2one( + 'res.company', string='Company', readonly=True, + default=lambda self: self.env['res.company']._company_default_get( + 'intrastat.product.declaration')) + year = fields.Integer( + string='Year', required=True, + default=_get_year) + month = fields.Selection([ + (1, '01'), + (2, '02'), + (3, '03'), + (4, '04'), + (5, '05'), + (6, '06'), + (7, '07'), + (8, '08'), + (9, '09'), + (10, '10'), + (11, '11'), + (12, '12') + ], string='Month', required=True, + default=_get_month) + year_month = fields.Char( + compute='_compute_year_month', string='Month', readonly=True, + track_visibility='always', store=True, + help="Year and month of the declaration.") + type = fields.Selection( + '_get_type', string='Type', required=True, + states={'done': [('readonly', True)]}, + track_visibility='always', help="Select the declaration type.") + action = fields.Selection( + '_get_action', + string='Action', required=True, + default=_get_default_action, + states={'done': [('readonly', True)]}, + track_visibility='onchange') + revision = fields.Integer( + string='Revision', default=1, + states={'done': [('readonly', True)]}, + help="Used to keep track of changes") + computation_line_ids = fields.One2many( + 'intrastat.product.computation.line', + 'parent_id', string='Intrastat Product Computation Lines', + states={'done': [('readonly', True)]}) + declaration_line_ids = fields.One2many( + 'intrastat.product.declaration.line', + 'parent_id', string='Intrastat Product Declaration Lines', + states={'done': [('readonly', True)]}) + num_decl_lines = fields.Integer( + compute='_compute_numbers', string='Number of Declaration Lines', + store=True, track_visibility='onchange') + total_amount = fields.Float( + compute='_compute_numbers', digits=dp.get_precision('Account'), + string='Total Amount', store=True, + help="Total amount in company currency of the declaration.") + currency_id = fields.Many2one( + 'res.currency', related='company_id.currency_id', readonly=True, + string='Currency') + state = fields.Selection([ + ('draft', 'Draft'), + ('done', 'Done'), + ], string='State', readonly=True, track_visibility='onchange', + copy=False, default='draft', + help="State of the declaration. When the state is set to 'Done', " + "the parameters become read-only.") + note = fields.Text( + string='Notes', + help="You can add some comments here if you want.") + reporting_level = fields.Selection( + '_get_reporting_level', + string='Reporting Level') + valid = fields.Boolean( + compute='_check_validity', + string='Valid') + + @api.one + @api.constrains('year') + def _check_year(self): + s = str(self.year) + if len(s) != 4 or s[0] != '2': + raise ValidationError( + _("Invalid Year !")) + + _sql_constraints = [ + ('date_uniq', + 'unique(year_month, company_id, type)', + "A declaration of the same type already exists for this month !" + "\nYou should update the existing declaration " + "or change the revision number of this one."), + ] + + @api.one + @api.depends('year', 'month') + def _compute_year_month(self): + if self.year and self.month: + self.year_month = '-'.join( + [str(self.year), format(self.month, '02')]) + + @api.one + @api.depends('month') + def _check_validity(self): + """ TO DO: logic based upon computation lines """ + self.valid = True + + @api.one + @api.returns('self', lambda value: value.id) + def copy(self, default=None): + default = default or {} + default['revision'] = self.revision + 1 + return super(IntrastatProductDeclaration, self).copy(default) + + def _company_warning(self, msg): + action = self.env.ref('base.action_res_company_form') + raise RedirectWarning( + msg, action.id, + _('Go to company configuration screen')) + + def _get_partner_country(self, inv_line): + country = inv_line.invoice_id.intrastat_country_id \ + or inv_line.invoice_id.partner_id.country_id + if not country.intrastat: + country = False + elif country == self.company_id.country_id: + country = False + return country + + def _get_intrastat_transaction(self, inv_line): + if inv_line.invoice_id.intrastat_transaction_id: + tr = inv_line.invoice_id.intrastat_transaction_id.code + else: + tr = self.env.ref( + 'l10n_be_intrastat_advanced.intrastat_transaction_1') + return tr + + def _get_region(self, inv_line): + """ + Logic copied from standard addons, l10n_be_intrastat module: + If purchase, comes from purchase order, linked to a location, + which is linked to the warehouse. + + If sales, the sale order is linked to the warehouse. + If sales, from a delivery order, linked to a location, + which is linked to the warehouse. + If none found, get the company one. + """ + region = False + if inv_line.invoice_id.type in ('in_invoice', 'in_refund'): + po_lines = self.env['purchase.order.line'].search( + [('invoice_lines', 'in', inv_line.id)]) + if po_lines: + po = po_lines.order_id + region = self.env['stock.warehouse'].get_region_from_location( + po.location_id) + elif inv_line.invoice_id.type in ('out_invoice', 'out_refund'): + so_lines = self.env['sale.order.line'].search( + [('invoice_lines', 'in', inv_line.id)]) + if so_lines: + so = so_lines.order_id + region = so.warehouse_id.region_id + if not region: + if self.company_id.intrastat_region_id: + region = self.company_id.intrastat_region_id + else: + msg = _( + "The Intrastat Region of the Company is not set, " + "please configure it first.") + self._company_warning(msg) + return region + + def _get_weight_and_supplunits(self, inv_line): + line_qty = inv_line.quantity + product = inv_line.product_id + invoice = inv_line.invoice_id + intrastat_unit_id = inv_line.intrastat_id.intrastat_unit_id + source_uom = inv_line.uos_id + weight_uom_categ = self._uom_refs['weight_uom_categ'] + kg_uom = self._uom_refs['kg_uom'] + pce_uom_categ = self._uom_refs['pce_uom_categ'] + pce_uom = self._uom_refs['pce_uom'] + weight = suppl_unit_qty = 0.0 + + if not source_uom: + note = "\n" + _( + "Missing unit of measure on the line with %d " + "product(s) '%s' on invoice '%s'." + ) % (line_qty, product.name, invoice.number) + note += "\n" + _( + "Please adjust this line manually.") + self._note += note + return weight, suppl_unit_qty + + if intrastat_unit_id: + target_uom = intrastat_unit_id.uom_id + if not target_uom: + note = "\n" + _( + "Conversion from Intrastat Supplementary Unit '%s' to " + "Unit of Measure is not implemented yet." + ) % intrastat_unit_id.name + note += "\n" + _( + "Please correct the Intrastat Supplementary Unit " + "settingsand regenerate the lines or adjust the lines " + "with Intrastat Code '%s' manually" + ) % intrastat_code + self._note += note + return weight, suppl_unit_qty + if target_uom.categ_id == source_uom.category_id: + suppl_unit_qty = self.env['product.uom']._compute_qty_obj( + source_uom, line_qty, target_uom) + else: + note = "\n" + _( + "Conversion from unit of measure '%s' to '%s' " + "is not implemented yet." + ) % (source_uom.name, target_uom.name) + note += "\n" + _( + "Please correct the unit of measure settings and " + "regenerate the lines or adjust the impacted " + "lines manually") + self._note += note + return weight, suppl_unit_qty + + else: + if source_uom == kg_uom: + weight = line_qty + elif source_uom.category_id == weight_uom_categ: + weight = self.env['product.uom']._compute_qty_obj( + source_uom, line_qty, kg_uom) + elif source_uom.category_id == pce_uom_categ: + if not product.weight_net: + note = "\n" + _( + "Missing net weight on product '%s'." + ) % product.name + note += "\n" + _( + "Please correct the product record and regenerate " + "the lines or adjust the impacted lines manually") + self._note += note + return weight, suppl_unit_qty + if source_uom == pce_uom: + weight = product.weight_net * line_qty + else: + # Here, I suppose that, on the product, the + # weight is per PCE and not per uom_id + weight = product.weight_net * \ + self.env['product.uom']._compute_qty_obj( + source_uom, line_qty, pce_uom) + else: + note = "\n" + _( + "Conversion from unit of measure '%s' to 'Kg' " + "is not implemented yet." + ) % source_uom.name + note += "\n" + _( + "Please correct the unit of measure settings and " + "regenerate the lines or adjust the impacted lines " + "manually") + self._note += note + return weight, suppl_unit_qty + + return weight, suppl_unit_qty + + def _get_amount(self, inv_line): + invoice = inv_line.invoice_id + amount = inv_line.price_subtotal + if invoice.currency_id.name != 'EUR': + amount = self.env['res.currency'].with_context( + date=invoice.date_invoice).compute( + invoice.currency_id, + self.company_id.currency_id, + amount) + return amount + + def _get_transport(self, inv_line): + transport = inv_line.invoice.transport_mode_id \ + or self.company_id.intrastat_transport_id + if not transport: + msg = _( + "The default Intrastat Transport Mode " + "of the Company is not set, " + "please configure it first.") + self._company_warning(msg) + return transport + + def _get_incoterm(self, inv_line): + incoterm = inv_line.invoice.incoterm_id \ + or self.company_id.incoterm_id + if not incoterm: + msg = _( + "The default Incoterm " + "of the Company is not set, " + "please configure it first.") + self._company_warning(msg) + return incoterm + + def _gather_invoices(self): + + decl_lines = [] + start_date = date(self.year, self.month, 1) + end_date = start_date + relativedelta(day=1, months=+1, days=-1) + + invoices = self.env['account.invoice'].search([ + ('date_invoice', '>=', start_date), + ('date_invoice', '<=', end_date), + ('state', 'in', ['open', 'paid']), + ('intrastat_country', '=', True), + ('company_id', '=', self.company_id.id)]) + + for invoice in invoices: + + if self.type == 'arrivals': + if invoice.type in ['out_invoice', 'in_refund']: + continue + else: + if invoice.type in ['in_invoice', 'out_refund']: + continue + + for inv_line in invoice.invoice_line: + + intrastat = inv_line.intrastat_id + if not intrastat: + continue + if not inv_line.quantity: + continue + + partner_country = self._get_partner_country(inv_line) + if not partner_country: + continue + + intrastat_transaction = \ + self._get_intrastat_transaction(inv_line) + + region = self._get_region(inv_line) + + weight, suppl_unit_qty = self._get_weight_and_supplunits( + inv_line) + + amount_company_currency = self._get_amount(inv_line) + + line_vals = { + 'parent_id': self.id, + 'invoice_line_id': inv_line.id, + 'partner_country_id': partner_country.id, + 'product_id': inv_line.product_id.id, + 'intrastat_code_id': intrastat.id, + 'weight': weight, + 'suppl_unit_qty': suppl_unit_qty, + 'amount_company_currency': amount_company_currency, + 'transaction_id': intrastat_transaction.id, + 'region_id': region.id, + 'extended': self._extended, + } + + # extended declaration + if self._extended: + transport = self._get_transport(inv_line) + incoterm = self._get_incoterm(inv_line) + line_vals.update({ + 'transport_id': transport.id, + 'incoterm_id': incoterm.id, + }) + + decl_lines.append((0, 0, line_vals)) + + return decl_lines + + @api.multi + def action_gather(self): + self.ensure_one() + self._note = '' + self._uom_refs = { + 'weight_uom_categ': self.env.ref('product.product_uom_categ_kgm'), + 'kg_uom': self.env.ref('product.product_uom_kgm'), + 'pce_uom_categ': self.env.ref('product.product_uom_categ_unit'), + 'pce_uom': self.env.ref('product.product_uom_unit') + } + if ( + self.type == 'arrivals' and + self.company_id.intrastat_arrivals == 'extended') or ( + self.type == 'dispatches' and + self.company_id.intrastat_dispatches == 'extended'): + self._extended = True + else: + self._extended = False + + decl_lines_init = [(6, 0, [])] + decl_lines = decl_lines_init[:] + + decl_lines += self._gather_invoices() + + if decl_lines == decl_lines_init: + self.action = 'nihil' + note = "\n" + \ + _("No records found for the selected period !") + '\n' + \ + _("The Declaration Action has been set to 'nihil'.") + self._note += note + + # To DO: add check on tax cases 46, 48, 84, 86 + + self.write({'intrastat_line_ids': decl_lines}) + + if self._note: + note_header = '\n\n>>> ' + str(date.today()) + '\n' + self.note = (self.note or '') + note_header + self._note + result_view = self.env.ref( + 'l10n_be_intrastat_advanced.intrastat_result_view') + return { + 'name': _("Generate lines from invoices: results"), + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'intrastat.result.view', + 'view_id': result_view.id, + 'target': 'new', + 'context': dict(self._context, note=self._note), + 'type': 'ir.actions.act_window', + } + + return True + + @api.model + def group_line_hashcode(self, computation_line): + hashcode = "%s-%s-%s-%s-%s" % ( + computation_line.src_dest_country_id.id or False, + computation_line.hs_code or False, + computation_line.intrastat_unit_id.id or False, + computation_line.transaction_id.id or False, + computation_line.transport_id.id or False + ) + return hashcode + + @api.multi + def generate_declaration(self): + """ generate declaration lines """ + self.ensure_one() + assert self.valid, 'Computation lines are not valid' + # Delete existing declaration lines + self.declaration_line_ids.unlink() + # Regenerate declaration lines from computation lines + dl_group = {} + for cl in self.computation_line_ids: + hashcode = self.group_line_hashcode(cl) + if hashcode in dl_group: + dl_group[hashcode].append(cl) + else: + dl_group[hashcode] = [cl] + ipdlo = self.pool['intrastat.product.declaration.line'] + for cl_lines in dl_group.values(): + vals = ipdlo._prepare_declaration_line(cl_lines) + declaration_line = ipdlo.create(vals) + cl_lines.write({'declaration_line_id': declaration_line.id}) + return True + + +class IntrastatProductComputationLine(models.Model): + _name = 'intrastat.product.computation.line' + _description = "Intrastat Product Computataion Lines" + + parent_id = fields.Many2one( + 'intrastat.product.declaration', + string='Intrastat Product Declaration', + ondelete='cascade', readonly=True) + company_id = fields.Many2one( + 'res.company', related='parent_id.company_id', + string="Company", readonly=True) + company_currency_id = fields.Many2one( + 'res.currency', related='company_id.currency_id', + string="Company currency", readonly=True) + type = fields.Selection( + related='parent_id.type', + string='Type', + readonly=True) + reporting_level = fields.Selection( + related='parent_id.reporting_level', + string='Reporting Level', + readonly=True) + valid = fields.Boolean( + compute='_check_validity', + string='Valid') + invoice_line_id = fields.Many2one( + 'account.invoice.line', string='Invoice Line', readonly=True) + invoice_id = fields.Many2one( + 'account.invoice', related='invoice_line_id.invoice_id', + string='Invoice', readonly=True) + declaration_line_id = fields.Many2one( + 'intrastat.product.declaration.line', + string='Declaration Line', readonly=True) + src_dest_country_id = fields.Many2one( + 'res.country', string='Country', + help="Country of Origin/Destination", + domain=[('intrastat', '=', True)]) + product_id = fields.Many2one( + 'product.product', related='invoice_line_id.product_id', + string='Product', readonly=True) + hs_code_id = fields.Many2one( + 'hs.code', string='Intrastat Code') + intrastat_unit_id = fields.Many2one( + 'intrastat.unit', related='hs_code_id.intrastat_unit_id', + string='Suppl. Unit', readonly=True, + help="Intrastat Supplementary Unit") + weight = fields.Float( + string='Weight (Kg)', + digits=dp.get_precision('Stock Weight')) + suppl_unit_qty = fields.Float( + string='Suppl. Unit Qty', + digits=dp.get_precision('Product Unit of Measure'), + help="Supplementary Units Quantity") + amount_company_currency = fields.Float( + string='Fiscal Value', + digits=dp.get_precision('Account'), required=True, + help="Amount in company currency to write in the declaration. " + "Amount in company currency = amount in invoice currency " + "converted to company currency with the rate of the invoice date.") + transaction_id = fields.Many2one( + 'intrastat.transaction', + string='Intrastat Transaction') + # extended declaration + transport_id = fields.Many2one( + 'intrastat.transport_mode', + string='Transport Mode') + + @api.one + @api.depends('transport_id') + def _check_validity(self): + """ TO DO: logic based upon fields """ + self.valid = True + + @api.onchange('product_id') + def _onchange_product(self): + self.weight = 0.0 + self.suppl_unit_qty = 0.0 + self.intrastat_code_id = False + self.intrastat_unit_id = False + if self.product_id: + self.intrastat_code_id = self.product_id.intrastat_id + self.intrastat_unit_id =\ + self.product_id.intrastat_id.intrastat_unit_id + if not self.intrastat_unit_id: + self.weight = self.product_id.weight_net + + +class IntrastatProductDeclarationLine(models.Model): + _name = 'intrastat.product.declaration.line' + _description = "Intrastat Product Declaration Lines" + + parent_id = fields.Many2one( + 'intrastat.product.declaration', + string='Intrastat Product Declaration', + ondelete='cascade', readonly=True) + company_id = fields.Many2one( + 'res.company', related='parent_id.company_id', + string="Company", readonly=True) + company_currency_id = fields.Many2one( + 'res.currency', related='company_id.currency_id', + string="Company currency", readonly=True) + type = fields.Selection( + related='parent_id.type', + string='Type', + readonly=True) + reporting_level = fields.Selection( + related='parent_id.reporting_level', + string='Reporting Level', + readonly=True) + computation_line_ids = fields.One2many( + 'intrastat.product.computation.line', 'declaration_line_id', + string='Computation Lines', readonly=True) + src_dest_country_id = fields.Many2one( + 'res.country', string='Country', + help="Country of Origin/Destination", + domain=[('intrastat', '=', True)]) + hs_code_id = fields.Many2one( + 'hs.code', + string='Intrastat Code') + intrastat_unit_id = fields.Many2one( + 'intrastat.unit', related='hs_code_id.intrastat_unit_id', + string='Suppl. Unit', readonly=True, + help="Intrastat Supplementary Unit") + weight = fields.Integer( + string='Weight (Kg)') + suppl_unit_qty = fields.Integer( + string='Suppl. Unit Qty', + help="Supplementary Units Quantity") + amount_company_currency = fields.Integer( + string='Fiscal Value', + help="Amount in company currency to write in the declaration. " + "Amount in company currency = amount in invoice currency " + "converted to company currency with the rate of the invoice date.") + transaction_id = fields.Many2one( + 'intrastat.transaction', + string='Intrastat Transaction') + # extended declaration + transport_id = fields.Many2one( + 'intrastat.transport_mode', + string='Transport Mode') + + @api.model + def _prepare_grouped_fields(computation_line, fields_to_sum): + vals = { + 'src_dest_country_id': computation_line.src_dest_country_id.id, + 'intrastat_unit_id': computation_line.intrastat_unit_id.id, + 'hs_code': computation_line.hs_code_id.local_code, + 'transaction_id': computation_line.transaction_id.id, + 'transport_id': computation_line.transport_id.id, + 'parent_id': computation_line.parent_id.id, + } + for field in fields_to_sum: + vals[field] = 0.0 + return vals + + def _fields_to_sum(): + fields_to_sum = [ + 'weight', + 'suppl_unit_qty', + 'amount_company_currency', + ] + return fields_to_sum + + @api.model + def _prepare_declaration_line(self, computation_lines): + fields_to_sum = self._fields_to_sum() + vals = self._prepare_grouped_fields( + computation_lines[0], fields_to_sum) + for computation_line in computation_lines: + for field in fields_to_sum: + vals[field] += computation_line[field] + return vals diff --git a/intrastat_product/intrastat_declaration_view.xml b/intrastat_product/intrastat_declaration_view.xml new file mode 100644 index 0000000..100eb93 --- /dev/null +++ b/intrastat_product/intrastat_declaration_view.xml @@ -0,0 +1,177 @@ + + + + + + intrastat.product.declaration.form + intrastat.product.declaration + +
+
+
+ +
+

+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ +
+
+ + + + Intrastat Product Declaration Validated + intrastat.product.declaration + + Intrastat Product Declaration Validated + + + + intrastat.product.tree + intrastat.product.declaration + + + + + + + + + + + + + + + intrastat.product.search + intrastat.product.declaration + + + + + + + + + + + + + + + + intrastat.product.graph + intrastat.product.declaration + + + + + + + + + + + Intrastat Product Declaration + intrastat.product.declaration + tree,form,graph + + + + + +
+
diff --git a/intrastat_product/intrastat_demo.xml b/intrastat_product/intrastat_demo.xml index b5ae41b..61b1c39 100644 --- a/intrastat_product/intrastat_demo.xml +++ b/intrastat_product/intrastat_demo.xml @@ -1,7 +1,7 @@ @@ -9,80 +9,13 @@ - - 84715000 - 84715000 - - Automatic data-processing machines (computers) + + - - 84717050 - 84717050 - - Storage units + + - - 85340090 - 85340090 - Printed circuits - - - - - - 5 - - - - - - 6 - - - - - - 6.5 - - - - - - 0.5 - - - - - - 0.5 - - - - - - 0.5 - - - - - - 0.7 - - - - - - 0.8 - - - - - - 2 - - - diff --git a/intrastat_product/intrastat_view.xml b/intrastat_product/intrastat_view.xml index b62c280..c61fc61 100644 --- a/intrastat_product/intrastat_view.xml +++ b/intrastat_product/intrastat_view.xml @@ -1,101 +1,203 @@ - + - - - intrastat.product.template.form - product.template - - - - - + + + + + + intrastat.hs.code.tree + hs.code + + + + - - + + - - - intrastat.product.category.form - product.category - - - - - - - - - + + + intrastat.hs.code.form + hs.code + + + + + + + - - - intrastat.product.intrastat.code.search - report.intrastat.code - - - - - - - - - - intrastat.product.intrastat.code.tree - report.intrastat.code - - + + + intrastat.unit.form + intrastat.unit + +
+ - - + - - - - - - - fr.intrastat.product.intrastat.code.form - report.intrastat.code - - - - - - - - - - - - - - - + +
-
-
+
+
- - - Intrastat Code - report.intrastat.code - tree,form - + + intrastat.unit.tree + intrastat.unit + + + + + + + + - - + + intrastat.unit.search + intrastat.unit + + + + + + + + + -
+ + + Supplementary Units + intrastat.unit + tree,form + + + + + + + intrastat.transaction_form + intrastat.transaction + +
+ + + + + +
+
+
+ + + intrastat.transaction_tree + intrastat.transaction + + + + + + + + + + + intrastat.transaction.mode.search + intrastat.transaction + + + + + + + + + + + + Transaction Types + intrastat.transaction + tree,form + + + + + + + + intrastat.transport.mode.form + intrastat.transport_mode + +
+ + + + + +
+
+
+ + + intrastat.transport.mode.tree + intrastat.transport_mode + + + + + + + + + + + intrastat.transport.mode.search + intrastat.transport_mode + + + + + + + + + Transport Modes + intrastat.transport_mode + tree,form + + + + +
diff --git a/intrastat_product/res_company.py b/intrastat_product/res_company.py new file mode 100644 index 0000000..65e0e3f --- /dev/null +++ b/intrastat_product/res_company.py @@ -0,0 +1,67 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2012-2015 Noviat nv/sa (www.noviat.com) +# Copyright (C) 2015 Akretion (http://www.akretion.com) +# @author Luc de Meyer +# @author Alexis de Lattre +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models, fields, api + + +class ResCompany(models.Model): + _inherit = 'res.company' + + @api.model + def _intrastat_arrivals(self): + return [ + ('exempt', 'Exempt'), + ('standard', 'Standard'), + ('extended', 'Extended')] + + @api.model + def _intrastat_dispatches(self): + return [ + ('exempt', 'Exempt'), + ('standard', 'Standard'), + ('extended', 'Extended')] + + @api.one + @api.depends('intrastat_arrivals', 'intrastat_dispatches') + def _compute_intrastat(self): + if self.intrastat_arrivals == 'exempt' \ + and self.intrastat_dispatches == 'exempt': + self.intrastat = 'exempt' + elif self.intrastat_arrivals == 'extended' \ + or self.intrastat_dispatches == 'extended': + self.intrastat = 'extended' + else: + self.intrastat = 'standard' + + intrastat_arrivals = fields.Selection( + '_intrastat_arrivals', string='Arrivals', + default='extended', required=True) + intrastat_dispatches = fields.Selection( + '_intrastat_arrivals', string='Dispatches', + default='extended', required=True) + intrastat_transport_id = fields.Many2one( + 'intrastat.transport_mode', + string='Default Transport Mode', ondelete='restrict') + intrastat = fields.Char( + string='Intrastat Declaration', store=True, readonly=True, + compute='_compute_intrastat') diff --git a/intrastat_product/res_company_view.xml b/intrastat_product/res_company_view.xml new file mode 100644 index 0000000..9761cb4 --- /dev/null +++ b/intrastat_product/res_company_view.xml @@ -0,0 +1,21 @@ + + + + + + intrastat.company.form + res.company + + + + + + + + + + + + + diff --git a/intrastat_product/security/intrastat_security.xml b/intrastat_product/security/intrastat_security.xml new file mode 100644 index 0000000..cd4f161 --- /dev/null +++ b/intrastat_product/security/intrastat_security.xml @@ -0,0 +1,12 @@ + + + + + + Intrastat Transaction Company rule + + ['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])] + + + + diff --git a/intrastat_product/security/ir.model.access.csv b/intrastat_product/security/ir.model.access.csv index 1708adf..bd6835f 100644 --- a/intrastat_product/security/ir.model.access.csv +++ b/intrastat_product/security/ir.model.access.csv @@ -1,3 +1,10 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_report_intrastat_code_sale_manager,Full access on report.intrastat.code to sale manager,model_report_intrastat_code,base.group_sale_manager,1,1,1,1 -access_report_intrastat_code_employee,Read access on report.intrastat.code to employee,model_report_intrastat_code,base.group_user,1,0,0,0 +access_intrastat_unit_read,Read access on Intrastat Supplementary Units to everybody,model_intrastat_unit,,1,0,0,0 +access_intrastat_unit_full,Full access on Intrastat Supplementary Units to Finance manager,model_intrastat_unit,account.group_account_manager,1,1,1,1 +access_intrastat_transaction_read,Read access on Intrastat Transaction Types to everybody,model_intrastat_transaction,,1,0,0,0 +access_intrastat_transaction_full,Full access on Intrastat Transaction Types to Finance manager,model_intrastat_transaction,account.group_account_manager,1,1,1,1 +access_intrastat_transport_mode_read,Read access on Intrastat Transport Modes to everybody,model_intrastat_transport_mode,,1,0,0,0 +access_intrastat_transport_mode_full,Full access on Intrastat Transport Modes to Finance manager,model_intrastat_transport_mode,account.group_account_manager,1,1,1,1 +access_intrastat_product_declaration,Full access on Intrastat Product Declarations to Accountant,model_intrastat_product_declaration,account.group_account_user,1,1,1,1 +access_intrastat_product_computation_line,Full access on Intrastat Product Computation Lines to Accountant,model_intrastat_product_computation_line,account.group_account_user,1,1,1,1 +access_intrastat_product_declaration_line,Full access on Intrastat Product Declaration Lines to Accountant,model_intrastat_product_declaration_line,account.group_account_user,1,1,1,1 diff --git a/intrastat_product/stock.py b/intrastat_product/stock.py new file mode 100644 index 0000000..c97cf75 --- /dev/null +++ b/intrastat_product/stock.py @@ -0,0 +1,40 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2010-2015 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models, fields, api + + +class StockPicking(models.Model): + _inherit = "stock.picking" + + intrastat_transport_id = fields.Many2one( + 'intrastat.transport_mode', string='Transport Mode', + help="This information is used in Intrastat reports") + intrastat = fields.Char(related='company_id.intrastat') + + @api.model + def _create_invoice_from_picking(self, picking, vals): + '''Copy transport and department from picking to invoice''' + vals['intrastat_transport_id'] = picking.intrastat_transport_id.id + if picking.partner_id and picking.partner_id.country_id: + vals['src_dest_country_id'] = picking.partner_id.country_id.id + return super(StockPicking, self)._create_invoice_from_picking( + picking, vals) diff --git a/intrastat_product/stock_view.xml b/intrastat_product/stock_view.xml new file mode 100644 index 0000000..80ce61e --- /dev/null +++ b/intrastat_product/stock_view.xml @@ -0,0 +1,28 @@ + + + + + + + + + + intrastat.product.picking.form + stock.picking + + + + + + + + + + + From 72c1c33f9555c95b6cecaada6b1d9e85d9c17ba0 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Sat, 25 Jul 2015 17:18:44 +0200 Subject: [PATCH 04/48] [IMP] intrastat_product: major update intrastat V3 modules * add region to intrastat_product --- intrastat_product/README.rst | 81 ++++++- intrastat_product/__init__.py | 6 +- intrastat_product/__openerp__.py | 21 +- .../{ => demo}/intrastat_demo.xml | 0 intrastat_product/intrastat.py | 122 ----------- intrastat_product/intrastat_view.xml | 203 ----------------- intrastat_product/models/__init__.py | 11 + .../{ => models}/account_invoice.py | 32 ++- intrastat_product/models/hs_code.py | 48 ++++ .../intrastat_product_declaration.py} | 206 ++++++++++-------- intrastat_product/models/intrastat_region.py | 43 ++++ .../models/intrastat_transaction.py | 56 +++++ .../models/intrastat_transport_mode.py | 49 +++++ intrastat_product/models/intrastat_unit.py | 41 ++++ intrastat_product/{ => models}/res_company.py | 46 ++-- .../{stock.py => models/stock_picking.py} | 5 +- intrastat_product/models/stock_warehouse.py | 42 ++++ .../security/intrastat_security.xml | 6 + .../security/ir.model.access.csv | 2 + .../account_invoice.xml} | 8 + intrastat_product/views/hs_code.xml | 45 ++++ .../intrastat_product_declaration.xml} | 41 ++-- intrastat_product/views/intrastat_region.xml | 46 ++++ .../views/intrastat_transaction.xml | 68 ++++++ .../views/intrastat_transport_mode.xml | 64 ++++++ intrastat_product/views/intrastat_unit.xml | 70 ++++++ .../res_company.xml} | 3 + .../stock_picking.xml} | 0 intrastat_product/views/stock_warehouse.xml | 17 ++ 29 files changed, 907 insertions(+), 475 deletions(-) rename intrastat_product/{ => demo}/intrastat_demo.xml (100%) delete mode 100644 intrastat_product/intrastat.py delete mode 100644 intrastat_product/intrastat_view.xml create mode 100644 intrastat_product/models/__init__.py rename intrastat_product/{ => models}/account_invoice.py (81%) create mode 100644 intrastat_product/models/hs_code.py rename intrastat_product/{intrastat_declaration.py => models/intrastat_product_declaration.py} (87%) create mode 100644 intrastat_product/models/intrastat_region.py create mode 100644 intrastat_product/models/intrastat_transaction.py create mode 100644 intrastat_product/models/intrastat_transport_mode.py create mode 100644 intrastat_product/models/intrastat_unit.py rename intrastat_product/{ => models}/res_company.py (76%) rename intrastat_product/{stock.py => models/stock_picking.py} (89%) create mode 100644 intrastat_product/models/stock_warehouse.py rename intrastat_product/{account_invoice_view.xml => views/account_invoice.xml} (82%) create mode 100644 intrastat_product/views/hs_code.xml rename intrastat_product/{intrastat_declaration_view.xml => views/intrastat_product_declaration.xml} (82%) create mode 100644 intrastat_product/views/intrastat_region.xml create mode 100644 intrastat_product/views/intrastat_transaction.xml create mode 100644 intrastat_product/views/intrastat_transport_mode.xml create mode 100644 intrastat_product/views/intrastat_unit.xml rename intrastat_product/{res_company_view.xml => views/res_company.xml} (73%) rename intrastat_product/{stock_view.xml => views/stock_picking.xml} (100%) create mode 100644 intrastat_product/views/stock_warehouse.xml diff --git a/intrastat_product/README.rst b/intrastat_product/README.rst index 455c358..1ad1510 100644 --- a/intrastat_product/README.rst +++ b/intrastat_product/README.rst @@ -1,3 +1,8 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +======================== Intrastat Product Module ======================== @@ -8,6 +13,8 @@ such as: - *l10n_fr_intrastat_product*: the module for the *Déclaration d'Echange de Biens* (DEB) for France +- *l10n_be_intrastat_product*: + the module for the Intrastat Product Declaration for Belgium These country-specific modules can be found in the OCA localization for those countries. @@ -15,10 +22,74 @@ Installation ============ WARNING: + This module conflicts with the module *report_intrastat* from the official addons. If you have already installed the module *report_intrastat*, you should uninstall it before installing this module. + +Usage +===== + +This module is used in combination with the country-specific +localization module(s). + +Coding guidelines for localization module: +------------------------------------------ + +We recommend to start by copying an existing module, e.g. l10n_be_intrastat_product +and adapt the code for the specific needs of your country. + +* Declaration Object + + Create a new class as follows: + + .. code-block:: python + + class L10nCcIntrastatProductDeclaration(models.Model): + _name = 'l10n.cc.intrastat.product.declaration' + _description = "Intrastat Product Declaration for YourCountry" + _inherit = ['intrastat.product.declaration', 'mail.thread'] + + whereby cc = your country code + +* Computation & Declaration Lines + + Create also new objects inheriting from the Computation and Declaration Line Objects + so that you can add methods or customise the methods from the base modules (make a PR when + the customization or new method is required for multiple countries). + + Adapt also the parent_id fields of the newly created objects + (cf. l10n_be_intrastat_product as example). + +* XML Files: Menu, Action, Views + + Cf. l10n_be_istrastat_product as example, replace "be" by your Country Code. + + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/91/8.0 + + +Known issues / Roadmap +====================== + +Work is in progress to migrate the existing l10n_fr_intrastat_product module +to this new reporting framework, cf. Alexis de Lattre, Akretion . + + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `here `_. + + Credits ======= @@ -26,16 +97,20 @@ Contributors ------------ * Alexis de Lattre, Akretion +* Luc De Meyer, Noviat + Maintainer ---------- -.. image:: http://odoo-community.org/logo.png +.. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association - :target: http://odoo-community.org + :target: https://odoo-community.org This module is maintained by the OCA. -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. +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. To contribute to this module, please visit http://odoo-community.org. diff --git a/intrastat_product/__init__.py b/intrastat_product/__init__.py index 063edb0..21ff7c2 100644 --- a/intrastat_product/__init__.py +++ b/intrastat_product/__init__.py @@ -1,7 +1,3 @@ # -*- encoding: utf-8 -*- -from . import res_company -from . import intrastat -from . import intrastat_declaration -from . import stock -from . import account_invoice +from . import models diff --git a/intrastat_product/__openerp__.py b/intrastat_product/__openerp__.py index 7a593e8..b9576da 100644 --- a/intrastat_product/__openerp__.py +++ b/intrastat_product/__openerp__.py @@ -3,7 +3,7 @@ # # Intrastat Product module for Odoo # Copyright (C) 2011-2015 Akretion (http://www.akretion.com) -# Copyright (C) 2015 Noviat (http://www.noviat.com) +# Copyright (C) 2009-2015 Noviat (http://www.noviat.com) # @author Alexis de Lattre # @author Luc de Meyer # @@ -24,7 +24,7 @@ { 'name': 'Intrastat Product', - 'version': '1.3', + 'version': '1.4', 'category': 'Intrastat', 'license': 'AGPL-3', 'summary': 'Base module for Intrastat Product', @@ -36,16 +36,21 @@ ], 'conflicts': ['report_intrastat'], 'data': [ - 'intrastat_view.xml', - 'intrastat_declaration_view.xml', - 'res_company_view.xml', - 'account_invoice_view.xml', - 'stock_view.xml', + 'views/hs_code.xml', + 'views/intrastat_region.xml', + 'views/intrastat_unit.xml', + 'views/intrastat_transaction.xml', + 'views/intrastat_transport_mode.xml', + 'views/intrastat_product_declaration.xml', + 'views/res_company.xml', + 'views/account_invoice.xml', + 'views/stock_picking.xml', + 'views/stock_warehouse.xml', 'security/intrastat_security.xml', 'security/ir.model.access.csv', 'data/intrastat_transport_mode.xml', 'data/intrastat_unit.xml', ], - 'demo': ['intrastat_demo.xml'], + 'demo': ['demo/intrastat_demo.xml'], 'installable': True, } diff --git a/intrastat_product/intrastat_demo.xml b/intrastat_product/demo/intrastat_demo.xml similarity index 100% rename from intrastat_product/intrastat_demo.xml rename to intrastat_product/demo/intrastat_demo.xml diff --git a/intrastat_product/intrastat.py b/intrastat_product/intrastat.py deleted file mode 100644 index b87953a..0000000 --- a/intrastat_product/intrastat.py +++ /dev/null @@ -1,122 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Intrastat Product module for Odoo -# Copyright (C) 2011-2015 Akretion (http://www.akretion.com) -# Copyright (C) 2015 Noviat (http://www.noviat.com) -# @author Alexis de Lattre -# @author Luc de Meyer -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -from openerp import models, fields, api, _ -from openerp.exceptions import ValidationError - - -class IntrastatUnit(models.Model): - _name = 'intrastat.unit' - _description = 'Intrastat Supplementary Units' - - name = fields.Char( - string='Name', required=True) - description = fields.Char( - string='Description', required=True) - uom_id = fields.Many2one( - 'product.uom', string='Regular UoM', - help="Select the regular Unit of Measure of Odoo that corresponds " - "to this Intrastat Supplementary Unit.") - active = fields.Boolean( - string='Active', default=True) - - -class HSCode(models.Model): - _inherit = "hs.code" - - intrastat_unit_id = fields.Many2one( - 'intrastat.unit', string='Intrastat Supplementary Unit') - - @api.constrains('local_code') - def _hs_code(self): - if self.company_id.country_id.intrastat: - if not self.local_code.isdigit(): - raise ValidationError( - _("Intrastat Codes should only contain digits. " - "This is not the case for code '%s'.") - % self.local_code) - if len(self.local_code) != 8: - raise ValidationError( - _("Intrastat Codes should " - "contain 8 digits. This is not the case for " - "Intrastat Code '%s' which has %d digits.") - % (self.local_code, len(self.local_code))) - - -class IntrastatTransaction(models.Model): - _name = 'intrastat.transaction' - _description = "Intrastat Transaction" - _order = 'code' - _rec_name = 'display_name' - - @api.one - @api.depends('code', 'description') - def _compute_display_name(self): - display_name = self.code - if self.description: - display_name += ' ' + self.description - self.display_name = len(display_name) > 55 \ - and display_name[:55] + '...' \ - or display_name - - code = fields.Char(string='Code', required=True) - description = fields.Text(string='Description') - display_name = fields.Char( - compute='_compute_display_name', string="Display Name", readonly=True) - company_id = fields.Many2one( - 'res.company', string='Company', - default=lambda self: self.env['res.company']._company_default_get( - 'intrastat.transaction')) - - _sql_constraints = [( - 'intrastat_transaction_code_unique', - 'UNIQUE(code, company_id)', - 'Code must be unique.')] - - -class IntrastatTransportMode(models.Model): - _name = 'intrastat.transport_mode' - _description = "Intrastat Transport Mode" - _rec_name = 'display_name' - _order = 'code' - - @api.one - @api.depends('name', 'code') - def _display_name(self): - print "display_name self=", self - print "self.code=", self.code - print "self.name=", self.name - self.display_name = '%s. %s' % (self.code, self.name) - - display_name = fields.Char( - string='Display Name', compute='_display_name', store=True, - readonly=True) - code = fields.Char(string='Code', required=True) - name = fields.Char(string='Name', required=True, translate=True) - description = fields.Char(string='Description', translate=True) - - _sql_constraints = [( - 'intrastat_transport_code_unique', - 'UNIQUE(code)', - 'Code must be unique.')] diff --git a/intrastat_product/intrastat_view.xml b/intrastat_product/intrastat_view.xml deleted file mode 100644 index c61fc61..0000000 --- a/intrastat_product/intrastat_view.xml +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - - - - intrastat.hs.code.tree - hs.code - - - - - - - - - - - intrastat.hs.code.form - hs.code - - - - - - - - - - - intrastat.unit.form - intrastat.unit - -
- - - - - - -
-
-
- - - intrastat.unit.tree - intrastat.unit - - - - - - - - - - - intrastat.unit.search - intrastat.unit - - - - - - - - - - - - - Supplementary Units - intrastat.unit - tree,form - - - - - - - intrastat.transaction_form - intrastat.transaction - -
- - - - - -
-
-
- - - intrastat.transaction_tree - intrastat.transaction - - - - - - - - - - - intrastat.transaction.mode.search - intrastat.transaction - - - - - - - - - - - - Transaction Types - intrastat.transaction - tree,form - - - - - - - - intrastat.transport.mode.form - intrastat.transport_mode - -
- - - - - -
-
-
- - - intrastat.transport.mode.tree - intrastat.transport_mode - - - - - - - - - - - intrastat.transport.mode.search - intrastat.transport_mode - - - - - - - - - Transport Modes - intrastat.transport_mode - tree,form - - - - -
-
diff --git a/intrastat_product/models/__init__.py b/intrastat_product/models/__init__.py new file mode 100644 index 0000000..66c0d7b --- /dev/null +++ b/intrastat_product/models/__init__.py @@ -0,0 +1,11 @@ +# -*- encoding: utf-8 -*- +from . import account_invoice +from . import hs_code +from . import intrastat_product_declaration +from . import intrastat_region +from . import intrastat_transaction +from . import intrastat_transport_mode +from . import intrastat_unit +from . import res_company +from . import stock_picking +from . import stock_warehouse diff --git a/intrastat_product/account_invoice.py b/intrastat_product/models/account_invoice.py similarity index 81% rename from intrastat_product/account_invoice.py rename to intrastat_product/models/account_invoice.py index 3179012..74f713a 100644 --- a/intrastat_product/account_invoice.py +++ b/intrastat_product/models/account_invoice.py @@ -1,10 +1,11 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# Copyright (c) 2012-2015 Noviat nv/sa (www.noviat.com) -# Copyright (C) 2015 Akretion (http://www.akretion.com) -# @author Luc de Meyer +# Intrastat Product module for Odoo +# Copyright (C) 2011-2015 Akretion (http://www.akretion.com) +# Copyright (C) 2009-2015 Noviat (http://www.noviat.com) # @author Alexis de Lattre +# @author Luc de Meyer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -13,11 +14,11 @@ # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## @@ -27,14 +28,14 @@ from openerp import models, fields, api class AccountInvoice(models.Model): _inherit = 'account.invoice' - @api.model - def _default_intrastat_transaction(self): - """ placeholder for localisation modules """ - return self.env['intrastat.transaction'].browse([]) - + incoterm_id = fields.Many2one( + 'stock.incoterms', string='Incoterm', + help="International Commercial Terms are a series of predefined " + "commercial terms used in international transactions.") intrastat_transaction_id = fields.Many2one( 'intrastat.transaction', string='Intrastat Transaction Type', - default=_default_intrastat_transaction, ondelete='restrict', + default=lambda self: self._default_intrastat_transaction(), + ondelete='restrict', help="Intrastat nature of transaction") intrastat_transport_id = fields.Many2one( 'intrastat.transport_mode', string='Intrastat Transport Mode', @@ -49,6 +50,11 @@ class AccountInvoice(models.Model): string='Intrastat Declaration', related='company_id.intrastat', store=True, readonly=True) + @api.model + def _default_intrastat_transaction(self): + """ placeholder for localisation modules """ + return self.env['intrastat.transaction'].browse([]) + @api.multi def onchange_partner_id( self, type, partner_id, date_invoice=False, @@ -82,7 +88,9 @@ class AccountInvoiceLine(models.Model): if product: product = self.env['product.product'].browse(product) - hs_code = product.get_hs_code_recursively() + hs_code = product.product_tmpl_id.get_hs_code_recursively() if hs_code: res['value']['hs_code_id'] = hs_code.id + else: + res['value']['hs_code_id'] = False return res diff --git a/intrastat_product/models/hs_code.py b/intrastat_product/models/hs_code.py new file mode 100644 index 0000000..6e23770 --- /dev/null +++ b/intrastat_product/models/hs_code.py @@ -0,0 +1,48 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Intrastat Product module for Odoo +# Copyright (C) 2011-2015 Akretion (http://www.akretion.com) +# Copyright (C) 2009-2015 Noviat (http://www.noviat.com) +# @author Alexis de Lattre +# @author Luc de Meyer +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models, fields, api, _ +from openerp.exceptions import ValidationError + + +class HSCode(models.Model): + _inherit = "hs.code" + + intrastat_unit_id = fields.Many2one( + 'intrastat.unit', string='Intrastat Supplementary Unit') + + @api.constrains('local_code') + def _hs_code(self): + if self.company_id.country_id.intrastat: + if not self.local_code.isdigit(): + raise ValidationError( + _("Intrastat Codes should only contain digits. " + "This is not the case for code '%s'.") + % self.local_code) + if len(self.local_code) != 8: + raise ValidationError( + _("Intrastat Codes should " + "contain 8 digits. This is not the case for " + "Intrastat Code '%s' which has %d digits.") + % (self.local_code, len(self.local_code))) diff --git a/intrastat_product/intrastat_declaration.py b/intrastat_product/models/intrastat_product_declaration.py similarity index 87% rename from intrastat_product/intrastat_declaration.py rename to intrastat_product/models/intrastat_product_declaration.py index 9f4f731..4dfc52b 100644 --- a/intrastat_product/intrastat_declaration.py +++ b/intrastat_product/models/intrastat_product_declaration.py @@ -3,7 +3,9 @@ # # Intrastat Product module for Odoo # Copyright (C) 2011-2015 Akretion (http://www.akretion.com) -# Copyright (C) 2011-2015 Noviat (http://www.noviat.com) +# Copyright (C) 2009-2015 Noviat (http://www.noviat.com) +# @author Alexis de Lattre +# @author Luc de Meyer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -21,12 +23,11 @@ ############################################################################## from openerp import models, fields, api, _ -from openerp.exceptions import Warning, RedirectWarning, ValidationError +from openerp.exceptions import RedirectWarning, ValidationError, Warning import openerp.addons.decimal_precision as dp from datetime import datetime, date from dateutil.relativedelta import relativedelta import logging - _logger = logging.getLogger(__name__) @@ -105,6 +106,10 @@ class IntrastatProductDeclaration(models.Model): 'res.company', string='Company', readonly=True, default=lambda self: self.env['res.company']._company_default_get( 'intrastat.product.declaration')) + company_country_code = fields.Char( + compute='_compute_company_country_code', + string='Company Country Code', readonly=True, store=True, + help="Used in views and methods of localization modules.") year = fields.Integer( string='Year', required=True, default=_get_year) @@ -186,12 +191,19 @@ class IntrastatProductDeclaration(models.Model): _sql_constraints = [ ('date_uniq', - 'unique(year_month, company_id, type)', + 'unique(year_month, company_id, type, revision)', "A declaration of the same type already exists for this month !" "\nYou should update the existing declaration " "or change the revision number of this one."), ] + @api.one + @api.depends('company_id') + def _compute_company_country_code(self): + if self.company_id: + self.company_country_code = \ + self.company_id.country_id.code.lower() + @api.one @api.depends('year', 'month') def _compute_year_month(self): @@ -219,7 +231,7 @@ class IntrastatProductDeclaration(models.Model): _('Go to company configuration screen')) def _get_partner_country(self, inv_line): - country = inv_line.invoice_id.intrastat_country_id \ + country = inv_line.invoice_id.src_dest_country_id \ or inv_line.invoice_id.partner_id.country_id if not country.intrastat: country = False @@ -228,53 +240,13 @@ class IntrastatProductDeclaration(models.Model): return country def _get_intrastat_transaction(self, inv_line): - if inv_line.invoice_id.intrastat_transaction_id: - tr = inv_line.invoice_id.intrastat_transaction_id.code - else: - tr = self.env.ref( - 'l10n_be_intrastat_advanced.intrastat_transaction_1') - return tr - - def _get_region(self, inv_line): - """ - Logic copied from standard addons, l10n_be_intrastat module: - If purchase, comes from purchase order, linked to a location, - which is linked to the warehouse. - - If sales, the sale order is linked to the warehouse. - If sales, from a delivery order, linked to a location, - which is linked to the warehouse. - If none found, get the company one. - """ - region = False - if inv_line.invoice_id.type in ('in_invoice', 'in_refund'): - po_lines = self.env['purchase.order.line'].search( - [('invoice_lines', 'in', inv_line.id)]) - if po_lines: - po = po_lines.order_id - region = self.env['stock.warehouse'].get_region_from_location( - po.location_id) - elif inv_line.invoice_id.type in ('out_invoice', 'out_refund'): - so_lines = self.env['sale.order.line'].search( - [('invoice_lines', 'in', inv_line.id)]) - if so_lines: - so = so_lines.order_id - region = so.warehouse_id.region_id - if not region: - if self.company_id.intrastat_region_id: - region = self.company_id.intrastat_region_id - else: - msg = _( - "The Intrastat Region of the Company is not set, " - "please configure it first.") - self._company_warning(msg) - return region + return inv_line.invoice_id.intrastat_transaction_id def _get_weight_and_supplunits(self, inv_line): line_qty = inv_line.quantity product = inv_line.product_id invoice = inv_line.invoice_id - intrastat_unit_id = inv_line.intrastat_id.intrastat_unit_id + intrastat_unit_id = inv_line.hs_code_id.intrastat_unit_id source_uom = inv_line.uos_id weight_uom_categ = self._uom_refs['weight_uom_categ'] kg_uom = self._uom_refs['kg_uom'] @@ -303,10 +275,10 @@ class IntrastatProductDeclaration(models.Model): "Please correct the Intrastat Supplementary Unit " "settingsand regenerate the lines or adjust the lines " "with Intrastat Code '%s' manually" - ) % intrastat_code + ) % inv_line.hs_code_id.local_code self._note += note return weight, suppl_unit_qty - if target_uom.categ_id == source_uom.category_id: + if target_uom.category_id == source_uom.category_id: suppl_unit_qty = self.env['product.uom']._compute_qty_obj( source_uom, line_qty, target_uom) else: @@ -370,8 +342,41 @@ class IntrastatProductDeclaration(models.Model): amount) return amount + def _get_region(self, inv_line): + """ + Logic copied from standard addons, l10n_be_intrastat module: + + If purchase, comes from purchase order, linked to a location, + which is linked to the warehouse. + + If sales, the sale order is linked to the warehouse. + If sales, from a delivery order, linked to a location, + which is linked to the warehouse. + + If none found, get the company one. + """ + region = False + if inv_line.invoice_id.type in ('in_invoice', 'in_refund'): + po_lines = self.env['purchase.order.line'].search( + [('invoice_lines', 'in', inv_line.id)]) + if po_lines: + po = po_lines.order_id + region = self.env['stock.warehouse'].get_region_from_location( + po.location_id) + elif inv_line.invoice_id.type in ('out_invoice', 'out_refund'): + so_lines = self.env['sale.order.line'].search( + [('invoice_lines', 'in', inv_line.id)]) + if so_lines: + so = so_lines.order_id + region = so.warehouse_id.region_id + if not region: + if self.company_id.intrastat_region_id: + region = self.company_id.intrastat_region_id + return region + + def _get_transport(self, inv_line): - transport = inv_line.invoice.transport_mode_id \ + transport = inv_line.invoice_id.intrastat_transport_id \ or self.company_id.intrastat_transport_id if not transport: msg = _( @@ -382,8 +387,8 @@ class IntrastatProductDeclaration(models.Model): return transport def _get_incoterm(self, inv_line): - incoterm = inv_line.invoice.incoterm_id \ - or self.company_id.incoterm_id + incoterm = inv_line.invoice_id.incoterm_id \ + or self.company_id.intrastat_incoterm_id if not incoterm: msg = _( "The default Incoterm " @@ -392,9 +397,13 @@ class IntrastatProductDeclaration(models.Model): self._company_warning(msg) return incoterm + def _update_computation_line_vals(self, inv_line, line_vals): + """ placeholder for localization modules """ + pass + def _gather_invoices(self): - decl_lines = [] + lines = [] start_date = date(self.year, self.month, 1) end_date = start_date + relativedelta(day=1, months=+1, days=-1) @@ -416,7 +425,7 @@ class IntrastatProductDeclaration(models.Model): for inv_line in invoice.invoice_line: - intrastat = inv_line.intrastat_id + intrastat = inv_line.hs_code_id if not intrastat: continue if not inv_line.quantity: @@ -429,8 +438,6 @@ class IntrastatProductDeclaration(models.Model): intrastat_transaction = \ self._get_intrastat_transaction(inv_line) - region = self._get_region(inv_line) - weight, suppl_unit_qty = self._get_weight_and_supplunits( inv_line) @@ -439,33 +446,32 @@ class IntrastatProductDeclaration(models.Model): line_vals = { 'parent_id': self.id, 'invoice_line_id': inv_line.id, - 'partner_country_id': partner_country.id, + 'src_dest_country_id': partner_country.id, 'product_id': inv_line.product_id.id, - 'intrastat_code_id': intrastat.id, + 'hs_code_id': intrastat.id, 'weight': weight, 'suppl_unit_qty': suppl_unit_qty, 'amount_company_currency': amount_company_currency, 'transaction_id': intrastat_transaction.id, - 'region_id': region.id, - 'extended': self._extended, } # extended declaration if self._extended: transport = self._get_transport(inv_line) - incoterm = self._get_incoterm(inv_line) line_vals.update({ 'transport_id': transport.id, - 'incoterm_id': incoterm.id, }) - decl_lines.append((0, 0, line_vals)) + self._update_computation_line_vals(inv_line, line_vals) - return decl_lines + lines.append((line_vals)) + + return lines @api.multi def action_gather(self): self.ensure_one() + self._check_generate_lines() self._note = '' self._uom_refs = { 'weight_uom_categ': self.env.ref('product.product_uom_categ_kgm'), @@ -482,27 +488,23 @@ class IntrastatProductDeclaration(models.Model): else: self._extended = False - decl_lines_init = [(6, 0, [])] - decl_lines = decl_lines_init[:] + self.computation_line_ids.unlink() + lines = self._gather_invoices() - decl_lines += self._gather_invoices() - - if decl_lines == decl_lines_init: + if not lines: self.action = 'nihil' note = "\n" + \ _("No records found for the selected period !") + '\n' + \ _("The Declaration Action has been set to 'nihil'.") self._note += note - - # To DO: add check on tax cases 46, 48, 84, 86 - - self.write({'intrastat_line_ids': decl_lines}) + else: + self.write({'computation_line_ids': [(0, 0, x) for x in lines]}) if self._note: note_header = '\n\n>>> ' + str(date.today()) + '\n' - self.note = (self.note or '') + note_header + self._note + self.note = note_header + self._note + (self.note or '') result_view = self.env.ref( - 'l10n_be_intrastat_advanced.intrastat_result_view') + 'intrastat_base.intrastat_result_view_form') return { 'name': _("Generate lines from invoices: results"), 'view_type': 'form', @@ -518,12 +520,13 @@ class IntrastatProductDeclaration(models.Model): @api.model def group_line_hashcode(self, computation_line): - hashcode = "%s-%s-%s-%s-%s" % ( + hashcode = "%s-%s-%s-%s-%s-%s" % ( computation_line.src_dest_country_id.id or False, - computation_line.hs_code or False, + computation_line.hs_code_id.id or False, computation_line.intrastat_unit_id.id or False, computation_line.transaction_id.id or False, - computation_line.transport_id.id or False + computation_line.transport_id.id or False, + computation_line.region_id.id or False ) return hashcode @@ -542,13 +545,38 @@ class IntrastatProductDeclaration(models.Model): dl_group[hashcode].append(cl) else: dl_group[hashcode] = [cl] - ipdlo = self.pool['intrastat.product.declaration.line'] + ipdl = self.declaration_line_ids for cl_lines in dl_group.values(): - vals = ipdlo._prepare_declaration_line(cl_lines) - declaration_line = ipdlo.create(vals) - cl_lines.write({'declaration_line_id': declaration_line.id}) + vals = ipdl._prepare_declaration_line(cl_lines) + declaration_line = ipdl.create(vals) + for cl in cl_lines: + cl.write({'declaration_line_id': declaration_line.id}) return True + @api.multi + def generate_xml(self): + """ generate the INTRASTAT Declaration XML file """ + self.ensure_one() + self._check_generate_xml() + self._unlink_attachments() + xml_string = self._generate_xml() + if xml_string: + attach_id = self._attach_xml_file( + xml_string, '%s_%s' % (self.type, self.revision)) + return self._open_attach_view(attach_id) + else: + raise Warning( + _("Programming Error."), + _("No XML File has been generated.")) + + @api.multi + def done(self): + self.write({'state': 'done'}) + + @api.multi + def back2draft(self): + self.write({'state': 'draft'}) + class IntrastatProductComputationLine(models.Model): _name = 'intrastat.product.computation.line' @@ -612,7 +640,11 @@ class IntrastatProductComputationLine(models.Model): transaction_id = fields.Many2one( 'intrastat.transaction', string='Intrastat Transaction') + region_id = fields.Many2one( + 'intrastat.region', string='Intrastat Region') # extended declaration + incoterm_id = fields.Many2one( + 'stock.incoterms', string='Incoterm') transport_id = fields.Many2one( 'intrastat.transport_mode', string='Transport Mode') @@ -686,17 +718,21 @@ class IntrastatProductDeclarationLine(models.Model): transaction_id = fields.Many2one( 'intrastat.transaction', string='Intrastat Transaction') + region_id = fields.Many2one( + 'intrastat.region', string='Intrastat Region') # extended declaration + incoterm_id = fields.Many2one( + 'stock.incoterms', string='Incoterm') transport_id = fields.Many2one( 'intrastat.transport_mode', string='Transport Mode') @api.model - def _prepare_grouped_fields(computation_line, fields_to_sum): + def _prepare_grouped_fields(self, computation_line, fields_to_sum): vals = { 'src_dest_country_id': computation_line.src_dest_country_id.id, 'intrastat_unit_id': computation_line.intrastat_unit_id.id, - 'hs_code': computation_line.hs_code_id.local_code, + 'hs_code_id': computation_line.hs_code_id.id, 'transaction_id': computation_line.transaction_id.id, 'transport_id': computation_line.transport_id.id, 'parent_id': computation_line.parent_id.id, @@ -705,7 +741,7 @@ class IntrastatProductDeclarationLine(models.Model): vals[field] = 0.0 return vals - def _fields_to_sum(): + def _fields_to_sum(self): fields_to_sum = [ 'weight', 'suppl_unit_qty', diff --git a/intrastat_product/models/intrastat_region.py b/intrastat_product/models/intrastat_region.py new file mode 100644 index 0000000..3d1333e --- /dev/null +++ b/intrastat_product/models/intrastat_region.py @@ -0,0 +1,43 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Odoo, Open Source Management Solution +# +# Copyright (c) 2009-2015 Noviat nv/sa (www.noviat.com). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models, fields + + +class IntrastatRegion(models.Model): + _name = 'intrastat.region' + _description = "Intrastat Region" + + code = fields.Char(string='Code', required=True) + country_id = fields.Many2one( + 'res.country', string='Country', required=True) + name = fields.Char(string='Name', translate=True) + description = fields.Char(string='Description') + company_id = fields.Many2one( + 'res.company', string='Company', + default=lambda self: self.env['res.company']._company_default_get( + 'intrastat.region')) + + _sql_constraints = [ + ('intrastat_region_code_unique', + 'UNIQUE(code, country_id)', + 'Code must be unique.')] diff --git a/intrastat_product/models/intrastat_transaction.py b/intrastat_product/models/intrastat_transaction.py new file mode 100644 index 0000000..3734fa6 --- /dev/null +++ b/intrastat_product/models/intrastat_transaction.py @@ -0,0 +1,56 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Intrastat Product module for Odoo +# Copyright (C) 2011-2015 Akretion (http://www.akretion.com) +# Copyright (C) 2009-2015 Noviat (http://www.noviat.com) +# @author Alexis de Lattre +# @author Luc de Meyer +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models, fields, api + + +class IntrastatTransaction(models.Model): + _name = 'intrastat.transaction' + _description = "Intrastat Transaction" + _order = 'code' + _rec_name = 'display_name' + + code = fields.Char(string='Code', required=True) + description = fields.Text(string='Description') + display_name = fields.Char( + compute='_compute_display_name', string="Display Name", readonly=True) + company_id = fields.Many2one( + 'res.company', string='Company', + default=lambda self: self.env['res.company']._company_default_get( + 'intrastat.transaction')) + + @api.one + @api.depends('code', 'description') + def _compute_display_name(self): + display_name = self.code + if self.description: + display_name += ' ' + self.description + self.display_name = len(display_name) > 55 \ + and display_name[:55] + '...' \ + or display_name + + _sql_constraints = [( + 'intrastat_transaction_code_unique', + 'UNIQUE(code, company_id)', + 'Code must be unique.')] diff --git a/intrastat_product/models/intrastat_transport_mode.py b/intrastat_product/models/intrastat_transport_mode.py new file mode 100644 index 0000000..6157459 --- /dev/null +++ b/intrastat_product/models/intrastat_transport_mode.py @@ -0,0 +1,49 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Intrastat Product module for Odoo +# Copyright (C) 2011-2015 Akretion (http://www.akretion.com) +# Copyright (C) 2009-2015 Noviat (http://www.noviat.com) +# @author Alexis de Lattre +# @author Luc de Meyer +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models, fields, api + + +class IntrastatTransportMode(models.Model): + _name = 'intrastat.transport_mode' + _description = "Intrastat Transport Mode" + _rec_name = 'display_name' + _order = 'code' + + display_name = fields.Char( + string='Display Name', compute='_display_name', store=True, + readonly=True) + code = fields.Char(string='Code', required=True) + name = fields.Char(string='Name', required=True, translate=True) + description = fields.Char(string='Description', translate=True) + + @api.one + @api.depends('name', 'code') + def _display_name(self): + self.display_name = '%s. %s' % (self.code, self.name) + + _sql_constraints = [( + 'intrastat_transport_code_unique', + 'UNIQUE(code)', + 'Code must be unique.')] diff --git a/intrastat_product/models/intrastat_unit.py b/intrastat_product/models/intrastat_unit.py new file mode 100644 index 0000000..65a86f2 --- /dev/null +++ b/intrastat_product/models/intrastat_unit.py @@ -0,0 +1,41 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Intrastat Product module for Odoo +# Copyright (C) 2011-2015 Akretion (http://www.akretion.com) +# Copyright (C) 2009-2015 Noviat (http://www.noviat.com) +# @author Alexis de Lattre +# @author Luc de Meyer +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models, fields + + +class IntrastatUnit(models.Model): + _name = 'intrastat.unit' + _description = 'Intrastat Supplementary Units' + + name = fields.Char( + string='Name', required=True) + description = fields.Char( + string='Description', required=True) + uom_id = fields.Many2one( + 'product.uom', string='Regular UoM', + help="Select the regular Unit of Measure of Odoo that corresponds " + "to this Intrastat Supplementary Unit.") + active = fields.Boolean( + string='Active', default=True) diff --git a/intrastat_product/res_company.py b/intrastat_product/models/res_company.py similarity index 76% rename from intrastat_product/res_company.py rename to intrastat_product/models/res_company.py index 65e0e3f..f3d4c9b 100644 --- a/intrastat_product/res_company.py +++ b/intrastat_product/models/res_company.py @@ -1,10 +1,11 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# Copyright (c) 2012-2015 Noviat nv/sa (www.noviat.com) -# Copyright (C) 2015 Akretion (http://www.akretion.com) -# @author Luc de Meyer +# Intrastat Product module for Odoo +# Copyright (C) 2011-2015 Akretion (http://www.akretion.com) +# Copyright (C) 2009-2015 Noviat (http://www.noviat.com) # @author Alexis de Lattre +# @author Luc de Meyer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -13,11 +14,11 @@ # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## @@ -27,6 +28,28 @@ from openerp import models, fields, api class ResCompany(models.Model): _inherit = 'res.company' + intrastat_incoterm_id = fields.Many2one( + 'stock.incoterms', + string='Default incoterm for Intrastat', + help="International Commercial Terms are a series of " + "predefined commercial terms used in international " + "transactions.") + intrastat_arrivals = fields.Selection( + '_intrastat_arrivals', string='Arrivals', + default='extended', required=True) + intrastat_dispatches = fields.Selection( + '_intrastat_arrivals', string='Dispatches', + default='extended', required=True) + intrastat_transport_id = fields.Many2one( + 'intrastat.transport_mode', + string='Default Transport Mode', ondelete='restrict') + intrastat = fields.Char( + string='Intrastat Declaration', store=True, readonly=True, + compute='_compute_intrastat') + intrastat_region_id = fields.Many2one( + 'intrastat.region', + string='Default Intrastat region') + @api.model def _intrastat_arrivals(self): return [ @@ -52,16 +75,3 @@ class ResCompany(models.Model): self.intrastat = 'extended' else: self.intrastat = 'standard' - - intrastat_arrivals = fields.Selection( - '_intrastat_arrivals', string='Arrivals', - default='extended', required=True) - intrastat_dispatches = fields.Selection( - '_intrastat_arrivals', string='Dispatches', - default='extended', required=True) - intrastat_transport_id = fields.Many2one( - 'intrastat.transport_mode', - string='Default Transport Mode', ondelete='restrict') - intrastat = fields.Char( - string='Intrastat Declaration', store=True, readonly=True, - compute='_compute_intrastat') diff --git a/intrastat_product/stock.py b/intrastat_product/models/stock_picking.py similarity index 89% rename from intrastat_product/stock.py rename to intrastat_product/models/stock_picking.py index c97cf75..db97f5b 100644 --- a/intrastat_product/stock.py +++ b/intrastat_product/models/stock_picking.py @@ -1,8 +1,11 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# Copyright (C) 2010-2015 Akretion (http://www.akretion.com) +# Intrastat Product module for Odoo +# Copyright (C) 2011-2015 Akretion (http://www.akretion.com) +# Copyright (C) 2009-2015 Noviat (http://www.noviat.com) # @author Alexis de Lattre +# @author Luc de Meyer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as diff --git a/intrastat_product/models/stock_warehouse.py b/intrastat_product/models/stock_warehouse.py new file mode 100644 index 0000000..d766b61 --- /dev/null +++ b/intrastat_product/models/stock_warehouse.py @@ -0,0 +1,42 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Odoo, Open Source Management Solution +# +# Copyright (c) 2009-2015 Noviat nv/sa (www.noviat.com). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models, fields + + +class StockWarehouse(models.Model): + _inherit = 'stock.warehouse' + + region_id = fields.Many2one( + 'intrastat.region', + string='Intrastat region') + + def get_region_from_location(self, location): + locations = location.search( + [('parent_left', '<=', location.parent_left), + ('parent_right', '>=', location.parent_right)]) + warehouses = self.search( + [('lot_stock_id', 'in', [x.id for x in locations]), + ('region_id', '!=', False)]) + if warehouses: + return warehouses[0].region_id + return None diff --git a/intrastat_product/security/intrastat_security.xml b/intrastat_product/security/intrastat_security.xml index cd4f161..e483225 100644 --- a/intrastat_product/security/intrastat_security.xml +++ b/intrastat_product/security/intrastat_security.xml @@ -8,5 +8,11 @@ ['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])] + + Intrastat Region Company rule + + ['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])] + + diff --git a/intrastat_product/security/ir.model.access.csv b/intrastat_product/security/ir.model.access.csv index bd6835f..4b06ab2 100644 --- a/intrastat_product/security/ir.model.access.csv +++ b/intrastat_product/security/ir.model.access.csv @@ -5,6 +5,8 @@ access_intrastat_transaction_read,Read access on Intrastat Transaction Types to access_intrastat_transaction_full,Full access on Intrastat Transaction Types to Finance manager,model_intrastat_transaction,account.group_account_manager,1,1,1,1 access_intrastat_transport_mode_read,Read access on Intrastat Transport Modes to everybody,model_intrastat_transport_mode,,1,0,0,0 access_intrastat_transport_mode_full,Full access on Intrastat Transport Modes to Finance manager,model_intrastat_transport_mode,account.group_account_manager,1,1,1,1 +access_intrastat_region_read,Read access on Intrastat Regions,model_intrastat_region,,1,0,0,0 +access_intrastat_region_full,Full access on Intrastat Regions,model_intrastat_region,account.group_account_manager,1,1,1,1 access_intrastat_product_declaration,Full access on Intrastat Product Declarations to Accountant,model_intrastat_product_declaration,account.group_account_user,1,1,1,1 access_intrastat_product_computation_line,Full access on Intrastat Product Computation Lines to Accountant,model_intrastat_product_computation_line,account.group_account_user,1,1,1,1 access_intrastat_product_declaration_line,Full access on Intrastat Product Declaration Lines to Accountant,model_intrastat_product_declaration_line,account.group_account_user,1,1,1,1 diff --git a/intrastat_product/account_invoice_view.xml b/intrastat_product/views/account_invoice.xml similarity index 82% rename from intrastat_product/account_invoice_view.xml rename to intrastat_product/views/account_invoice.xml index cccb557..709ebbb 100644 --- a/intrastat_product/account_invoice_view.xml +++ b/intrastat_product/views/account_invoice.xml @@ -7,6 +7,10 @@ account.invoice + + + @@ -26,6 +30,10 @@ account.invoice + + + diff --git a/intrastat_product/views/hs_code.xml b/intrastat_product/views/hs_code.xml new file mode 100644 index 0000000..f6e54f2 --- /dev/null +++ b/intrastat_product/views/hs_code.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + intrastat.hs.code.tree + hs.code + + + + + + + + + + + intrastat.hs.code.form + hs.code + + + + + + + + + + diff --git a/intrastat_product/intrastat_declaration_view.xml b/intrastat_product/views/intrastat_product_declaration.xml similarity index 82% rename from intrastat_product/intrastat_declaration_view.xml rename to intrastat_product/views/intrastat_product_declaration.xml index 100eb93..935a158 100644 --- a/intrastat_product/intrastat_declaration_view.xml +++ b/intrastat_product/views/intrastat_product_declaration.xml @@ -2,7 +2,7 @@ - + intrastat.product.declaration.form intrastat.product.declaration @@ -12,7 +12,13 @@ attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('action', '=', 'nihil')]}" string="Generate lines from invoices" class="oe_highlight"/> - + + - @@ -43,11 +49,12 @@ - - - + filter_domain="['|', ('name', 'ilike', self), ('description', 'ilike', self)]"/> + + + + diff --git a/intrastat_product/views/res_config_settings.xml b/intrastat_product/views/res_config_settings.xml index d055342..8002276 100644 --- a/intrastat_product/views/res_config_settings.xml +++ b/intrastat_product/views/res_config_settings.xml @@ -21,7 +21,7 @@
-
+
-
+
@@ -50,7 +50,7 @@
-
+
From c2e717397a6e5c6a3d9ba9163e23f04a0286da61 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Thu, 30 May 2019 20:30:22 +0200 Subject: [PATCH 24/48] flake8 --- intrastat_product/report/intrastat_product_report_xls.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/intrastat_product/report/intrastat_product_report_xls.py b/intrastat_product/report/intrastat_product_report_xls.py index e2e5802..e333224 100644 --- a/intrastat_product/report/intrastat_product_report_xls.py +++ b/intrastat_product/report/intrastat_product_report_xls.py @@ -205,8 +205,9 @@ class IntrastatProductDeclarationXlsx(models.AbstractModel): wl = declaration._xls_declaration_line_fields() report = 'declaration' - title = self._get_title(declaration, report, format='normal') - title_short = self._get_title(declaration, report, format='short') + title = self._get_title(declaration, report, title_format='normal') + title_short = self._get_title(declaration, report, + title_format='short') sheet_name = title_short[:31].replace('/', '-') params = { @@ -218,9 +219,9 @@ class IntrastatProductDeclarationXlsx(models.AbstractModel): } return [params] - def _get_title(self, declaration, report, format='normal'): + def _get_title(self, declaration, report, title_format='normal'): title = declaration.year_month - if format == 'normal': + if title_format == 'normal': if report == 'computation': title += ' : ' + _('Computation Lines') else: From 5d8c48da79587f0f7b9cc29fc6354db178c8df3a Mon Sep 17 00:00:00 2001 From: oca-travis Date: Mon, 3 Jun 2019 12:36:20 +0000 Subject: [PATCH 25/48] [UPD] Update intrastat_product.pot --- intrastat_product/i18n/intrastat_product.pot | 683 +++++++++++-------- 1 file changed, 397 insertions(+), 286 deletions(-) diff --git a/intrastat_product/i18n/intrastat_product.pot b/intrastat_product/i18n/intrastat_product.pot index 9172ec7..d92722b 100644 --- a/intrastat_product/i18n/intrastat_product.pot +++ b/intrastat_product/i18n/intrastat_product.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 11.0\n" +"Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: <>\n" "Language-Team: \n" @@ -74,7 +74,7 @@ msgid "12" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form msgid "Intrastat Product Declaration " msgstr "" @@ -86,18 +86,23 @@ msgstr "" #. module: intrastat_product #: code:addons/intrastat_product/report/intrastat_product_report_xls.py:91 -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_amount_accessory_cost_company_currency +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__amount_accessory_cost_company_currency #, python-format msgid "Accessory Costs" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_action +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__action msgid "Action" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit_active +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__message_needaction +msgid "Action Needed" +msgstr "" + +#. module: intrastat_product +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit__active msgid "Active" msgstr "" @@ -112,32 +117,42 @@ msgid "Air Transport" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_computation_line_amount_accessory_cost_company_currency +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_computation_line__amount_accessory_cost_company_currency msgid "Amount in company currency of the accessory costs related to this invoice line (by default, these accessory costs are computed at the pro-rata of the amount of each invoice line." msgstr "" #. module: intrastat_product -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_computation_line_amount_company_currency -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_line_amount_company_currency +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_computation_line__amount_company_currency +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_line__amount_company_currency msgid "Amount in company currency to write in the declaration. Amount in company currency = amount in invoice currency converted to company currency with the rate of the invoice date." msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_res_company_intrastat_arrivals -#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings_intrastat_arrivals -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_search +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_unit_search +msgid "Archived" +msgstr "" + +#. module: intrastat_product +#: model:ir.model.fields,field_description:intrastat_product.field_res_company__intrastat_arrivals +#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings__intrastat_arrivals +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_search msgid "Arrivals" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__message_attachment_count +msgid "Attachment Count" +msgstr "" + +#. module: intrastat_product +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form msgid "Back to Draft" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region_code -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction_code -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode_code +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region__code +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction__code +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode__code msgid "Code" msgstr "" @@ -149,7 +164,7 @@ msgid "Code must be unique." msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_transaction_mode_search +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_transaction_mode_search msgid "Code or Description" msgstr "" @@ -159,259 +174,264 @@ msgid "Companies" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_company_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_company_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_company_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region_company_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction_company_id -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_transaction_mode_search +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__company_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__company_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__company_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region__company_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction__company_id +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_transaction_mode_search msgid "Company" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_company_country_code +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__company_country_code msgid "Company Country Code" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_company_currency_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_company_currency_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__company_currency_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__company_currency_id msgid "Company currency" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/report/intrastat_product_report_xls.py:225 -#: code:addons/intrastat_product/report/intrastat_product_report_xls.py:236 -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_computation_line_ids +#: code:addons/intrastat_product/report/intrastat_product_report_xls.py:226 +#: code:addons/intrastat_product/report/intrastat_product_report_xls.py:237 +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__computation_line_ids #, python-format msgid "Computation Lines" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:261 +#: model:ir.model,name:intrastat_product.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: intrastat_product +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:244 #, python-format msgid "Conversion from Intrastat Supplementary Unit '%s' to Unit of Measure is not implemented yet." msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:276 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:259 #, python-format msgid "Conversion from unit of measure '%s' to '%s' is not implemented yet." msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:310 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:293 #, python-format msgid "Conversion from unit of measure '%s' to 'Kg' is not implemented yet. It is needed for product '%s'." msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_src_dest_country_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_src_dest_country_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region_country_id -#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings_country_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__src_dest_country_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__src_dest_country_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region__country_id +#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings__country_id msgid "Country" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings_country_code +#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings__country_code msgid "Country Code" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_product_origin_country_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_product_origin_country_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__product_origin_country_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__product_origin_country_id msgid "Country of Origin of the Product" msgstr "" #. module: intrastat_product #: code:addons/intrastat_product/report/intrastat_product_report_xls.py:66 -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_computation_line_src_dest_country_id -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_line_src_dest_country_id +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_computation_line__src_dest_country_id +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_line__src_dest_country_id #, python-format msgid "Country of Origin/Destination" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_computation_line_product_origin_country_id -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_line_product_origin_country_id +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_computation_line__product_origin_country_id +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_line__product_origin_country_id msgid "Country of origin of the product i.e. product 'made in ____'" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_create_uid -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_create_uid -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_create_uid -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region_create_uid -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction_create_uid -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode_create_uid -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit_create_uid +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__create_uid +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__create_uid +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__create_uid +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region__create_uid +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction__create_uid +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode__create_uid +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit__create_uid msgid "Created by" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_create_date -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_create_date -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_create_date -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region_create_date -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction_create_date -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode_create_date -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit_create_date +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__create_date +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__create_date +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__create_date +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region__create_date +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction__create_date +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode__create_date +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit__create_date msgid "Created on" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_currency_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__currency_id msgid "Currency" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_search +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_search msgid "Date" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_computation_line_view_form +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_computation_line_view_form msgid "Declaration" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_declaration_line_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__declaration_line_id msgid "Declaration Line" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/report/intrastat_product_report_xls.py:227 -#: code:addons/intrastat_product/report/intrastat_product_report_xls.py:238 -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form +#: code:addons/intrastat_product/report/intrastat_product_report_xls.py:228 +#: code:addons/intrastat_product/report/intrastat_product_report_xls.py:239 +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form #, python-format msgid "Declaration Lines" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:137 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:124 #, python-format msgid "Declaration for Arrivals" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:139 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:126 #, python-format msgid "Declaration for Dispatches" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_res_company_intrastat_incoterm_id -#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings_intrastat_incoterm_id +#: model:ir.model.fields,field_description:intrastat_product.field_res_company__intrastat_incoterm_id +#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings__intrastat_incoterm_id msgid "Default Incoterm for Intrastat" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_res_company_intrastat_region_id -#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings_intrastat_region_id +#: model:ir.model.fields,field_description:intrastat_product.field_res_company__intrastat_region_id +#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings__intrastat_region_id msgid "Default Intrastat Region" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_res_company_intrastat_transaction_out_invoice -#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings_intrastat_transaction_out_invoice +#: model:ir.model.fields,field_description:intrastat_product.field_res_company__intrastat_transaction_out_invoice +#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings__intrastat_transaction_out_invoice msgid "Default Intrastat Transaction For Customer Invoice" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_res_company_intrastat_transaction_in_invoice -#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings_intrastat_transaction_in_invoice +#: model:ir.model.fields,field_description:intrastat_product.field_res_company__intrastat_transaction_in_invoice +#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings__intrastat_transaction_in_invoice msgid "Default Intrastat Transaction For Supplier Invoices" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_res_company_intrastat_transaction_in_refund -#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings_intrastat_transaction_in_refund +#: model:ir.model.fields,field_description:intrastat_product.field_res_company__intrastat_transaction_in_refund +#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings__intrastat_transaction_in_refund msgid "Default Intrastat Transaction For Supplier Refunds" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_res_company_intrastat_transaction_out_refund -#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings_intrastat_transaction_out_refund +#: model:ir.model.fields,field_description:intrastat_product.field_res_company__intrastat_transaction_out_refund +#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings__intrastat_transaction_out_refund msgid "Default Intrastat Transaction for Customer Refunds" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_res_company_intrastat_transport_id -#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings_intrastat_transport_id +#: model:ir.model.fields,field_description:intrastat_product.field_res_company__intrastat_transport_id +#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings__intrastat_transport_id msgid "Default Transport Mode" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region_description -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction_description -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode_description -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit_description +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region__description +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction__description +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode__description +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit__description msgid "Description" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.invoice_form +#: model_terms:ir.ui.view,arch_db:intrastat_product.invoice_form msgid "Destination Country" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.invoice_supplier_form +#: model_terms:ir.ui.view,arch_db:intrastat_product.invoice_supplier_form msgid "Destination Region" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,help:intrastat_product.field_account_invoice_src_dest_country_id +#: model:ir.model.fields,help:intrastat_product.field_account_invoice__src_dest_country_id msgid "Destination country for dispatches. Origin country for arrivals." msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_res_company_intrastat_dispatches -#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings_intrastat_dispatches -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_search +#: model:ir.model.fields,field_description:intrastat_product.field_res_company__intrastat_dispatches +#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings__intrastat_dispatches +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_search msgid "Dispatches" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_display_name -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_display_name -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_display_name -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region_display_name -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction_display_name -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode_display_name -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit_display_name -#: model:ir.model.fields,field_description:intrastat_product.field_report_intrastat_product_product_declaration_xls_display_name +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__display_name +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__display_name +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__display_name +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region__display_name +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction__display_name +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode__display_name +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit__display_name +#: model:ir.model.fields,field_description:intrastat_product.field_report_intrastat_product_product_declaration_xls__display_name msgid "Display Name" msgstr "" #. module: intrastat_product #: selection:intrastat.product.declaration,state:0 -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_search +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_search msgid "Done" msgstr "" #. module: intrastat_product #: selection:intrastat.product.declaration,state:0 -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_search +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_search msgid "Draft" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form msgid "Excel Export" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:146 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:133 #, python-format msgid "Extended" msgstr "" #. module: intrastat_product #: code:addons/intrastat_product/report/intrastat_product_report_xls.py:78 -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_amount_company_currency -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_amount_company_currency +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__amount_company_currency +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__amount_company_currency #, python-format msgid "Fiscal Value" msgstr "" @@ -427,42 +447,57 @@ msgid "Fixed transport installations (e.g. pipelines, high-tension cables)" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:724 -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__message_follower_ids +msgid "Followers" +msgstr "" + +#. module: intrastat_product +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__message_channel_ids +msgid "Followers (Channels)" +msgstr "" + +#. module: intrastat_product +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__message_partner_ids +msgid "Followers (Partners)" +msgstr "" + +#. module: intrastat_product +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:708 +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form #, python-format msgid "Generate Declaration Lines" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:612 -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:597 +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form #, python-format msgid "Generate Lines from Invoices" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:747 -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:730 +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form #, python-format msgid "Generate XML Declaration File" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:644 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:629 #, python-format msgid "Generate lines from invoices: results" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:210 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:193 #, python-format msgid "Go to Accounting Configuration Settings screen" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_search -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_transaction_mode_search -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_unit_search +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_search +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_transaction_mode_search +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_unit_search msgid "Group By" msgstr "" @@ -477,27 +512,42 @@ msgid "H.S. Codes" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit_id -#: model:ir.model.fields,field_description:intrastat_product.field_report_intrastat_product_product_declaration_xls_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region__id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction__id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode__id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit__id +#: model:ir.model.fields,field_description:intrastat_product.field_report_intrastat_product_product_declaration_xls__id msgid "ID" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_res_company_intrastat_accessory_costs -#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings_intrastat_accessory_costs +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration__message_unread +msgid "If checked new messages require your attention." +msgstr "" + +#. module: intrastat_product +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration__message_needaction +msgid "If checked, new messages require your attention." +msgstr "" + +#. module: intrastat_product +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration__message_has_error +msgid "If checked, some messages have a delivery error." +msgstr "" + +#. module: intrastat_product +#: model:ir.model.fields,field_description:intrastat_product.field_res_company__intrastat_accessory_costs +#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings__intrastat_accessory_costs msgid "Include Accessory Costs in Fiscal Value of Product" msgstr "" #. module: intrastat_product #: code:addons/intrastat_product/report/intrastat_product_report_xls.py:157 -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_incoterm_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_incoterm_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__incoterm_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__incoterm_id #, python-format msgid "Incoterm" msgstr "" @@ -513,16 +563,16 @@ msgid "Inland waterway transport" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,help:intrastat_product.field_res_company_intrastat_incoterm_id -#: model:ir.model.fields,help:intrastat_product.field_res_config_settings_intrastat_incoterm_id +#: model:ir.model.fields,help:intrastat_product.field_res_company__intrastat_incoterm_id +#: model:ir.model.fields,help:intrastat_product.field_res_config_settings__intrastat_incoterm_id msgid "International Commercial Terms are a series of predefined commercial terms used in international transactions." msgstr "" #. module: intrastat_product #: code:addons/intrastat_product/report/intrastat_product_report_xls.py:54 -#: model:ir.model.fields,field_description:intrastat_product.field_account_invoice_line_hs_code_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_hs_code_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_hs_code_id +#: model:ir.model.fields,field_description:intrastat_product.field_account_invoice_line__hs_code_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__hs_code_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__hs_code_id #, python-format msgid "Intrastat Code" msgstr "" @@ -540,30 +590,31 @@ msgid "Intrastat Codes should only contain digits. This is not the case for code msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_account_invoice_intrastat_country +#: model:ir.model.fields,field_description:intrastat_product.field_account_invoice__intrastat_country msgid "Intrastat Country" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_account_invoice_intrastat -#: model:ir.model.fields,field_description:intrastat_product.field_res_company_intrastat -#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings_intrastat -#: model:ir.model.fields,field_description:intrastat_product.field_sale_order_intrastat +#: model:ir.model.fields,field_description:intrastat_product.field_account_invoice__intrastat +#: model:ir.model.fields,field_description:intrastat_product.field_res_company__intrastat +#: model:ir.model.fields,field_description:intrastat_product.field_res_config_settings__intrastat +#: model:ir.model.fields,field_description:intrastat_product.field_sale_order__intrastat msgid "Intrastat Declaration" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_line_view_form +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_line_view_form msgid "Intrastat Declaration Line" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_line_view_tree +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_line_view_tree msgid "Intrastat Declaration Lines" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_graph +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_graph +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_pivot msgid "Intrastat Product" msgstr "" @@ -573,25 +624,25 @@ msgid "Intrastat Product Computataion Lines" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_computation_line_ids +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__computation_line_ids msgid "Intrastat Product Computation Lines" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_parent_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_parent_id -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__parent_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__parent_id +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form msgid "Intrastat Product Declaration" msgstr "" #. module: intrastat_product #: model:ir.model,name:intrastat_product.model_intrastat_product_declaration_line -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_declaration_line_ids +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__declaration_line_ids msgid "Intrastat Product Declaration Lines" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_tree +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_tree msgid "Intrastat Product Declarations" msgstr "" @@ -603,11 +654,11 @@ msgstr "" #. module: intrastat_product #: code:addons/intrastat_product/report/intrastat_product_report_xls.py:177 #: model:ir.model,name:intrastat_product.model_intrastat_region -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_region_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_region_id -#: model:ir.model.fields,field_description:intrastat_product.field_stock_warehouse_region_id -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_region_view_form -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_region_view_tree +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__region_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__region_id +#: model:ir.model.fields,field_description:intrastat_product.field_stock_warehouse__region_id +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_region_view_form +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_region_view_tree #, python-format msgid "Intrastat Region" msgstr "" @@ -619,59 +670,59 @@ msgid "Intrastat Regions" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_hs_code_intrastat_unit_id -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_computation_line_intrastat_unit_id -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_line_intrastat_unit_id -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_unit_form +#: model:ir.model.fields,field_description:intrastat_product.field_hs_code__intrastat_unit_id +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_computation_line__intrastat_unit_id +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_line__intrastat_unit_id +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_unit_form msgid "Intrastat Supplementary Unit" msgstr "" #. module: intrastat_product #: model:ir.model,name:intrastat_product.model_intrastat_unit -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_unit_tree +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_unit_tree msgid "Intrastat Supplementary Units" msgstr "" #. module: intrastat_product #: code:addons/intrastat_product/report/intrastat_product_report_xls.py:105 #: model:ir.model,name:intrastat_product.model_intrastat_transaction -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_transaction_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_transaction_id -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_computation_line_view_form +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__transaction_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__transaction_id +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_computation_line_view_form #, python-format msgid "Intrastat Transaction" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_account_invoice_intrastat_transaction_id -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_transaction_form +#: model:ir.model.fields,field_description:intrastat_product.field_account_invoice__intrastat_transaction_id +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_transaction_form msgid "Intrastat Transaction Type" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_transaction_tree +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_transaction_tree msgid "Intrastat Transaction Types" msgstr "" #. module: intrastat_product #: model:ir.model,name:intrastat_product.model_intrastat_transport_mode -#: model:ir.model.fields,field_description:intrastat_product.field_account_invoice_intrastat_transport_id -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_transport_mode_form +#: model:ir.model.fields,field_description:intrastat_product.field_account_invoice__intrastat_transport_id +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_transport_mode_form msgid "Intrastat Transport Mode" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_transport_mode_tree +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_transport_mode_tree msgid "Intrastat Transportat Modes" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,help:intrastat_product.field_account_invoice_intrastat_transaction_id +#: model:ir.model.fields,help:intrastat_product.field_account_invoice__intrastat_transaction_id msgid "Intrastat nature of transaction" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:186 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:170 #, python-format msgid "Invalid Year !" msgstr "" @@ -684,149 +735,194 @@ msgstr "" #. module: intrastat_product #: code:addons/intrastat_product/report/intrastat_product_report_xls.py:187 #: model:ir.model,name:intrastat_product.model_account_invoice -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_invoice_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__invoice_id #, python-format msgid "Invoice" msgstr "" #. module: intrastat_product #: model:ir.model,name:intrastat_product.model_account_invoice_line -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_invoice_line_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__invoice_line_id msgid "Invoice Line" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_computation_line_view_form -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_line_view_form +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__message_is_follower +msgid "Is Follower" +msgstr "" + +#. module: intrastat_product +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_computation_line_view_form +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_line_view_form msgid "Kg" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line___last_update -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration___last_update -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line___last_update -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region___last_update -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction___last_update -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode___last_update -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit___last_update -#: model:ir.model.fields,field_description:intrastat_product.field_report_intrastat_product_product_declaration_xls___last_update +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line____last_update +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration____last_update +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line____last_update +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region____last_update +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction____last_update +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode____last_update +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit____last_update +#: model:ir.model.fields,field_description:intrastat_product.field_report_intrastat_product_product_declaration_xls____last_update msgid "Last Modified on" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_write_uid -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_write_uid -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_write_uid -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region_write_uid -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction_write_uid -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode_write_uid -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit_write_uid +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__write_uid +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__write_uid +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__write_uid +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region__write_uid +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction__write_uid +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode__write_uid +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit__write_uid msgid "Last Updated by" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_write_date -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_write_date -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_write_date -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region_write_date -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction_write_date -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode_write_date -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit_write_date +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__write_date +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__write_date +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__write_date +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region__write_date +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transaction__write_date +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode__write_date +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit__write_date msgid "Last Updated on" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:520 +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__message_main_attachment_id +msgid "Main Attachment" +msgstr "" + +#. module: intrastat_product +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__message_has_error +msgid "Message Delivery error" +msgstr "" + +#. module: intrastat_product +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__message_ids +msgid "Messages" +msgstr "" + +#. module: intrastat_product +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:506 #, python-format msgid "Missing H.S. code on product %s. This product is present in invoice %s." msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:249 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:232 #, python-format msgid "Missing unit of measure on the line with %d product(s) '%s' on invoice '%s'." msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:293 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:276 #, python-format msgid "Missing weight on product %s." msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_month +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__month msgid "Month" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region_name -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode_name -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit_name +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_region__name +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_transport_mode__name +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit__name msgid "Name" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_transport_mode_search +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_transport_mode_search msgid "Name, Code or Description" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_computation_line_weight -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_line_weight +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_computation_line__weight +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_line__weight msgid "Net weight in Kg" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/report/intrastat_product_report_xls.py:239 +#: code:addons/intrastat_product/report/intrastat_product_report_xls.py:240 #, python-format msgid "No" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:757 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:740 #, python-format msgid "No XML File has been generated." msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:631 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:616 #, python-format msgid "No records found for the selected period !" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_note -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__note +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form msgid "Notes" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_num_decl_lines +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__message_needaction_counter +msgid "Number of Actions" +msgstr "" + +#. module: intrastat_product +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__num_decl_lines msgid "Number of Declaration Lines" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.invoice_supplier_form +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__message_has_error_counter +msgid "Number of error" +msgstr "" + +#. module: intrastat_product +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration__message_needaction_counter +msgid "Number of messages which requires an action" +msgstr "" + +#. module: intrastat_product +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration__message_has_error_counter +msgid "Number of messages with delivery error" +msgstr "" + +#. module: intrastat_product +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration__message_unread_counter +msgid "Number of unread messages" +msgstr "" + +#. module: intrastat_product +#: model_terms:ir.ui.view,arch_db:intrastat_product.invoice_supplier_form msgid "Origin Country" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.invoice_form +#: model_terms:ir.ui.view,arch_db:intrastat_product.invoice_form msgid "Origin Region" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,help:intrastat_product.field_account_invoice_src_dest_region_id +#: model:ir.model.fields,help:intrastat_product.field_account_invoice__src_dest_region_id msgid "Origin region for dispatches, destination region for arrivals. This field is used for the Intrastat Declaration." msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_account_invoice_src_dest_country_id +#: model:ir.model.fields,field_description:intrastat_product.field_account_invoice__src_dest_country_id msgid "Origin/Destination Country" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_account_invoice_src_dest_region_id +#: model:ir.model.fields,field_description:intrastat_product.field_account_invoice__src_dest_region_id msgid "Origin/Destination Region" msgstr "" @@ -841,31 +937,31 @@ msgid "Own propulsion (imported or exported means of transport crossing the bord msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_year_month +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__year_month msgid "Period" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:253 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:236 #, python-format msgid "Please adjust this line manually." msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:265 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:248 #, python-format msgid "Please correct the Intrastat Supplementary Unit settings and regenerate the lines or adjust the lines with Intrastat Code '%s' manually" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:296 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:279 #, python-format msgid "Please correct the product record and regenerate the lines or adjust the impacted lines manually" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:280 -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:314 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:263 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:297 #, python-format msgid "Please correct the unit of measure settings and regenerate the lines or adjust the impacted lines manually" msgstr "" @@ -882,24 +978,19 @@ msgstr "" #. module: intrastat_product #: code:addons/intrastat_product/report/intrastat_product_report_xls.py:31 -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_product_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__product_id #, python-format msgid "Product" msgstr "" #. module: intrastat_product #: code:addons/intrastat_product/report/intrastat_product_report_xls.py:42 -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_computation_line_view_tree -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_line_view_tree +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_computation_line_view_tree +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_line_view_tree #, python-format msgid "Product C/O" msgstr "" -#. module: intrastat_product -#: model:ir.model,name:intrastat_product.model_sale_order -msgid "Quotation" -msgstr "" - #. module: intrastat_product #: model:intrastat.transport_mode,name:intrastat_product.intrastat_transport_2 msgid "Rail" @@ -911,25 +1002,25 @@ msgid "Railway transport (including lorries on railway wagons)" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit_uom_id -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_unit_search +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_unit__uom_id +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_unit_search msgid "Regular UoM" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_line_view_form +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_line_view_form msgid "Related Transactions" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_reporting_level -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_reporting_level -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_reporting_level +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__reporting_level +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__reporting_level +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__reporting_level msgid "Reporting Level" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_revision +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__revision msgid "Revision" msgstr "" @@ -943,6 +1034,11 @@ msgstr "" msgid "Road Transport" msgstr "" +#. module: intrastat_product +#: model:ir.model,name:intrastat_product.model_sale_order +msgid "Sale Order" +msgstr "" + #. module: intrastat_product #: model:intrastat.transport_mode,name:intrastat_product.intrastat_transport_1 msgid "Sea" @@ -954,65 +1050,65 @@ msgid "Sea Transport (including wagons, motor vehicles, trailers, semi-trailers msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_search +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_search msgid "Search Intrastat Product Declarations" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_unit_search +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_unit_search msgid "Search Intrastat Supplementary Units" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_transaction_mode_search +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_transaction_mode_search msgid "Search Intrastat Transaction Types" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_transport_mode_search +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_transport_mode_search msgid "Search Intrastat Transport Modes" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_computation_line_type -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_line_type -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_type +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_computation_line__type +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration__type +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_line__type msgid "Select the declaration type." msgstr "" #. module: intrastat_product -#: model:ir.model.fields,help:intrastat_product.field_intrastat_unit_uom_id +#: model:ir.model.fields,help:intrastat_product.field_intrastat_unit__uom_id msgid "Select the regular Unit of Measure of Odoo that corresponds to this Intrastat Supplementary Unit." msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:145 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:132 #, python-format msgid "Standard" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_state +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__state msgid "State" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_state +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration__state msgid "State of the declaration. When the state is set to 'Done', the parameters become read-only." msgstr "" #. module: intrastat_product #: code:addons/intrastat_product/report/intrastat_product_report_xls.py:146 -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_intrastat_unit_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_intrastat_unit_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__intrastat_unit_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__intrastat_unit_id #, python-format msgid "Suppl. Unit" msgstr "" #. module: intrastat_product #: code:addons/intrastat_product/report/intrastat_product_report_xls.py:130 -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_suppl_unit_qty -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_suppl_unit_qty +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__suppl_unit_qty +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__suppl_unit_qty #, python-format msgid "Suppl. Unit Qty" msgstr "" @@ -1024,57 +1120,57 @@ msgid "Supplementary Units" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_computation_line_suppl_unit_qty -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_line_suppl_unit_qty +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_computation_line__suppl_unit_qty +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_line__suppl_unit_qty msgid "Supplementary Units Quantity" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:632 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:617 #, python-format msgid "The Declaration Action has been set to 'nihil'." msgstr "" #. module: intrastat_product -#: model:ir.model.fields,help:intrastat_product.field_res_config_settings_country_code +#: model:ir.model.fields,help:intrastat_product.field_res_config_settings__country_code msgid "The ISO country code in two chars. \n" "You can use this field for quick search." msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:385 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:370 #, python-format msgid "The default Incoterm of the Company is not set, please configure it first." msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:374 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:356 #, python-format msgid "The default Intrastat Transport Mode of the Company is not set, please configure it first." msgstr "" #. module: intrastat_product -#: model:ir.model.fields,help:intrastat_product.field_sale_order_intrastat_transport_id +#: model:ir.model.fields,help:intrastat_product.field_sale_order__intrastat_transport_id msgid "This information is used in Intrastat reports" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_total_amount +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__total_amount msgid "Total Fiscal Amount" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_tree +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_tree msgid "Total amount" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_total_amount +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration__total_amount msgid "Total fiscal amount in company currency of the declaration." msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_computation_line_view_form +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_computation_line_view_form msgid "Transaction" msgstr "" @@ -1085,16 +1181,16 @@ msgid "Transaction Types" msgstr "" #. module: intrastat_product -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_computation_line_view_tree -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_computation_line_view_tree +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_form msgid "Transactions" msgstr "" #. module: intrastat_product #: code:addons/intrastat_product/report/intrastat_product_report_xls.py:167 -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_transport_id -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_transport_id -#: model:ir.model.fields,field_description:intrastat_product.field_sale_order_intrastat_transport_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__transport_id +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__transport_id +#: model:ir.model.fields,field_description:intrastat_product.field_sale_order__intrastat_transport_id #, python-format msgid "Transport Mode" msgstr "" @@ -1106,26 +1202,36 @@ msgid "Transport Modes" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_type -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_type -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_type -#: model:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_search +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__type +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__type +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__type +#: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_product_declaration_view_search msgid "Type" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_company_country_code +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__message_unread +msgid "Unread Messages" +msgstr "" + +#. module: intrastat_product +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__message_unread_counter +msgid "Unread Messages Counter" +msgstr "" + +#. module: intrastat_product +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration__company_country_code msgid "Used in views and methods of localization modules." msgstr "" #. module: intrastat_product -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_revision +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration__revision msgid "Used to keep track of changes" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_valid -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_valid +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__valid +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__valid msgid "Valid" msgstr "" @@ -1134,37 +1240,47 @@ msgstr "" msgid "Warehouse" msgstr "" +#. module: intrastat_product +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__website_message_ids +msgid "Website Messages" +msgstr "" + +#. module: intrastat_product +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration__website_message_ids +msgid "Website communication history" +msgstr "" + #. module: intrastat_product #: code:addons/intrastat_product/report/intrastat_product_report_xls.py:116 -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line_weight -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line_weight +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__weight +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_line__weight #, python-format msgid "Weight" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration_year +#: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__year msgid "Year" msgstr "" #. module: intrastat_product -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_year_month +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration__year_month msgid "Year and month of the declaration." msgstr "" #. module: intrastat_product -#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration_note +#: model:ir.model.fields,help:intrastat_product.field_intrastat_product_declaration__note msgid "You can add some comments here if you want." msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/models/intrastat_product_declaration.py:162 +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:148 #, python-format msgid "You must set company's country !" msgstr "" #. module: intrastat_product -#: code:addons/intrastat_product/report/intrastat_product_report_xls.py:239 +#: code:addons/intrastat_product/report/intrastat_product_report_xls.py:240 #, python-format msgid "for period %s" msgstr "" @@ -1174,8 +1290,3 @@ msgstr "" msgid "report.intrastat_product.product_declaration_xls" msgstr "" -#. module: intrastat_product -#: model:ir.model,name:intrastat_product.model_res_config_settings -msgid "res.config.settings" -msgstr "" - From 29a389d16ac90fd0f644f2b8ec4ea216b271a757 Mon Sep 17 00:00:00 2001 From: Daniel Duque Date: Mon, 3 Jun 2019 12:51:41 +0200 Subject: [PATCH 26/48] [FIX] Translations in intrastat_product --- intrastat_product/models/intrastat_product_declaration.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/intrastat_product/models/intrastat_product_declaration.py b/intrastat_product/models/intrastat_product_declaration.py index 6c1130d..d5af916 100644 --- a/intrastat_product/models/intrastat_product_declaration.py +++ b/intrastat_product/models/intrastat_product_declaration.py @@ -135,9 +135,9 @@ class IntrastatProductDeclaration(models.Model): @api.model def _get_action(self): return [ - ('replace', 'Replace'), - ('append', 'Append'), - ('nihil', 'Nihil')] + ('replace', _('Replace')), + ('append', _('Append')), + ('nihil', _('Nihil'))] @api.depends('company_id') def _compute_company_country_code(self): From a8b377e9bb83d10883f93f5d58c90d5291e5570d Mon Sep 17 00:00:00 2001 From: oca-travis Date: Wed, 5 Jun 2019 12:07:50 +0000 Subject: [PATCH 27/48] [UPD] Update intrastat_product.pot --- intrastat_product/i18n/intrastat_product.pot | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/intrastat_product/i18n/intrastat_product.pot b/intrastat_product/i18n/intrastat_product.pot index d92722b..ce36ddf 100644 --- a/intrastat_product/i18n/intrastat_product.pot +++ b/intrastat_product/i18n/intrastat_product.pot @@ -127,6 +127,12 @@ msgstr "" msgid "Amount in company currency to write in the declaration. Amount in company currency = amount in invoice currency converted to company currency with the rate of the invoice date." msgstr "" +#. module: intrastat_product +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:139 +#, python-format +msgid "Append" +msgstr "" + #. module: intrastat_product #: model_terms:ir.ui.view,arch_db:intrastat_product.intrastat_unit_search msgid "Archived" @@ -847,6 +853,12 @@ msgstr "" msgid "Net weight in Kg" msgstr "" +#. module: intrastat_product +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:140 +#, python-format +msgid "Nihil" +msgstr "" + #. module: intrastat_product #: code:addons/intrastat_product/report/intrastat_product_report_xls.py:240 #, python-format @@ -1012,6 +1024,12 @@ msgstr "" msgid "Related Transactions" msgstr "" +#. module: intrastat_product +#: code:addons/intrastat_product/models/intrastat_product_declaration.py:138 +#, python-format +msgid "Replace" +msgstr "" + #. module: intrastat_product #: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_computation_line__reporting_level #: model:ir.model.fields,field_description:intrastat_product.field_intrastat_product_declaration__reporting_level From b8a55b2f7d29c0bed90437326cb697c58db0d501 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Wed, 5 Jun 2019 21:16:27 +0200 Subject: [PATCH 28/48] [12.0][FIX]fix name_get on intrastat.transaction (#73) --- intrastat_product/models/intrastat_transaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intrastat_product/models/intrastat_transaction.py b/intrastat_product/models/intrastat_transaction.py index 5a63ba3..efa517f 100644 --- a/intrastat_product/models/intrastat_transaction.py +++ b/intrastat_product/models/intrastat_transaction.py @@ -29,5 +29,5 @@ class IntrastatTransaction(models.Model): if this.description: name += ' ' + this.description name = len(name) > 55 and name[:55] + '...' or name - res.append((this.id, this.name)) + res.append((this.id, name)) return res From 6dfbdba6705381d1227ef4d05d53a3c58d7e78cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?= Date: Sun, 16 Jun 2019 13:32:20 +0200 Subject: [PATCH 29/48] [FIX] intrastat_product USAGE.rst title level --- intrastat_product/readme/USAGE.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/intrastat_product/readme/USAGE.rst b/intrastat_product/readme/USAGE.rst index 11bac9d..66ec809 100644 --- a/intrastat_product/readme/USAGE.rst +++ b/intrastat_product/readme/USAGE.rst @@ -1,8 +1,7 @@ This module is used in combination with the country-specific localization module(s). -Coding guidelines for localization module: ------------------------------------------- +**Coding guidelines for localization module:** We recommend to start by copying an existing module, e.g. l10n_be_intrastat_product and adapt the code for the specific needs of your country. From c5d40c50a21c80a5a729ce0f2615e5cdd43b6315 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Sun, 16 Jun 2019 11:38:00 +0000 Subject: [PATCH 30/48] [UPD] README.rst --- intrastat_product/README.rst | 80 +-- .../static/description/index.html | 467 ++++++++++++++++++ 2 files changed, 519 insertions(+), 28 deletions(-) create mode 100644 intrastat_product/static/description/index.html diff --git a/intrastat_product/README.rst b/intrastat_product/README.rst index 8e769ea..92ef742 100644 --- a/intrastat_product/README.rst +++ b/intrastat_product/README.rst @@ -1,12 +1,31 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 - ================= Intrastat Product ================= -This module contains common objects and fields for the Intrastat Product reporting, such as the *H.S. codes* (if you are not familiar with H.S. codes, read `Wikipedia `) and the *country of origin* on the products. +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fintrastat--extrastat-lightgray.png?logo=github + :target: https://github.com/OCA/intrastat-extrastat/tree/12.0/intrastat_product + :alt: OCA/intrastat-extrastat +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/intrastat-extrastat-12-0/intrastat-extrastat-12-0-intrastat_product + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/227/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module contains common objects and fields for the Intrastat Product reporting. It should be used in combination with country-specific Intrastat Product reporting modules such as: @@ -18,14 +37,15 @@ such as: These country-specific modules can be found in the OCA localization for those countries. +**Table of contents** + +.. contents:: + :local: + Installation ============ -WARNING: - -This module conflicts with the module *report_intrastat* from the official addons. -If you have already installed the module *report_intrastat*, -you should uninstall it before installing this module. +This module is NOT compatible with the *account_intrastat* module from Odoo Enterprise. Usage ===== @@ -33,8 +53,7 @@ Usage This module is used in combination with the country-specific localization module(s). -Coding guidelines for localization module: ------------------------------------------- +**Coding guidelines for localization module:** We recommend to start by copying an existing module, e.g. l10n_be_intrastat_product and adapt the code for the specific needs of your country. @@ -65,40 +84,45 @@ and adapt the code for the specific needs of your country. Cf. l10n_be_istrastat_product as example, replace "be" by your Country Code. - -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/227/10.0 - Bug Tracker =========== -Bugs are tracked on `GitHub 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. +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= +Authors +~~~~~~~ + +* brain-tec AG +* Akretion +* Noviat + Contributors ------------- +~~~~~~~~~~~~ * Alexis de Lattre, Akretion * Luc De Meyer, Noviat -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - 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. -To contribute to this module, please visit https://odoo-community.org. +This module is part of the `OCA/intrastat-extrastat `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/intrastat_product/static/description/index.html b/intrastat_product/static/description/index.html new file mode 100644 index 0000000..a9c6df3 --- /dev/null +++ b/intrastat_product/static/description/index.html @@ -0,0 +1,467 @@ + + + + + + +Intrastat Product + + + +
+

Intrastat Product

+ + +

Beta License: AGPL-3 OCA/intrastat-extrastat Translate me on Weblate Try me on Runbot

+

This module contains common objects and fields for the Intrastat Product reporting.

+

It should be used in combination with country-specific Intrastat Product reporting modules +such as:

+
    +
  • l10n_fr_intrastat_product: +the module for the Déclaration d’Echange de Biens (DEB) for France
  • +
  • l10n_be_intrastat_product: +the module for the Intrastat Product Declaration for Belgium
  • +
+

These country-specific modules can be found in the OCA localization for those countries.

+

Table of contents

+ +
+

Installation

+

This module is NOT compatible with the account_intrastat module from Odoo Enterprise.

+
+
+

Usage

+

This module is used in combination with the country-specific +localization module(s).

+

Coding guidelines for localization module:

+

We recommend to start by copying an existing module, e.g. l10n_be_intrastat_product +and adapt the code for the specific needs of your country.

+
    +
  • Declaration Object

    +

    Create a new class as follows:

    +
    +class L10nCcIntrastatProductDeclaration(models.Model):
    +    _name = 'l10n.cc.intrastat.product.declaration'
    +    _description = "Intrastat Product Declaration for YourCountry"
    +    _inherit = ['intrastat.product.declaration', 'mail.thread']
    +
    +

    whereby cc = your country code

    +
  • +
  • Computation & Declaration Lines

    +

    Create also new objects inheriting from the Computation and Declaration Line Objects +so that you can add methods or customise the methods from the base modules (make a PR when +the customization or new method is required for multiple countries).

    +

    Adapt also the parent_id fields of the newly created objects +(cf. l10n_be_intrastat_product as example).

    +
  • +
  • XML Files: Menu, Action, Views

    +

    Cf. l10n_be_istrastat_product as example, replace “be” by your Country Code.

    +
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • brain-tec AG
  • +
  • Akretion
  • +
  • Noviat
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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/intrastat-extrastat project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + From ba3cf5199bf5cedafe38be13e965684f3822162b Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 29 Jul 2019 02:57:22 +0000 Subject: [PATCH 31/48] [UPD] README.rst --- intrastat_product/static/description/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intrastat_product/static/description/index.html b/intrastat_product/static/description/index.html index a9c6df3..6312b6b 100644 --- a/intrastat_product/static/description/index.html +++ b/intrastat_product/static/description/index.html @@ -3,7 +3,7 @@ - + Intrastat Product + + +
+

Generic Intrastat Product Declaration

+ + +

Beta License: AGPL-3 OCA/intrastat-extrastat Translate me on Weblate Try me on Runbot

+

This module adds a menu entry for a Generic Intrastat Product Declaration. +This is useful to cover countries for which there is no localization module.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Noviat
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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/intrastat-extrastat project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + From b325f3eb6b21a3f89322cb8c425051c6c05d15d9 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 29 Jul 2019 02:57:22 +0000 Subject: [PATCH 43/48] [UPD] README.rst --- intrastat_product_generic/static/description/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intrastat_product_generic/static/description/index.html b/intrastat_product_generic/static/description/index.html index 329d7a2..0134a71 100644 --- a/intrastat_product_generic/static/description/index.html +++ b/intrastat_product_generic/static/description/index.html @@ -3,7 +3,7 @@ - + Generic Intrastat Product Declaration