Add module intrastat_product. Rename report.intrastat.product to l10n.fr.report.intrastat.product (same for service and for lines) + migration scripts

This commit is contained in:
Alexis de Lattre
2014-11-28 23:51:23 +01:00
committed by Alexis de Lattre
parent 2e3f94bba0
commit 505eb69420
8 changed files with 431 additions and 1 deletions

View File

@@ -52,5 +52,4 @@ Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for
],
'demo': ['intrastat_demo.xml'],
'installable': True,
'active': False,
}

View File

@@ -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 <alexis.delattre@akretion.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 <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import intrastat

View File

@@ -0,0 +1,46 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Intrastat Product module for OpenERP
# Copyright (C) 2011-2014 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.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 <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'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
<alexis.delattre@akretion.com>
""",
'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,
}

View File

@@ -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 ""

View File

@@ -0,0 +1,84 @@
# -*- 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 <alexis.delattre@akretion.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 <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import models, fields, api, _
from openerp.exceptions import Warning
class ReportIntrastatCode(models.Model):
_name = "report.intrastat.code"
_description = "H.S. Code"
_order = "name"
name = fields.Char(
string='H.S. code', required=True,
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")
@api.multi
@api.depends('name', 'description')
def name_get(self):
res = []
for code in self:
name = code.name
if code.description:
name = u'%s %s' % (name, code.description)
res.append((code.id, name))
return res
@api.constrains('name')
def _hs_code(self):
if self.name and not self.name.isdigit():
raise Warning(
_("H.S. codes should only contain digits. It is not the case "
"of H.S. code '%s'.") % self.name)
_sql_constraints = [(
'hs_code_uniq',
'unique(name)',
'This H.S. code already exists in Odoo !'
)]
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.")
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.")

View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2011-2014 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data noupdate="1">
<record id="84715000" model="report.intrastat.code">
<field name="name">84715000</field>
<field name="description">Automatic data-processing machines (computers)</field>
</record>
<record id="84717050" model="report.intrastat.code">
<field name="name">84717050</field>
<field name="description">Storage units</field>
</record>
<record id="85340090" model="report.intrastat.code">
<field name="name">85340090</field>
<field name="description">Printed circuits</field>
</record>
<record id="product.product_product_3" model="product.product">
<field name="intrastat_id" ref="84715000" />
</record>
<record id="product.product_product_4" model="product.product">
<field name="intrastat_id" ref="84715000" />
</record>
<record id="product.product_product_5" model="product.product">
<field name="intrastat_id" ref="84715000" />
</record>
<record id="product.product_product_25" model="product.product">
<field name="intrastat_id" ref="84715000" />
</record>
<record id="product.product_product_17" model="product.product">
<field name="intrastat_id" ref="84717050" />
</record>
<record id="product.product_product_18" model="product.product">
<field name="intrastat_id" ref="84717050" />
</record>
<record id="product.product_product_19" model="product.product">
<field name="intrastat_id" ref="84717050" />
</record>
<record id="product.product_product_20" model="product.product">
<field name="intrastat_id" ref="85340090" />
</record>
<record id="product.product_product_21" model="product.product">
<field name="intrastat_id" ref="85340090" />
</record>
</data>
</openerp>

View File

@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2010-2014 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<!-- product.template form view -->
<record id="product_template_form_view" model="ir.ui.view">
<field name="name">intrastat.product.template.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="intrastat_base.product_template_form_view" />
<field name="arch" type="xml">
<field name="exclude_from_intrastat" position="before">
<field name="intrastat_id" attrs="{'invisible': [('type', '=', 'service')]}"/>
</field>
</field>
</record>
<!-- Product category form view -->
<record id="product_category_form_view" model="ir.ui.view">
<field name="name">intrastat.product.category.form</field>
<field name="model">product.category</field>
<field name="inherit_id" ref="product.product_category_form_view"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='parent']" position="inside">
<group name="intrastat" string="Intrastat Properties" colspan="2">
<field name="intrastat_id" />
</group>
</xpath>
</field>
</record>
<!-- Add search view for H.S. code -->
<record id="product_intrastat_code_search" model="ir.ui.view">
<field name="name">intrastat.product.intrastat.code.search</field>
<field name="model">report.intrastat.code</field>
<field name="arch" type="xml">
<search string="Search Intrastat Codes">
<field name="name"
filter_domain="['|', ('name', 'like', self), ('description', 'ilike', self)]"/>
</search>
</field>
</record>
<!-- Add tree view for H.S. code -->
<record id="product_intrastat_code_tree" model="ir.ui.view">
<field name="name">intrastat.product.intrastat.code.tree</field>
<field name="model">report.intrastat.code</field>
<field name="arch" type="xml">
<tree string="Intrastat Codes">
<field name="name"/>
<field name="description"/>
</tree>
</field>
</record>
<!-- Add form view for H.S. code -->
<record id="product_intrastat_code_form" model="ir.ui.view">
<field name="name">fr.intrastat.product.intrastat.code.form</field>
<field name="model">report.intrastat.code</field>
<field name="arch" type="xml">
<form string="Intrastat Code">
<group name="main">
<field name="name" />
<field name="description" />
</group>
</form>
</field>
</record>
<!-- Action for H.S. code -->
<record id="product_intrastat_code_act" model="ir.actions.act_window">
<field name="name">Intrastat Code</field>
<field name="res_model">report.intrastat.code</field>
<field name="view_mode">tree,form</field>
</record>
<!-- Menu entry for H.S. code -->
<menuitem id="product_intrastat_code_menu"
action="product_intrastat_code_act"
parent="product.prod_config_main" />
</data>
</openerp>

View File

@@ -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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 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
3 access_report_intrastat_code_employee Read access on report.intrastat.code to employee model_report_intrastat_code base.group_user 1 0 0 0