Merge lp:~akretion-team/new-report-intrastat/8.0-add-intrastat-product into lp:new-report-intrastat

Proposed by Alexis de Lattre
Status: Merged
Merged at revision: 97
Proposed branch: lp:~akretion-team/new-report-intrastat/8.0-add-intrastat-product
Merge into: lp:new-report-intrastat
Diff against target: 1703 lines (+748/-413)
24 files modified
intrastat_base/__openerp__.py (+0/-1)
intrastat_product/__init__.py (+23/-0)
intrastat_product/__openerp__.py (+46/-0)
intrastat_product/i18n/intrastat_product.pot (+122/-0)
intrastat_product/intrastat.py (+113/-0)
intrastat_product/intrastat_demo.xml (+88/-0)
intrastat_product/intrastat_view.xml (+95/-0)
intrastat_product/security/ir.model.access.csv (+3/-0)
l10n_fr_intrastat_product/__openerp__.py (+2/-3)
l10n_fr_intrastat_product/intrastat_demo.xml (+0/-74)
l10n_fr_intrastat_product/intrastat_product.py (+23/-23)
l10n_fr_intrastat_product/intrastat_product_reminder.xml (+4/-4)
l10n_fr_intrastat_product/intrastat_product_view.xml (+19/-17)
l10n_fr_intrastat_product/migrations/8.0.1.2/pre-migration.py (+57/-0)
l10n_fr_intrastat_product/product.py (+40/-151)
l10n_fr_intrastat_product/product_view.xml (+7/-90)
l10n_fr_intrastat_product/security/intrastat_product_security.xml (+2/-2)
l10n_fr_intrastat_product/security/ir.model.access.csv (+5/-7)
l10n_fr_intrastat_service/__openerp__.py (+1/-2)
l10n_fr_intrastat_service/intrastat_service.py (+15/-15)
l10n_fr_intrastat_service/intrastat_service_view.xml (+19/-17)
l10n_fr_intrastat_service/migrations/8.0.1.2/pre-migration.py (+57/-0)
l10n_fr_intrastat_service/security/intrastat_service_security.xml (+4/-4)
l10n_fr_intrastat_service/security/ir.model.access.csv (+3/-3)
To merge this branch: bzr merge lp:~akretion-team/new-report-intrastat/8.0-add-intrastat-product
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp (community) tested intrastat_product / code review Approve
New report intrastat commiters Pending
Review via email: mp+243195@code.launchpad.net

Description of the change

Add module intrastat_product as discussed with Luc de Meyer.

Rename report_intrastat_product to l10n_fr_report_intrastat_product, so that it's clean that this object is France-specific and don't risk any collision with modules from other countries. Migrations scripts are provided.

To post a comment you must log in.
98. By Alexis de Lattre

Rename field country_id to origin_country_id (TODO : write mig script) and move this field from l10n_fr_intrastat_product to intrastat_product

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Thanks for your work, it's great that you made a module agnostic to the country.
I added comments regarding the new API, and I will test your module.

99. By Alexis de Lattre

Take into accout the remarks of Guewen

100. By Alexis de Lattre

Move intrastat_code and uom_id of report.intrastat.code from l10n_fr_intrastat_product to intrastat_product, as discussed with Luc de Meyer

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

LGTM

review: Approve (tested intrastat_product / code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'intrastat_base/__openerp__.py'
--- intrastat_base/__openerp__.py 2014-03-09 08:29:59 +0000
+++ intrastat_base/__openerp__.py 2014-12-13 00:30:09 +0000
@@ -52,5 +52,4 @@
52 ],52 ],
53 'demo': ['intrastat_demo.xml'],53 'demo': ['intrastat_demo.xml'],
54 'installable': True,54 'installable': True,
55 'active': False,
56}55}
5756
=== added directory 'intrastat_product'
=== added file 'intrastat_product/__init__.py'
--- intrastat_product/__init__.py 1970-01-01 00:00:00 +0000
+++ intrastat_product/__init__.py 2014-12-13 00:30:09 +0000
@@ -0,0 +1,23 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Intrastat product module for OpenERP
5# Copyright (C) 2011-2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from . import intrastat
024
=== added file 'intrastat_product/__openerp__.py'
--- intrastat_product/__openerp__.py 1970-01-01 00:00:00 +0000
+++ intrastat_product/__openerp__.py 2014-12-13 00:30:09 +0000
@@ -0,0 +1,46 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Intrastat Product module for OpenERP
5# Copyright (C) 2011-2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23
24{
25 'name': 'Intrastat Product',
26 'version': '1.1',
27 'category': 'Localisation/Report Intrastat',
28 'license': 'AGPL-3',
29 'summary': 'Base module for Intrastat Product',
30 'description': """
31This module contains the common objects for the Intrastat Product.
32This module is country-independant.
33
34This module has been written by Alexis de Lattre from Akretion
35<alexis.delattre@akretion.com>
36 """,
37 'author': 'Akretion',
38 'website': 'http://www.akretion.com',
39 'depends': ['intrastat_base'],
40 'data': [
41 'intrastat_view.xml',
42 'security/ir.model.access.csv',
43 ],
44 'demo': ['intrastat_demo.xml'],
45 'installable': True,
46}
047
=== added directory 'intrastat_product/i18n'
=== added file 'intrastat_product/i18n/intrastat_product.pot'
--- intrastat_product/i18n/intrastat_product.pot 1970-01-01 00:00:00 +0000
+++ intrastat_product/i18n/intrastat_product.pot 2014-12-13 00:30:09 +0000
@@ -0,0 +1,122 @@
1# Translation of Odoo Server.
2# This file contains the translation of the following modules:
3# * intrastat_product
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: Odoo Server 8.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-11-28 22:48+0000\n"
10"PO-Revision-Date: 2014-11-28 22:48+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#. module: intrastat_product
19#: help:product.category,intrastat_id:0
20msgid "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."
21msgstr ""
22
23#. module: intrastat_product
24#: help:product.template,intrastat_id:0
25msgid "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."
26msgstr ""
27
28#. module: intrastat_product
29#: field:report.intrastat.code,create_uid:0
30msgid "Created by"
31msgstr ""
32
33#. module: intrastat_product
34#: field:report.intrastat.code,create_date:0
35msgid "Created on"
36msgstr ""
37
38#. module: intrastat_product
39#: field:report.intrastat.code,description:0
40msgid "Description"
41msgstr ""
42
43#. module: intrastat_product
44#: help:report.intrastat.code,name:0
45msgid "Full length Harmonized System code (digits only). Full list is available from the World Customs Organisation, see http://www.wcoomd.org"
46msgstr ""
47
48#. module: intrastat_product
49#: model:ir.model,name:intrastat_product.model_report_intrastat_code
50msgid "H.S. Code"
51msgstr ""
52
53#. module: intrastat_product
54#: field:report.intrastat.code,name:0
55msgid "H.S. code"
56msgstr ""
57
58#. module: intrastat_product
59#: code:addons/intrastat_product/intrastat.py:56
60#, python-format
61msgid "H.S. codes should only contain digits. It is not the case of H.S. code '%s'."
62msgstr ""
63
64#. module: intrastat_product
65#: field:report.intrastat.code,id:0
66msgid "ID"
67msgstr ""
68
69#. module: intrastat_product
70#: model:ir.actions.act_window,name:intrastat_product.product_intrastat_code_act
71#: model:ir.ui.menu,name:intrastat_product.product_intrastat_code_menu
72#: field:product.category,intrastat_id:0
73#: field:product.template,intrastat_id:0
74#: view:report.intrastat.code:intrastat_product.product_intrastat_code_form
75msgid "Intrastat Code"
76msgstr ""
77
78#. module: intrastat_product
79#: view:report.intrastat.code:intrastat_product.product_intrastat_code_tree
80msgid "Intrastat Codes"
81msgstr ""
82
83#. module: intrastat_product
84#: view:product.category:intrastat_product.product_category_form_view
85msgid "Intrastat Properties"
86msgstr ""
87
88#. module: intrastat_product
89#: field:report.intrastat.code,write_uid:0
90msgid "Last Updated by"
91msgstr ""
92
93#. module: intrastat_product
94#: field:report.intrastat.code,write_date:0
95msgid "Last Updated on"
96msgstr ""
97
98#. module: intrastat_product
99#: model:ir.model,name:intrastat_product.model_product_category
100msgid "Product Category"
101msgstr ""
102
103#. module: intrastat_product
104#: model:ir.model,name:intrastat_product.model_product_template
105msgid "Product Template"
106msgstr ""
107
108#. module: intrastat_product
109#: view:report.intrastat.code:intrastat_product.product_intrastat_code_search
110msgid "Search Intrastat Codes"
111msgstr ""
112
113#. module: intrastat_product
114#: help:report.intrastat.code,description:0
115msgid "Short text description of the H.S. category"
116msgstr ""
117
118#. module: intrastat_product
119#: sql_constraint:report.intrastat.code:0
120msgid "This H.S. code already exists in Odoo !"
121msgstr ""
122
0123
=== added file 'intrastat_product/intrastat.py'
--- intrastat_product/intrastat.py 1970-01-01 00:00:00 +0000
+++ intrastat_product/intrastat.py 2014-12-13 00:30:09 +0000
@@ -0,0 +1,113 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Intrastat Product module for OpenERP
5# Copyright (C) 2004-2009 Tiny SPRL (http://tiny.be)
6# Copyright (C) 2010-2014 Akretion (http://www.akretion.com)
7# @author Alexis de Lattre <alexis.delattre@akretion.com>
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU Affero General Public License as
11# published by the Free Software Foundation, either version 3 of the
12# License, or (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU Affero General Public License for more details.
18#
19# You should have received a copy of the GNU Affero General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21#
22##############################################################################
23
24from openerp import models, fields, api, _
25from openerp.exceptions import ValidationError
26
27
28class ReportIntrastatCode(models.Model):
29 _name = "report.intrastat.code"
30 _description = "H.S. Code"
31 _order = "name"
32
33 name = fields.Char(
34 string='H.S. code',
35 help="Full length Harmonized System code (digits only). Full list is "
36 "available from the World Customs Organisation, see "
37 "http://www.wcoomd.org")
38 description = fields.Char(
39 'Description', help="Short text description of the H.S. category")
40 intrastat_code = fields.Char(
41 string='European Intrastat Code', size=9, required=True,
42 help="Code used for the Intrastat declaration. Must be part "
43 "of the 'Combined Nomenclature' (CN), cf "
44 "http://en.wikipedia.org/wiki/Combined_Nomenclature"
45 "Must have 8 digits with sometimes a 9th digit.")
46 intrastat_uom_id = fields.Many2one(
47 'product.uom', string='UoM for Intrastat Report',
48 help="Select the unit of measure if one is required for "
49 "this particular Intrastat Code (other than the weight in Kg). "
50 "If no particular unit of measure is required, leave empty.")
51 active = fields.Boolean(default=True)
52
53 @api.multi
54 def name_get(self):
55 res = []
56 for code in self:
57 name = code.name
58 if code.description:
59 name = u'%s %s' % (name, code.description)
60 res.append((code.id, name))
61 return res
62
63 @api.constrains('name', 'intrastat_code')
64 def _hs_code(self):
65 if self.name and not self.name.isdigit():
66 raise ValidationError(
67 _("H.S. codes should only contain digits. It is not the case "
68 "of H.S. code '%s'.") % self.name)
69 if self.intrastat_code and not self.intrastat_code.isdigit():
70 raise ValidationError(
71 _("The field Intrastat Code should only contain digits. "
72 "It is not the case of Intrastat Code '%s'.")
73 % self.intrastat_code)
74 if self.intrastat_code and len(self.intrastat_code) not in (8, 9):
75 raise ValidationError(
76 _("The field Intrastat Code should "
77 "contain 8 or 9 digits. It is not the case of "
78 "Intrastat Code '%s'.")
79 % self.intrastat_code)
80
81 _sql_constraints = [(
82 'hs_code_uniq',
83 'unique(name)',
84 'This H.S. code already exists in Odoo !'
85 )]
86
87
88class ProductTemplate(models.Model):
89 _inherit = "product.template"
90
91 intrastat_id = fields.Many2one(
92 'report.intrastat.code', string='Intrastat Code',
93 help="Code from the Harmonised System. Nomenclature is "
94 "available from the World Customs Organisation, see "
95 "http://www.wcoomd.org/. Some countries have made their own "
96 "extensions to this nomenclature.")
97 origin_country_id = fields.Many2one(
98 'res.country', string='Country of Origin',
99 help="Country of origin of the product i.e. product "
100 "'made in ____'. If you have different countries of origin "
101 "depending on the supplier from which you purchased the product, "
102 "leave this field empty and use the equivalent field on the "
103 "'product supplier info' form.")
104
105
106class ProductCategory(models.Model):
107 _inherit = "product.category"
108
109 intrastat_id = fields.Many2one(
110 'report.intrastat.code', string='Intrastat Code',
111 help="Code from the Harmonised System. If this code is not "
112 "set on the product itself, it will be read here, on the "
113 "related product category.")
0114
=== added file 'intrastat_product/intrastat_demo.xml'
--- intrastat_product/intrastat_demo.xml 1970-01-01 00:00:00 +0000
+++ intrastat_product/intrastat_demo.xml 2014-12-13 00:30:09 +0000
@@ -0,0 +1,88 @@
1<?xml version="1.0" encoding="utf-8"?>
2
3<!--
4 Copyright (C) 2011-2014 Akretion (http://www.akretion.com/)
5 @author Alexis de Lattre <alexis.delattre@akretion.com>
6 The licence is in the file __openerp__.py
7-->
8
9<openerp>
10<data noupdate="1">
11
12<record id="84715000" model="report.intrastat.code">
13 <field name="name">84715000</field>
14 <field name="intrastat_code">84715000</field>
15 <field name="intrastat_uom_id" ref="product.product_uom_unit"/>
16 <field name="description">Automatic data-processing machines (computers)</field>
17</record>
18
19<record id="84717050" model="report.intrastat.code">
20 <field name="name">84717050</field>
21 <field name="intrastat_code">84717050</field>
22 <field name="intrastat_uom_id" ref="product.product_uom_unit"/>
23 <field name="description">Storage units</field>
24</record>
25
26<record id="85340090" model="report.intrastat.code">
27 <field name="name">85340090</field>
28 <field name="intrastat_code">85340090</field>
29 <field name="description">Printed circuits</field>
30</record>
31
32<record id="product.product_product_3" model="product.product">
33 <field name="intrastat_id" ref="84715000" />
34 <field name="origin_country_id" ref="base.tw" />
35 <field name="weight_net">5</field>
36</record>
37
38<record id="product.product_product_4" model="product.product">
39 <field name="intrastat_id" ref="84715000" />
40 <field name="origin_country_id" ref="base.cn" />
41 <field name="weight_net">6</field>
42</record>
43
44<record id="product.product_product_5" model="product.product">
45 <field name="intrastat_id" ref="84715000" />
46 <field name="origin_country_id" ref="base.cn" />
47 <field name="weight_net">6.5</field>
48</record>
49
50<record id="product.product_product_17" model="product.product">
51 <field name="intrastat_id" ref="84717050" />
52 <field name="origin_country_id" ref="base.sg" />
53 <field name="weight_net">0.5</field>
54</record>
55
56<record id="product.product_product_18" model="product.product">
57 <field name="intrastat_id" ref="84717050" />
58 <field name="origin_country_id" ref="base.sg" />
59 <field name="weight_net">0.5</field>
60</record>
61
62<record id="product.product_product_19" model="product.product">
63 <field name="intrastat_id" ref="84717050" />
64 <field name="origin_country_id" ref="base.sg" />
65 <field name="weight_net">0.5</field>
66</record>
67
68<record id="product.product_product_20" model="product.product">
69 <field name="intrastat_id" ref="85340090" />
70 <field name="origin_country_id" ref="base.tw" />
71 <field name="weight_net">0.7</field>
72</record>
73
74<record id="product.product_product_21" model="product.product">
75 <field name="intrastat_id" ref="85340090" />
76 <field name="origin_country_id" ref="base.tw" />
77 <field name="weight_net">0.8</field>
78</record>
79
80<record id="product.product_product_25" model="product.product">
81 <field name="intrastat_id" ref="84715000" />
82 <field name="origin_country_id" ref="base.be" />
83 <field name="weight_net">2</field>
84</record>
85
86
87</data>
88</openerp>
089
=== added file 'intrastat_product/intrastat_view.xml'
--- intrastat_product/intrastat_view.xml 1970-01-01 00:00:00 +0000
+++ intrastat_product/intrastat_view.xml 2014-12-13 00:30:09 +0000
@@ -0,0 +1,95 @@
1<?xml version="1.0" encoding="utf-8"?>
2
3<!--
4 Copyright (C) 2010-2014 Akretion (http://www.akretion.com/)
5 @author Alexis de Lattre <alexis.delattre@akretion.com>
6 The licence is in the file __openerp__.py
7-->
8
9<openerp>
10<data>
11
12<!-- product.template form view -->
13<record id="product_template_form_view" model="ir.ui.view">
14 <field name="name">intrastat.product.template.form</field>
15 <field name="model">product.template</field>
16 <field name="inherit_id" ref="intrastat_base.product_template_form_view" />
17 <field name="arch" type="xml">
18 <field name="exclude_from_intrastat" position="before">
19 <field name="intrastat_id" attrs="{'invisible': [('type', '=', 'service')]}"/>
20 <field name="origin_country_id" attrs="{'invisible': [('type', '=', 'service')]}"/>
21 </field>
22 </field>
23</record>
24
25<!-- Product category form view -->
26<record id="product_category_form_view" model="ir.ui.view">
27 <field name="name">intrastat.product.category.form</field>
28 <field name="model">product.category</field>
29 <field name="inherit_id" ref="product.product_category_form_view"/>
30 <field name="arch" type="xml">
31 <xpath expr="//group[@name='parent']" position="inside">
32 <group name="intrastat" string="Intrastat Properties" colspan="2">
33 <field name="intrastat_id" />
34 </group>
35 </xpath>
36 </field>
37</record>
38
39<!-- Add search view for H.S. code -->
40<record id="product_intrastat_code_search" model="ir.ui.view">
41 <field name="name">intrastat.product.intrastat.code.search</field>
42 <field name="model">report.intrastat.code</field>
43 <field name="arch" type="xml">
44 <search string="Search Intrastat Codes">
45 <field name="name"
46 filter_domain="['|', '|', ('name', 'like', self), ('intrastat_code', 'like', self), ('description', 'ilike', self)]"/>
47 </search>
48 </field>
49</record>
50
51<!-- Add tree view for H.S. code -->
52<record id="product_intrastat_code_tree" model="ir.ui.view">
53 <field name="name">intrastat.product.intrastat.code.tree</field>
54 <field name="model">report.intrastat.code</field>
55 <field name="arch" type="xml">
56 <tree string="Intrastat Codes">
57 <field name="name"/>
58 <field name="intrastat_code" />
59 <field name="intrastat_uom_id"/>
60 <field name="description"/>
61 </tree>
62 </field>
63</record>
64
65<!-- Add form view for H.S. code -->
66<record id="product_intrastat_code_form" model="ir.ui.view">
67 <field name="name">fr.intrastat.product.intrastat.code.form</field>
68 <field name="model">report.intrastat.code</field>
69 <field name="arch" type="xml">
70 <form string="Intrastat Code">
71 <group name="main">
72 <field name="name" />
73 <field name="intrastat_code"/>
74 <field name="intrastat_uom_id"/>
75 <field name="description" />
76 <field name="active"/>
77 </group>
78 </form>
79 </field>
80</record>
81
82<!-- Action for H.S. code -->
83<record id="product_intrastat_code_act" model="ir.actions.act_window">
84 <field name="name">Intrastat Code</field>
85 <field name="res_model">report.intrastat.code</field>
86 <field name="view_mode">tree,form</field>
87</record>
88
89<!-- Menu entry for H.S. code -->
90<menuitem id="product_intrastat_code_menu"
91 action="product_intrastat_code_act"
92 parent="product.prod_config_main" />
93
94</data>
95</openerp>
096
=== added directory 'intrastat_product/security'
=== added file 'intrastat_product/security/ir.model.access.csv'
--- intrastat_product/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
+++ intrastat_product/security/ir.model.access.csv 2014-12-13 00:30:09 +0000
@@ -0,0 +1,3 @@
1id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2access_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
3access_report_intrastat_code_employee,Read access on report.intrastat.code to employee,model_report_intrastat_code,base.group_user,1,0,0,0
04
=== modified file 'l10n_fr_intrastat_product/__openerp__.py'
--- l10n_fr_intrastat_product/__openerp__.py 2014-07-03 22:18:44 +0000
+++ l10n_fr_intrastat_product/__openerp__.py 2014-12-13 00:30:09 +0000
@@ -23,7 +23,7 @@
2323
24{24{
25 'name': 'France Intrastat Product',25 'name': 'France Intrastat Product',
26 'version': '1.1',26 'version': '1.2',
27 'category': 'Localisation/Report Intrastat',27 'category': 'Localisation/Report Intrastat',
28 'license': 'AGPL-3',28 'license': 'AGPL-3',
29 'summary': 'Module for Intrastat product reporting (DEB) for France',29 'summary': 'Module for Intrastat product reporting (DEB) for France',
@@ -35,7 +35,7 @@
35 """,35 """,
36 'author': 'Akretion',36 'author': 'Akretion',
37 'website': 'http://www.akretion.com',37 'website': 'http://www.akretion.com',
38 'depends': ['intrastat_base', 'sale_stock', 'purchase', 'l10n_fr_siret'],38 'depends': ['intrastat_product', 'sale_stock', 'purchase', 'l10n_fr_siret'],
39 'data': [39 'data': [
40 'security/intrastat_product_security.xml',40 'security/intrastat_product_security.xml',
41 'security/ir.model.access.csv',41 'security/ir.model.access.csv',
@@ -51,6 +51,5 @@
51 ],51 ],
52 'demo': ['intrastat_demo.xml'],52 'demo': ['intrastat_demo.xml'],
53 'installable': True,53 'installable': True,
54 'active': False,
55 'application': True,54 'application': True,
56}55}
5756
=== modified file 'l10n_fr_intrastat_product/intrastat_demo.xml'
--- l10n_fr_intrastat_product/intrastat_demo.xml 2014-10-30 12:30:41 +0000
+++ l10n_fr_intrastat_product/intrastat_demo.xml 2014-12-13 00:30:09 +0000
@@ -21,84 +21,10 @@
21 <field name="country_id" ref="base.fr"/>21 <field name="country_id" ref="base.fr"/>
22</record>22</record>
2323
24<record id="84715000" model="report.intrastat.code">
25 <field name="name">84715000</field>
26 <field name="description">Automatic data-processing machines (computers)</field>
27 <field name="intrastat_code">84715000</field>
28 <field name="intrastat_uom_id" ref="product.product_uom_unit"/>
29</record>
30
31<record id="84717050" model="report.intrastat.code">
32 <field name="name">84717050</field>
33 <field name="description">Storage units</field>
34 <field name="intrastat_code">84717050</field>
35 <field name="intrastat_uom_id" ref="product.product_uom_unit"/>
36</record>
37
38<record id="85340090" model="report.intrastat.code">
39 <field name="name">85340090</field>
40 <field name="description">Printed circuits</field>
41 <field name="intrastat_code">85340090</field>
42</record>
43
44<record id="product.product_uom_unit" model="product.uom">24<record id="product.product_uom_unit" model="product.uom">
45 <field name="intrastat_label">PCE</field>25 <field name="intrastat_label">PCE</field>
46</record>26</record>
4727
48<record id="product.product_product_3" model="product.product">
49 <field name="country_id" ref="base.tw" />
50 <field name="intrastat_id" ref="84715000" />
51 <field name="weight_net">5</field>
52</record>
53
54<record id="product.product_product_4" model="product.product">
55 <field name="country_id" ref="base.cn" />
56 <field name="intrastat_id" ref="84715000" />
57 <field name="weight_net">6</field>
58</record>
59
60<record id="product.product_product_5" model="product.product">
61 <field name="country_id" ref="base.cn" />
62 <field name="intrastat_id" ref="84715000" />
63 <field name="weight_net">6</field>
64</record>
65
66<record id="product.product_product_25" model="product.product">
67 <field name="country_id" ref="base.be" />
68 <field name="intrastat_id" ref="84715000" />
69 <field name="weight_net">2</field>
70</record>
71
72<record id="product.product_product_17" model="product.product">
73 <field name="country_id" ref="base.sg" />
74 <field name="intrastat_id" ref="84717050" />
75 <field name="weight_net">0.5</field>
76</record>
77
78<record id="product.product_product_18" model="product.product">
79 <field name="country_id" ref="base.sg" />
80 <field name="intrastat_id" ref="84717050" />
81 <field name="weight_net">0.5</field>
82</record>
83
84<record id="product.product_product_19" model="product.product">
85 <field name="country_id" ref="base.sg" />
86 <field name="intrastat_id" ref="84717050" />
87 <field name="weight_net">0.5</field>
88</record>
89
90<record id="product.product_product_20" model="product.product">
91 <field name="country_id" ref="base.tw" />
92 <field name="intrastat_id" ref="85340090" />
93 <field name="weight_net">0.7</field>
94</record>
95
96<record id="product.product_product_21" model="product.product">
97 <field name="country_id" ref="base.tw" />
98 <field name="intrastat_id" ref="85340090" />
99 <field name="weight_net">0.8</field>
100</record>
101
102<!-- Elec import is the fiscal rep of Asustek -->28<!-- Elec import is the fiscal rep of Asustek -->
103<record id="base.res_partner_1" model="res.partner">29<record id="base.res_partner_1" model="res.partner">
104 <field name="intrastat_fiscal_representative" ref="base.res_partner_2" />30 <field name="intrastat_fiscal_representative" ref="base.res_partner_2" />
10531
=== modified file 'l10n_fr_intrastat_product/intrastat_product.py'
--- l10n_fr_intrastat_product/intrastat_product.py 2014-10-30 12:30:41 +0000
+++ l10n_fr_intrastat_product/intrastat_product.py 2014-12-13 00:30:09 +0000
@@ -32,15 +32,15 @@
32logger = logging.getLogger(__name__)32logger = logging.getLogger(__name__)
3333
3434
35class report_intrastat_product(orm.Model):35class l10n_fr_report_intrastat_product(orm.Model):
36 _name = "report.intrastat.product"36 _name = "l10n.fr.report.intrastat.product"
37 _description = "Intrastat Product"37 _description = "Intrastat Product for France (DEB)"
38 _rec_name = "start_date"38 _rec_name = "start_date"
39 _inherit = ['mail.thread']39 _inherit = ['mail.thread']
40 _order = "start_date desc, type"40 _order = "start_date desc, type"
41 _track = {41 _track = {
42 'state': {42 'state': {
43 'l10n_fr_intrastat_product.declaration_done': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done',43 'l10n_fr_intrastat_product.l10n_fr_declaration_done': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done',
44 }44 }
45 }45 }
4646
@@ -53,7 +53,7 @@
53 'intrastat_line_ids': False,53 'intrastat_line_ids': False,
54 'state': 'draft',54 'state': 'draft',
55 })55 })
56 return super(report_intrastat_product, self).copy(cr, uid, id, default=default, context=context)56 return super(l10n_fr_report_intrastat_product, self).copy(cr, uid, id, default=default, context=context)
5757
5858
59 def _compute_numbers(self, cr, uid, ids, name, arg, context=None):59 def _compute_numbers(self, cr, uid, ids, name, arg, context=None):
@@ -73,7 +73,7 @@
73 return self.pool.get('report.intrastat.common')._compute_dates(cr, uid, ids, self, context=context)73 return self.pool.get('report.intrastat.common')._compute_dates(cr, uid, ids, self, context=context)
7474
75 def _get_intrastat_from_product_line(self, cr, uid, ids, context=None):75 def _get_intrastat_from_product_line(self, cr, uid, ids, context=None):
76 return self.pool.get('report.intrastat.product').search(cr, uid, [('intrastat_line_ids', 'in', ids)], context=context)76 return self.pool.get('l10n.fr.report.intrastat.product').search(cr, uid, [('intrastat_line_ids', 'in', ids)], context=context)
7777
78 _columns = {78 _columns = {
79 'company_id': fields.many2one('res.company', 'Company', required=True,79 'company_id': fields.many2one('res.company', 'Company', required=True,
@@ -84,13 +84,13 @@
84 'end_date': fields.function(_compute_dates, type='date',84 'end_date': fields.function(_compute_dates, type='date',
85 string='End date', multi='intrastat-product-dates', readonly=True,85 string='End date', multi='intrastat-product-dates', readonly=True,
86 store={86 store={
87 'report.intrastat.product': (lambda self, cr, uid, ids, c={}: ids, ['start_date'], 10),87 'l10n.fr.report.intrastat.product': (lambda self, cr, uid, ids, c={}: ids, ['start_date'], 10),
88 },88 },
89 help="End date for the declaration. Is the last day of the month of the start date."),89 help="End date for the declaration. Is the last day of the month of the start date."),
90 'year_month': fields.function(_compute_dates, type='char',90 'year_month': fields.function(_compute_dates, type='char',
91 string='Month', multi='intrastat-product-dates', readonly=True,91 string='Month', multi='intrastat-product-dates', readonly=True,
92 track_visibility='always', store={92 track_visibility='always', store={
93 'report.intrastat.product': (lambda self, cr, uid, ids, c={}: ids, ['start_date'], 10)93 'l10n.fr.report.intrastat.product': (lambda self, cr, uid, ids, c={}: ids, ['start_date'], 10)
94 },94 },
95 help="Year and month of the declaration."),95 help="Year and month of the declaration."),
96 'type': fields.selection([96 'type': fields.selection([
@@ -104,24 +104,24 @@
104 ], 'Obligation level', required=True, track_visibility='always',104 ], 'Obligation level', required=True, track_visibility='always',
105 states={'done': [('readonly', True)]},105 states={'done': [('readonly', True)]},
106 help="Your obligation level for a certain type of DEB (Import or Export) depends on the total value that you export or import per year. Note that the obligation level 'Simplified' doesn't exist for an Import DEB."),106 help="Your obligation level for a certain type of DEB (Import or Export) depends on the total value that you export or import per year. Note that the obligation level 'Simplified' doesn't exist for an Import DEB."),
107 'intrastat_line_ids': fields.one2many('report.intrastat.product.line',107 'intrastat_line_ids': fields.one2many('l10n.fr.report.intrastat.product.line',
108 'parent_id', 'Report intrastat product lines',108 'parent_id', 'Report intrastat product lines',
109 states={'done': [('readonly', True)]}),109 states={'done': [('readonly', True)]}),
110 'num_lines': fields.function(_compute_numbers, type='integer',110 'num_lines': fields.function(_compute_numbers, type='integer',
111 multi='numbers', string='Number of lines', store={111 multi='numbers', string='Number of lines', store={
112 'report.intrastat.product.line': (_get_intrastat_from_product_line, ['parent_id'], 20),112 'l10n.fr.report.intrastat.product.line': (_get_intrastat_from_product_line, ['parent_id'], 20),
113 },113 },
114 track_visibility='always', help="Number of lines in this declaration."),114 track_visibility='always', help="Number of lines in this declaration."),
115 'total_amount': fields.function(_compute_numbers,115 'total_amount': fields.function(_compute_numbers,
116 digits_compute=dp.get_precision('Account'), multi='numbers',116 digits_compute=dp.get_precision('Account'), multi='numbers',
117 string='Total amount', store={117 string='Total amount', store={
118 'report.intrastat.product.line': (_get_intrastat_from_product_line, ['amount_company_currency', 'parent_id'], 20),118 'l10n.fr.report.intrastat.product.line': (_get_intrastat_from_product_line, ['amount_company_currency', 'parent_id'], 20),
119 },119 },
120 help="Total amount in company currency of the declaration."),120 help="Total amount in company currency of the declaration."),
121 'total_fiscal_amount': fields.function(_compute_total_fiscal_amount,121 'total_fiscal_amount': fields.function(_compute_total_fiscal_amount,
122 digits_compute=dp.get_precision('Account'),122 digits_compute=dp.get_precision('Account'),
123 string='Total fiscal amount', track_visibility='always', store={123 string='Total fiscal amount', track_visibility='always', store={
124 'report.intrastat.product.line': (_get_intrastat_from_product_line, ['amount_company_currency', 'parent_id'], 20),124 'l10n.fr.report.intrastat.product.line': (_get_intrastat_from_product_line, ['amount_company_currency', 'parent_id'], 20),
125 },125 },
126 help="Total fiscal amount in company currency of the declaration. This is the total amount that is displayed on the Prodouane website."),126 help="Total fiscal amount in company currency of the declaration. This is the total amount that is displayed on the Prodouane website."),
127 'currency_id': fields.related('company_id', 'currency_id', readonly=True,127 'currency_id': fields.related('company_id', 'currency_id', readonly=True,
@@ -135,12 +135,12 @@
135 }135 }
136136
137 def default_get(self, cr, uid, fields_list, context=None):137 def default_get(self, cr, uid, fields_list, context=None):
138 res = super(report_intrastat_product, self).default_get(138 res = super(l10n_fr_report_intrastat_product, self).default_get(
139 cr, uid, fields_list, context=context)139 cr, uid, fields_list, context=context)
140 if not res:140 if not res:
141 res = {}141 res = {}
142 company_id = self.pool['res.company']._company_default_get(142 company_id = self.pool['res.company']._company_default_get(
143 cr, uid, 'report.intrastat.product', context=context)143 cr, uid, 'l10n.fr.report.intrastat.product', context=context)
144 company = self.pool['res.company'].browse(144 company = self.pool['res.company'].browse(
145 cr, uid, company_id, context=context)145 cr, uid, company_id, context=context)
146 if company.import_obligation_level == 'none':146 if company.import_obligation_level == 'none':
@@ -204,7 +204,7 @@
204 assert len(ids) == 1, "Only one ID accepted"204 assert len(ids) == 1, "Only one ID accepted"
205 if context is None:205 if context is None:
206 context = {}206 context = {}
207 line_obj = self.pool['report.intrastat.product.line']207 line_obj = self.pool['l10n.fr.report.intrastat.product.line']
208208
209 data_obj = self.pool['ir.model.data']209 data_obj = self.pool['ir.model.data']
210 uom_categ_model, weight_uom_categ_id = data_obj.get_object_reference(210 uom_categ_model, weight_uom_categ_id = data_obj.get_object_reference(
@@ -320,9 +320,9 @@
320 # The origin country should only be declated on Import320 # The origin country should only be declated on Import
321 if intrastat.type == 'export':321 if intrastat.type == 'export':
322 product_country_origin_id_to_write = False322 product_country_origin_id_to_write = False
323 elif line.product_id.country_id:323 elif line.product_id.origin_country_id:
324 # If we have the country of origin on the product -> take it324 # If we have the country of origin on the product -> take it
325 product_country_origin_id_to_write = line.product_id.country_id.id325 product_country_origin_id_to_write = line.product_id.origin_country_id.id
326 else:326 else:
327 # If we don't, look on the product supplier info327 # If we don't, look on the product supplier info
328 origin_partner_id = parent_values.get('origin_partner_id', False)328 origin_partner_id = parent_values.get('origin_partner_id', False)
@@ -500,7 +500,7 @@
500 assert len(ids) == 1, "Only one ID accepted"500 assert len(ids) == 1, "Only one ID accepted"
501 intrastat = self.browse(cr, uid, ids[0], context=context)501 intrastat = self.browse(cr, uid, ids[0], context=context)
502 self.pool.get('report.intrastat.common')._check_generate_lines(cr, uid, intrastat, context=context)502 self.pool.get('report.intrastat.common')._check_generate_lines(cr, uid, intrastat, context=context)
503 line_obj = self.pool.get('report.intrastat.product.line')503 line_obj = self.pool.get('l10n.fr.report.intrastat.product.line')
504 line_remove_ids = line_obj.search(cr, uid, [('parent_id', '=', ids[0]), ('invoice_id', '!=', False)], context=context)504 line_remove_ids = line_obj.search(cr, uid, [('parent_id', '=', ids[0]), ('invoice_id', '!=', False)], context=context)
505 if line_remove_ids:505 if line_remove_ids:
506 line_obj.unlink(cr, uid, line_remove_ids, context=context)506 line_obj.unlink(cr, uid, line_remove_ids, context=context)
@@ -793,13 +793,13 @@
793 return True793 return True
794794
795795
796class report_intrastat_product_line(orm.Model):796class l10n_fr_report_intrastat_product_line(orm.Model):
797 _name = "report.intrastat.product.line"797 _name = "l10n.fr.report.intrastat.product.line"
798 _description = "Intrastat Product Lines"798 _description = "Intrastat Product Lines for France"
799 _order = 'id'799 _order = 'id'
800800
801 _columns = {801 _columns = {
802 'parent_id': fields.many2one('report.intrastat.product', 'Intrastat product ref', ondelete='cascade', readonly=True),802 'parent_id': fields.many2one('l10n.fr.report.intrastat.product', 'Intrastat product ref', ondelete='cascade', readonly=True),
803 'company_id': fields.related('parent_id', 'company_id', type='many2one', relation='res.company', string="Company", readonly=True),803 'company_id': fields.related('parent_id', 'company_id', type='many2one', relation='res.company', string="Company", readonly=True),
804 'type': fields.related('parent_id', 'type', type='char', string="Type", readonly=True),804 'type': fields.related('parent_id', 'type', type='char', string="Type", readonly=True),
805 'company_currency_id': fields.related('company_id', 'currency_id', type='many2one', relation='res.currency', string="Company currency", readonly=True),805 'company_currency_id': fields.related('company_id', 'currency_id', type='many2one', relation='res.currency', string="Company currency", readonly=True),
@@ -830,7 +830,7 @@
830 digits_compute=dp.get_precision('Account'), readonly=True,830 digits_compute=dp.get_precision('Account'), readonly=True,
831 help="Amount of product value in invoice currency ; it is the amount of the invoice line or group of invoice lines."),831 help="Amount of product value in invoice currency ; it is the amount of the invoice line or group of invoice lines."),
832 'invoice_currency_id': fields.many2one('res.currency', "Invoice currency", readonly=True),832 'invoice_currency_id': fields.many2one('res.currency', "Invoice currency", readonly=True),
833 'product_country_origin_id': fields.many2one('res.country', 'Product country of origin'),833 'product_country_origin_id': fields.many2one('res.country', 'Product country of origin'), # TODO rename product_origin_country_id
834 'product_country_origin_code': fields.related('product_country_origin_id', 'code', type='char', relation='res.country', string='Product country of origin', readonly=True),834 'product_country_origin_code': fields.related('product_country_origin_id', 'code', type='char', relation='res.country', string='Product country of origin', readonly=True),
835 'transport': fields.selection([835 'transport': fields.selection([
836 (1, '1. Transport maritime'),836 (1, '1. Transport maritime'),
837837
=== modified file 'l10n_fr_intrastat_product/intrastat_product_reminder.xml'
--- l10n_fr_intrastat_product/intrastat_product_reminder.xml 2014-04-14 17:41:39 +0000
+++ l10n_fr_intrastat_product/intrastat_product_reminder.xml 2014-12-13 00:30:09 +0000
@@ -9,7 +9,7 @@
9<openerp>9<openerp>
1010
11<data noupdate="1"> <!-- noupdate = 1 for the 'active' field -->11<data noupdate="1"> <!-- noupdate = 1 for the 'active' field -->
12<record id="intrastat_product_cron" model="ir.cron">12<record id="l10n_fr_intrastat_product_cron" model="ir.cron">
13 <field name="name">Intrastat Product Reminder</field>13 <field name="name">Intrastat Product Reminder</field>
14 <field name="active" eval="False"/>14 <field name="active" eval="False"/>
15 <field name="user_id" ref="base.user_root"/>15 <field name="user_id" ref="base.user_root"/>
@@ -17,7 +17,7 @@
17 <field name="interval_type">months</field>17 <field name="interval_type">months</field>
18 <field name="numbercall">-1</field> <!-- don't limit the number of calls -->18 <field name="numbercall">-1</field> <!-- don't limit the number of calls -->
19 <field name="doall" eval="False"/>19 <field name="doall" eval="False"/>
20 <field name="model" eval="'report.intrastat.product'"/>20 <field name="model" eval="'l10n.fr.report.intrastat.product'"/>
21 <field name="function" eval="'_scheduler_reminder'" />21 <field name="function" eval="'_scheduler_reminder'" />
22 <field name="args" eval="'()'"/>22 <field name="args" eval="'()'"/>
23</record>23</record>
@@ -25,9 +25,9 @@
25</data>25</data>
26<data>26<data>
2727
28<record id="intrastat_product_reminder_email_template" model="email.template">28<record id="l10n_fr_intrastat_product_reminder_email_template" model="email.template">
29 <field name="name">Intrastat Product Reminder</field>29 <field name="name">Intrastat Product Reminder</field>
30 <field name="model_id" ref="l10n_fr_intrastat_product.model_report_intrastat_product"/>30 <field name="model_id" ref="l10n_fr_intrastat_product.model_l10n_fr_report_intrastat_product"/>
31 <field name="email_from">${object.company_id.email or 'openerp@example.com'}</field>31 <field name="email_from">${object.company_id.email or 'openerp@example.com'}</field>
32 <field name="email_to">${object.company_id.intrastat_email_list}</field>32 <field name="email_to">${object.company_id.intrastat_email_list}</field>
33 <field name="subject">${object.type} Intrastat Product ${object.year_month} for ${object.company_id.name}</field>33 <field name="subject">${object.type} Intrastat Product ${object.year_month} for ${object.company_id.name}</field>
3434
=== modified file 'l10n_fr_intrastat_product/intrastat_product_view.xml'
--- l10n_fr_intrastat_product/intrastat_product_view.xml 2014-07-03 22:18:44 +0000
+++ l10n_fr_intrastat_product/intrastat_product_view.xml 2014-12-13 00:30:09 +0000
@@ -10,9 +10,9 @@
10<data>10<data>
1111
12<!-- Form view of DEB, with integrated form+tree view of lines -->12<!-- Form view of DEB, with integrated form+tree view of lines -->
13<record id="intrastat_product_form" model="ir.ui.view">13<record id="l10n_fr_intrastat_product_form" model="ir.ui.view">
14 <field name="name">fr.intrastat.product.form</field>14 <field name="name">l10n.fr.intrastat.product.form</field>
15 <field name="model">report.intrastat.product</field>15 <field name="model">l10n.fr.report.intrastat.product</field>
16 <field name="arch" type="xml">16 <field name="arch" type="xml">
17 <form string="Intrastat Product">17 <form string="Intrastat Product">
18 <header>18 <header>
@@ -108,9 +108,9 @@
108</record>108</record>
109109
110<!-- Tree view for DEB -->110<!-- Tree view for DEB -->
111<record id="intrastat_product_tree" model="ir.ui.view">111<record id="l10n_fr_intrastat_product_tree" model="ir.ui.view">
112 <field name="name">fr.intrastat.product.tree</field>112 <field name="name">l10n.fr.intrastat.product.tree</field>
113 <field name="model">report.intrastat.product</field>113 <field name="model">l10n.fr.report.intrastat.product</field>
114 <field name="arch" type="xml">114 <field name="arch" type="xml">
115 <tree string="Intrastat Product" colors="blue:state=='draft'">115 <tree string="Intrastat Product" colors="blue:state=='draft'">
116 <field name="year_month" />116 <field name="year_month" />
@@ -128,9 +128,9 @@
128128
129129
130<!-- Search view for DEB -->130<!-- Search view for DEB -->
131<record id="intrastat_product_search" model="ir.ui.view">131<record id="l10n_fr_intrastat_product_search" model="ir.ui.view">
132 <field name="name">fr.intrastat.product.search</field>132 <field name="name">l10n.fr.intrastat.product.search</field>
133 <field name="model">report.intrastat.product</field>133 <field name="model">l10n.fr.report.intrastat.product</field>
134 <field name="arch" type="xml">134 <field name="arch" type="xml">
135 <search string="Search Intrastat Products">135 <search string="Search Intrastat Products">
136 <filter name="import" string="Import" domain="[('type', '=', 'import')]" />136 <filter name="import" string="Import" domain="[('type', '=', 'import')]" />
@@ -146,9 +146,9 @@
146</record>146</record>
147147
148<!-- Graph view for DEB -->148<!-- Graph view for DEB -->
149<record id="intrastat_product_graph" model="ir.ui.view">149<record id="l10n_fr_intrastat_product_graph" model="ir.ui.view">
150 <field name="name">fr.intrastat.product.graph</field>150 <field name="name">l10n.fr.intrastat.product.graph</field>
151 <field name="model">report.intrastat.product</field>151 <field name="model">l10n.fr.report.intrastat.product</field>
152 <field name="arch" type="xml">152 <field name="arch" type="xml">
153 <graph string="Intrastat Product" type="bar">153 <graph string="Intrastat Product" type="bar">
154 <field name="start_date" type="row"/>154 <field name="start_date" type="row"/>
@@ -159,21 +159,23 @@
159</record>159</record>
160160
161<!-- Action related -->161<!-- Action related -->
162<record id="intrastat_product_tree_action" model="ir.actions.act_window">162<record id="l10n_fr_intrastat_product_tree_action" model="ir.actions.act_window">
163 <field name="name">Intrastat Product</field>163 <field name="name">Intrastat Product</field>
164 <field name="res_model">report.intrastat.product</field>164 <field name="res_model">l10n.fr.report.intrastat.product</field>
165 <field name="view_mode">tree,form,graph</field>165 <field name="view_mode">tree,form,graph</field>
166</record>166</record>
167167
168168
169<!-- Intrastat product menu -->169<!-- Intrastat product menu -->
170<menuitem id="intrastat_product_menu" parent="intrastat_base.menu_intrastat_base_root" action="intrastat_product_tree_action" />170<menuitem id="l10n_fr_intrastat_product_menu"
171 parent="intrastat_base.menu_intrastat_base_root"
172 action="l10n_fr_intrastat_product_tree_action" />
171173
172174
173<!-- Notification in the chatter -->175<!-- Notification in the chatter -->
174<record id="declaration_done" model="mail.message.subtype">176<record id="l10n_fr_declaration_done" model="mail.message.subtype">
175 <field name="name">Intrastat Product Validated</field>177 <field name="name">Intrastat Product Validated</field>
176 <field name="res_model">report.intrastat.product</field>178 <field name="res_model">l10n.fr.report.intrastat.product</field>
177 <field name="default" eval="False"/>179 <field name="default" eval="False"/>
178 <field name="description">Intrastat Product Validated</field>180 <field name="description">Intrastat Product Validated</field>
179</record>181</record>
180182
=== added directory 'l10n_fr_intrastat_product/migrations'
=== added directory 'l10n_fr_intrastat_product/migrations/8.0.1.2'
=== added file 'l10n_fr_intrastat_product/migrations/8.0.1.2/pre-migration.py'
--- l10n_fr_intrastat_product/migrations/8.0.1.2/pre-migration.py 1970-01-01 00:00:00 +0000
+++ l10n_fr_intrastat_product/migrations/8.0.1.2/pre-migration.py 2014-12-13 00:30:09 +0000
@@ -0,0 +1,57 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Report intrastat product module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23def migrate(cr, version):
24 if not version:
25 return
26
27 cr.execute(
28 'ALTER SEQUENCE "report_intrastat_product_line_id_seq" RENAME TO '
29 '"l10n_fr_report_intrastat_product_line_id_seq"')
30
31 cr.execute(
32 'ALTER TABLE "report_intrastat_product_line" RENAME TO '
33 '"l10n_fr_report_intrastat_product_line"')
34
35 cr.execute(
36 "UPDATE ir_model SET model='l10n.fr.report.intrastat.product.line' "
37 "WHERE model='report.intrastat.product.line'")
38
39 cr.execute(
40 "UPDATE ir_model_fields SET relation='l10n.fr.report.intrastat.product.line' "
41 "WHERE relation='report.intrastat.product.line'")
42
43 cr.execute(
44 'ALTER SEQUENCE "report_intrastat_product_id_seq" RENAME TO '
45 '"l10n_fr_report_intrastat_product_id_seq"')
46
47 cr.execute(
48 'ALTER TABLE "report_intrastat_product" RENAME TO '
49 '"l10n_fr_report_intrastat_product"')
50
51 cr.execute(
52 "UPDATE ir_model SET model='l10n.fr.report.intrastat.product' "
53 "WHERE model='report.intrastat.product'")
54
55 cr.execute(
56 "UPDATE ir_model_fields SET relation='l10n.fr.report.intrastat.product' "
57 "WHERE relation='report.intrastat.product'")
058
=== modified file 'l10n_fr_intrastat_product/product.py'
--- l10n_fr_intrastat_product/product.py 2014-10-30 12:30:41 +0000
+++ l10n_fr_intrastat_product/product.py 2014-12-13 00:30:09 +0000
@@ -21,158 +21,47 @@
21#21#
22##############################################################################22##############################################################################
2323
24from openerp.osv import orm, fields24from openerp import models, fields, api, _
25from openerp.tools.translate import _25from openerp.exceptions import ValidationError
2626
2727
28class report_intrastat_code(orm.Model):28class ProductUom(models.Model):
29 _name = "report.intrastat.code"
30 _description = "Intrastat code"
31 _order = "name"
32 _columns = {
33 'name': fields.char(
34 'H.S. code', size=16, required=True,
35 help="Full lenght H.S. code"),
36 'description': fields.char(
37 'Description', size=255,
38 help='Short text description of the H.S. category'),
39 'intrastat_code': fields.char(
40 'Intrastat code for DEB', size=9, required=True,
41 help="H.S. code used for the DEB in France. Must be part "
42 "of the 'Nomenclature combinée' (NC) with 8 digits with "
43 "sometimes a 9th digit for the "
44 "'Nomenclature Générale des Produits' (NGP)."),
45 'intrastat_uom_id': fields.many2one(
46 'product.uom', 'UoM for intrastat product report',
47 help="Select the unit of measure if one is required for "
48 "this particular intrastat code (other than the weight in Kg). "
49 "If no particular unit of measure is required, leave empty."),
50 }
51
52 def name_get(self, cr, uid, ids, context=None):
53 res = []
54 for code in self.read(
55 cr, uid, ids, ['name', 'description'], context=context):
56 display_name = code['name']
57 if code['description']:
58 display_name = '%s %s' % (display_name, code['description'])
59 res.append((code['id'], display_name))
60 return res
61
62 def _intrastat_code(self, cr, uid, ids):
63 for intrastat_code_to_check in self.read(
64 cr, uid, ids, ['intrastat_code']):
65 if intrastat_code_to_check['intrastat_code']:
66 if (not intrastat_code_to_check['intrastat_code'].isdigit()
67 or len(intrastat_code_to_check['intrastat_code'])
68 not in (8, 9)):
69 return False
70 return True
71
72 def _hs_code(self, cr, uid, ids):
73 for code_to_check in self.read(cr, uid, ids, ['name']):
74 if code_to_check['name']:
75 if not code_to_check['name'].isdigit():
76 return False
77 return True
78
79 _constraints = [
80 (
81 _intrastat_code,
82 "The 'Intrastat code for DEB' should have exactly 8 or 9 digits.",
83 ['intrastat_code']
84 ),
85 (
86 _hs_code,
87 "'Intrastat code' should only contain digits.",
88 ['name']
89 ),
90 ]
91
92
93class product_uom(orm.Model):
94 _inherit = "product.uom"29 _inherit = "product.uom"
95 _columns = {30
96 'intrastat_label': fields.char(31 intrastat_label = fields.Char(
97 'Intrastat label', size=12,32 string='Intrastat Label', size=12,
98 help="Label used in the XML file export of the Intrastat "33 help="Label used in the XML file export of the Intrastat "
99 "product report for this unit of measure."),34 "Product Report for this unit of measure.")
100 }35
10136
10237class ProductSupplierinfo(models.Model):
103class product_template(orm.Model):
104 _inherit = "product.template"
105 _columns = {
106 'intrastat_id': fields.many2one(
107 'report.intrastat.code', 'Intrastat code',
108 help="Code from the Harmonised System. Nomenclature is "
109 "available from the World Customs Organisation, see "
110 "http://www.wcoomd.org/. Some countries have made their own "
111 "extensions to this nomenclature."),
112 'country_id': fields.many2one(
113 'res.country', 'Country of origin',
114 help="Country of origin of the product i.e. product "
115 "'made in ____'. If you have different countries of origin "
116 "depending on the supplier from which you purchased the product, "
117 "leave this field empty and use the equivalent field on the "
118 "'product supplier info' form."),
119 # This field should be called origin_country_id, but it's named
120 # country_id to keep "compatibility with OpenERP users that used
121 # the "report_intrastat" module
122 }
123
124
125class product_category(orm.Model):
126 _inherit = "product.category"
127 _columns = {
128 'intrastat_id': fields.many2one(
129 'report.intrastat.code', 'Intrastat code',
130 help="Code from the Harmonised System. If this code is not "
131 "set on the product itself, it will be read here, on the "
132 "related product category."),
133 }
134
135
136class product_supplierinfo(orm.Model):
137 _inherit = "product.supplierinfo"38 _inherit = "product.supplierinfo"
138 _columns = {39
139 'origin_country_id': fields.many2one(40 origin_country_id = fields.Many2one(
140 'res.country', 'Country of origin',41 'res.country', string='Country of Origin',
141 help="Country of origin of the product "42 help="Country of origin of the product "
142 "(i.e. product 'made in ____') when purchased from this supplier. "43 "(i.e. product 'made in ____') when purchased from this supplier. "
143 "This field is used only when the equivalent field on the product "44 "This field is used only when the equivalent field on the product "
144 "form is empty."),45 "form is empty.")
145 }46
14647 @api.constrains('origin_country_id', 'name', 'product_tmpl_id')
147 def _same_supplier_same_origin(self, cr, uid, ids):48 def _same_supplier_same_origin(self):
148 """Products from the same supplier should have the same origin"""49 """Products from the same supplier should have the same origin"""
149 for supplierinfo in self.browse(cr, uid, ids):50 # Search for same supplier and same product tmpl
150 country_origin_id = supplierinfo.origin_country_id.id51 same_product_same_suppliers = self.search([
151 # Search for same supplier and same product52 ('product_tmpl_id', '=', self.product_tmpl_id.id),
152 same_product_same_supplier_ids = self.search(53 ('name', '=', self.name.id)])
153 cr, uid, [
154 ('product_id', '=', supplierinfo.product_id.id),
155 ('name', '=', supplierinfo.name.id)])
156 # 'name' on product_supplierinfo is a many2one to res.partner54 # 'name' on product_supplierinfo is a many2one to res.partner
157 for supplieri in self.browse(55 for supplieri in same_product_same_suppliers:
158 cr, uid, same_product_same_supplier_ids):56 if self.origin_country_id != supplieri.origin_country_id:
159 if country_origin_id != supplieri.origin_country_id.id:57 raise ValidationError(
160 raise orm.except_orm(58 _("For a particular product, all supplier info "
161 _('Error !'),59 "entries with the same supplier should have the "
162 _("For a particular product, all supplier info "60 "same country of origin. But, for product '%s' "
163 "entries with the same supplier should have the "61 "with supplier '%s', there is one entry with "
164 "same country of origin. But, for product '%s' "62 "country of origin '%s' and another entry with "
165 "with supplier '%s', there is one entry with "63 "country of origin '%s'.")
166 "country of origin '%s' and another entry with "64 % (self.product_tmpl_id.name,
167 "country of origin '%s'.")65 self.name.name,
168 % (supplieri.product_id.name,66 self.origin_country_id.name,
169 supplieri.name.name,67 supplieri.origin_country_id.name))
170 supplierinfo.origin_country_id.name,
171 supplieri.origin_country_id.name))
172 return True
173
174 _constraints = [(
175 _same_supplier_same_origin,
176 "Wrong configuration of the supplier information",
177 ['origin_country_id', 'name', 'product_id']
178 )]
17968
=== modified file 'l10n_fr_intrastat_product/product_view.xml'
--- l10n_fr_intrastat_product/product_view.xml 2014-07-03 22:15:06 +0000
+++ l10n_fr_intrastat_product/product_view.xml 2014-12-13 00:30:09 +0000
@@ -9,19 +9,6 @@
9<openerp>9<openerp>
10<data>10<data>
1111
12<!-- Add fields on product.template view -->
13<record id="product_template_form_view" model="ir.ui.view">
14 <field name="name">fr.intrastat.product.template.form</field>
15 <field name="model">product.template</field>
16 <field name="inherit_id" ref="intrastat_base.product_template_form_view" />
17 <field name="arch" type="xml">
18 <field name="exclude_from_intrastat" position="before">
19 <field name="intrastat_id" attrs="{'invisible': [('type', '=', 'service')]}"/>
20 <field name="country_id" attrs="{'invisible': [('type', '=', 'service')]}"/>
21 </field>
22 </field>
23</record>
24
25<!-- Add field on product.supplierinfo -->12<!-- Add field on product.supplierinfo -->
26<record id="product_supplierinfo_form_view" model="ir.ui.view">13<record id="product_supplierinfo_form_view" model="ir.ui.view">
27 <field name="name">fr.intrastat.product.product.supplierinfo.form</field>14 <field name="name">fr.intrastat.product.product.supplierinfo.form</field>
@@ -34,89 +21,19 @@
34 </field>21 </field>
35</record>22</record>
3623
37<!-- Add intrastat_id on Product category -->
38<record id="product_category_form_view" model="ir.ui.view">
39 <field name="name">fr.intrastat.product.category.form</field>
40 <field name="model">product.category</field>
41 <field name="inherit_id" ref="product.product_category_form_view"/>
42 <field name="arch" type="xml">
43 <xpath expr="//group[@name='parent']" position="inside">
44 <group name="intrastat" string="Intrastat Properties" colspan="2">
45 <field name="intrastat_id" />
46 </group>
47 </xpath>
48 </field>
49</record>
50
51<!-- Add the field intrastat_label on product UoM -->24<!-- Add the field intrastat_label on product UoM -->
52<record id="product_uom_form_view" model="ir.ui.view">25<record id="product_uom_form_view" model="ir.ui.view">
53 <field name="name">fr.intrastat.product.uom.form</field>26 <field name="name">fr.intrastat.product.uom.form</field>
54 <field name="model">product.uom</field>27 <field name="model">product.uom</field>
55 <field name="inherit_id" ref="product.product_uom_form_view" />28 <field name="inherit_id" ref="product.product_uom_form_view" />
56 <field name="arch" type="xml">29 <field name="arch" type="xml">
57 <data>30 <field name="category_id" position="after">
58 <field name="category_id" position="after">31 <field name="intrastat_label"
59 <field name="intrastat_label" groups="l10n_fr_intrastat_product.group_detailed_intrastat_product"/>32 groups="l10n_fr_intrastat_product.group_detailed_intrastat_product"/>
60 </field>33 </field>
61 </data>34 </field>
62 </field>35</record>
63</record>36
64
65<!-- Add search view for H.S. code -->
66<record id="product_intrastat_code_search" model="ir.ui.view">
67 <field name="name">fr.intrastat.product.intrastat.code.search</field>
68 <field name="model">report.intrastat.code</field>
69 <field name="arch" type="xml">
70 <search string="Search Intrastat Code">
71 <field name="name" />
72 <field name="description" />
73 </search>
74 </field>
75</record>
76
77
78<!-- Add tree view for H.S. code -->
79<record id="product_intrastat_code_tree" model="ir.ui.view">
80 <field name="name">fr.intrastat.product.intrastat.code.tree</field>
81 <field name="model">report.intrastat.code</field>
82 <field name="arch" type="xml">
83 <tree string="Intrastat code">
84 <field name="name" />
85 <field name="intrastat_code" />
86 <field name="description" />
87 <field name="intrastat_uom_id" groups="l10n_fr_intrastat_product.group_detailed_intrastat_product"/>
88 </tree>
89 </field>
90</record>
91
92
93<!-- Add form view for H.S. code -->
94<record id="product_intrastat_code_form" model="ir.ui.view">
95 <field name="name">fr.intrastat.product.intrastat.code.form</field>
96 <field name="model">report.intrastat.code</field>
97 <field name="arch" type="xml">
98 <form string="Intrastat code">
99 <field name="name" />
100 <field name="intrastat_code" />
101 <field name="description" />
102 <field name="intrastat_uom_id" />
103 </form>
104 </field>
105</record>
106
107<!-- Action for H.S. code -->
108<record id="product_intrastat_code_act" model="ir.actions.act_window">
109 <field name="name">Intrastat Code</field>
110 <field name="res_model">report.intrastat.code</field>
111 <field name="view_mode">tree,form</field>
112</record>
113
114<!-- Menu entry for H.S. code -->
115<menuitem id="product_intrastat_code_menu" action="product_intrastat_code_act" parent="product.prod_config_main" />
116
117<menuitem id="product_intrastat_code_menu_purchase" action="product_intrastat_code_act" parent="purchase.menu_product_in_config_purchase" />
118
119<menuitem id="product_intrastat_code_menu_stock" action="product_intrastat_code_act" parent="stock.menu_product_in_config_stock" />
12037
121</data>38</data>
122</openerp>39</openerp>
12340
=== modified file 'l10n_fr_intrastat_product/security/intrastat_product_security.xml'
--- l10n_fr_intrastat_product/security/intrastat_product_security.xml 2014-02-01 22:43:05 +0000
+++ l10n_fr_intrastat_product/security/intrastat_product_security.xml 2014-12-13 00:30:09 +0000
@@ -15,14 +15,14 @@
1515
16<record id="fr_intrastat_product_rule" model="ir.rule">16<record id="fr_intrastat_product_rule" model="ir.rule">
17 <field name="name">Intrastat Product multi-company</field>17 <field name="name">Intrastat Product multi-company</field>
18 <field name="model_id" ref="model_report_intrastat_product"/>18 <field name="model_id" ref="model_l10n_fr_report_intrastat_product"/>
19 <field name="global" eval="True"/>19 <field name="global" eval="True"/>
20 <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>20 <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
21</record>21</record>
2222
23<record id="fr_intrastat_product_line_rule" model="ir.rule">23<record id="fr_intrastat_product_line_rule" model="ir.rule">
24 <field name="name">Intrastat Product Line multi-company</field>24 <field name="name">Intrastat Product Line multi-company</field>
25 <field name="model_id" ref="model_report_intrastat_product_line"/>25 <field name="model_id" ref="model_l10n_fr_report_intrastat_product_line"/>
26 <field name="global" eval="True"/>26 <field name="global" eval="True"/>
27 <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>27 <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
28</record>28</record>
2929
=== modified file 'l10n_fr_intrastat_product/security/ir.model.access.csv'
--- l10n_fr_intrastat_product/security/ir.model.access.csv 2011-04-26 07:28:46 +0000
+++ l10n_fr_intrastat_product/security/ir.model.access.csv 2014-12-13 00:30:09 +0000
@@ -1,7 +1,5 @@
1"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"1id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2"access_report_intrastat_type","report.intrastat.type","model_report_intrastat_type","account.group_account_manager",1,1,1,12access_report_intrastat_type,report.intrastat.type,model_report_intrastat_type,account.group_account_manager,1,1,1,1
3"access_report_intrastat_code","report.intrastat.code finance manager","model_report_intrastat_code","account.group_account_manager",1,1,1,13access_report_intrastat_code,report.intrastat.code finance manager,intrastat_product.model_report_intrastat_code,account.group_account_manager,1,1,1,1
4"access_report_intrastat_code_product_manager","report.intrastat.code product manager","model_report_intrastat_code","account.group_account_manager",1,1,1,14access_report_intrastat_product,report.intrastat.product,model_l10n_fr_report_intrastat_product,account.group_account_manager,1,1,1,1
5"access_report_intrastat_code_employee","report.intrastat.code read for employee","model_report_intrastat_code","base.group_user",1,0,0,05access_report_intrastat_product_line,report.intrastat.product.line,model_l10n_fr_report_intrastat_product_line,account.group_account_manager,1,1,1,1
6"access_report_intrastat_product","report.intrastat.product","model_report_intrastat_product","account.group_account_manager",1,1,1,1
7"access_report_intrastat_product_line","report.intrastat.product.line","model_report_intrastat_product_line","account.group_account_manager",1,1,1,1
86
=== modified file 'l10n_fr_intrastat_service/__openerp__.py'
--- l10n_fr_intrastat_service/__openerp__.py 2014-02-01 22:43:05 +0000
+++ l10n_fr_intrastat_service/__openerp__.py 2014-12-13 00:30:09 +0000
@@ -23,7 +23,7 @@
2323
24{24{
25 'name': 'France Intrastat Service',25 'name': 'France Intrastat Service',
26 'version': '1.1',26 'version': '1.2',
27 'category': 'Localisation/Report Intrastat',27 'category': 'Localisation/Report Intrastat',
28 'license': 'AGPL-3',28 'license': 'AGPL-3',
29 'summary': 'Module for Intrastat service reporting (DES) for France',29 'summary': 'Module for Intrastat service reporting (DES) for France',
@@ -46,6 +46,5 @@
46 ],46 ],
47 'demo': [],47 'demo': [],
48 'installable': True,48 'installable': True,
49 'active': False,
50 'application': True,49 'application': True,
51}50}
5251
=== modified file 'l10n_fr_intrastat_service/intrastat_service.py'
--- l10n_fr_intrastat_service/intrastat_service.py 2014-04-14 17:41:39 +0000
+++ l10n_fr_intrastat_service/intrastat_service.py 2014-12-13 00:30:09 +0000
@@ -33,15 +33,15 @@
33logger = logging.getLogger(__name__)33logger = logging.getLogger(__name__)
3434
3535
36class report_intrastat_service(orm.Model):36class l10n_fr_report_intrastat_service(orm.Model):
37 _name = "report.intrastat.service"37 _name = "l10n.fr.report.intrastat.service"
38 _order = "start_date desc"38 _order = "start_date desc"
39 _rec_name = "start_date"39 _rec_name = "start_date"
40 _inherit = ['mail.thread']40 _inherit = ['mail.thread']
41 _description = "Intrastat Service"41 _description = "Intrastat Service"
42 _track = {42 _track = {
43 'state': {43 'state': {
44 'l10n_fr_intrastat_service.declaration_done':44 'l10n_fr_intrastat_service.l10n_fr_declaration_done':
45 lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done',45 lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done',
46 }46 }
47 }47 }
@@ -56,7 +56,7 @@
56 'intrastat_line_ids': False,56 'intrastat_line_ids': False,
57 'state': 'draft',57 'state': 'draft',
58 })58 })
59 return super(report_intrastat_service, self).copy(59 return super(l10n_fr_report_intrastat_service, self).copy(
60 cr, uid, id, default=default, context=context)60 cr, uid, id, default=default, context=context)
6161
62 def _compute_numbers(self, cr, uid, ids, name, arg, context=None):62 def _compute_numbers(self, cr, uid, ids, name, arg, context=None):
@@ -68,7 +68,7 @@
68 cr, uid, ids, self, context=context)68 cr, uid, ids, self, context=context)
6969
70 def _get_intrastat_from_service_line(self, cr, uid, ids, context=None):70 def _get_intrastat_from_service_line(self, cr, uid, ids, context=None):
71 return self.pool['report.intrastat.service'].search(71 return self.pool['l10n.fr.report.intrastat.service'].search(
72 cr, uid, [('intrastat_line_ids', 'in', ids)], context=context)72 cr, uid, [('intrastat_line_ids', 'in', ids)], context=context)
7373
74 _columns = {74 _columns = {
@@ -85,7 +85,7 @@
85 _compute_dates, type='date',85 _compute_dates, type='date',
86 string='End date', multi='intrastat-service-dates', readonly=True,86 string='End date', multi='intrastat-service-dates', readonly=True,
87 store={87 store={
88 'report.intrastat.service': (88 'l10n.fr.report.intrastat.service': (
89 lambda self, cr, uid, ids, c={}: ids, ['start_date'], 20),89 lambda self, cr, uid, ids, c={}: ids, ['start_date'], 20),
90 },90 },
91 help="End date for the declaration. Must be the last day of the "91 help="End date for the declaration. Must be the last day of the "
@@ -94,19 +94,19 @@
94 _compute_dates, type='char',94 _compute_dates, type='char',
95 string='Month', multi='intrastat-service-dates', readonly=True,95 string='Month', multi='intrastat-service-dates', readonly=True,
96 track_visibility='always', store={96 track_visibility='always', store={
97 'report.intrastat.service': (97 'l10n.fr.report.intrastat.service': (
98 lambda self, cr, uid, ids, c={}: ids, ['start_date'], 20),98 lambda self, cr, uid, ids, c={}: ids, ['start_date'], 20),
99 },99 },
100 help="Year and month of the declaration."),100 help="Year and month of the declaration."),
101 'intrastat_line_ids': fields.one2many(101 'intrastat_line_ids': fields.one2many(
102 'report.intrastat.service.line',102 'l10n.fr.report.intrastat.service.line',
103 'parent_id', 'Report intrastat service lines',103 'parent_id', 'Report intrastat service lines',
104 states={'done': [('readonly', True)]}),104 states={'done': [('readonly', True)]}),
105 'num_lines': fields.function(105 'num_lines': fields.function(
106 _compute_numbers,106 _compute_numbers,
107 type='integer', multi='numbers', string='Number of lines',107 type='integer', multi='numbers', string='Number of lines',
108 store={108 store={
109 'report.intrastat.service.line': (109 'l10n.fr.report.intrastat.service.line': (
110 _get_intrastat_from_service_line, ['parent_id'], 20),110 _get_intrastat_from_service_line, ['parent_id'], 20),
111 },111 },
112 track_visibility='always',112 track_visibility='always',
@@ -116,7 +116,7 @@
116 digits_compute=dp.get_precision('Account'),116 digits_compute=dp.get_precision('Account'),
117 multi='numbers', string='Total amount',117 multi='numbers', string='Total amount',
118 store={118 store={
119 'report.intrastat.service.line': (119 'l10n.fr.report.intrastat.service.line': (
120 _get_intrastat_from_service_line,120 _get_intrastat_from_service_line,
121 ['amount_company_currency', 'parent_id'], 20),121 ['amount_company_currency', 'parent_id'], 20),
122 },122 },
@@ -145,7 +145,7 @@
145 'state': 'draft',145 'state': 'draft',
146 'company_id': lambda self, cr, uid, context:146 'company_id': lambda self, cr, uid, context:
147 self.pool['res.company']._company_default_get(147 self.pool['res.company']._company_default_get(
148 cr, uid, 'report.intrastat.service', context=context),148 cr, uid, 'l10n.fr.report.intrastat.service', context=context),
149 }149 }
150150
151 def _check_start_date(self, cr, uid, ids):151 def _check_start_date(self, cr, uid, ids):
@@ -165,7 +165,7 @@
165165
166 def generate_service_lines(self, cr, uid, ids, context=None):166 def generate_service_lines(self, cr, uid, ids, context=None):
167 intrastat = self.browse(cr, uid, ids[0], context=context)167 intrastat = self.browse(cr, uid, ids[0], context=context)
168 line_obj = self.pool['report.intrastat.service.line']168 line_obj = self.pool['l10n.fr.report.intrastat.service.line']
169 invoice_obj = self.pool['account.invoice']169 invoice_obj = self.pool['account.invoice']
170 self.pool['report.intrastat.common']._check_generate_lines(170 self.pool['report.intrastat.common']._check_generate_lines(
171 cr, uid, intrastat, context=context)171 cr, uid, intrastat, context=context)
@@ -421,14 +421,14 @@
421 return True421 return True
422422
423423
424class report_intrastat_service_line(orm.Model):424class l10n_fr_report_intrastat_service_line(orm.Model):
425 _name = "report.intrastat.service.line"425 _name = "l10n.fr.report.intrastat.service.line"
426 _description = "Intrastat Service Lines"426 _description = "Intrastat Service Lines"
427 _rec_name = "partner_vat"427 _rec_name = "partner_vat"
428 _order = 'id'428 _order = 'id'
429 _columns = {429 _columns = {
430 'parent_id': fields.many2one(430 'parent_id': fields.many2one(
431 'report.intrastat.service',431 'l10n.fr.report.intrastat.service',
432 'Intrastat service ref', ondelete='cascade'),432 'Intrastat service ref', ondelete='cascade'),
433 'company_id': fields.related(433 'company_id': fields.related(
434 'parent_id', 'company_id',434 'parent_id', 'company_id',
435435
=== modified file 'l10n_fr_intrastat_service/intrastat_service_view.xml'
--- l10n_fr_intrastat_service/intrastat_service_view.xml 2014-10-30 12:30:41 +0000
+++ l10n_fr_intrastat_service/intrastat_service_view.xml 2014-12-13 00:30:09 +0000
@@ -10,9 +10,9 @@
10<data>10<data>
1111
12<!-- Form view for DES -->12<!-- Form view for DES -->
13<record id="intrastat_service_form" model="ir.ui.view">13<record id="l10n_fr_intrastat_service_form" model="ir.ui.view">
14 <field name="name">fr.intrastat.service.form</field>14 <field name="name">fr.intrastat.service.form</field>
15 <field name="model">report.intrastat.service</field>15 <field name="model">l10n.fr.report.intrastat.service</field>
16 <field name="arch" type="xml">16 <field name="arch" type="xml">
17 <form string="Intrastat Service">17 <form string="Intrastat Service">
18 <header>18 <header>
@@ -54,9 +54,9 @@
54</record>54</record>
5555
56<!-- Tree view for DES -->56<!-- Tree view for DES -->
57<record id="intrastat_service_tree" model="ir.ui.view">57<record id="l10n_fr_intrastat_service_tree" model="ir.ui.view">
58 <field name="name">fr.intrastat.service.tree</field>58 <field name="name">fr.intrastat.service.tree</field>
59 <field name="model">report.intrastat.service</field>59 <field name="model">l10n.fr.report.intrastat.service</field>
60 <field name="arch" type="xml">60 <field name="arch" type="xml">
61 <tree string="Intrastat Service" colors="blue:state=='draft'">61 <tree string="Intrastat Service" colors="blue:state=='draft'">
62 <field name="year_month" />62 <field name="year_month" />
@@ -70,9 +70,9 @@
70</record>70</record>
7171
72<!-- Search view for DES -->72<!-- Search view for DES -->
73<record id="intrastat_service_search" model="ir.ui.view">73<record id="l10n_fr_intrastat_service_search" model="ir.ui.view">
74 <field name="name">fr.intrastat.service.search</field>74 <field name="name">fr.intrastat.service.search</field>
75 <field name="model">report.intrastat.service</field>75 <field name="model">l10n.fr.report.intrastat.service</field>
76 <field name="arch" type="xml">76 <field name="arch" type="xml">
77 <search string="Search Intrastat Service">77 <search string="Search Intrastat Service">
78 <filter name="draft" string="Draft" domain="[('state', '=', 'draft')]" />78 <filter name="draft" string="Draft" domain="[('state', '=', 'draft')]" />
@@ -85,9 +85,9 @@
85</record>85</record>
8686
87<!-- Graph view for DES -->87<!-- Graph view for DES -->
88<record id="intrastat_service_graph" model="ir.ui.view">88<record id="l10n_fr_intrastat_service_graph" model="ir.ui.view">
89 <field name="name">fr.intrastat.service.graph</field>89 <field name="name">fr.intrastat.service.graph</field>
90 <field name="model">report.intrastat.service</field>90 <field name="model">l10n.fr.report.intrastat.service</field>
91 <field name="arch" type="xml">91 <field name="arch" type="xml">
92 <graph string="Intrastat Service" type="bar">92 <graph string="Intrastat Service" type="bar">
93 <field name="start_date" type="row"/>93 <field name="start_date" type="row"/>
@@ -97,9 +97,9 @@
97</record>97</record>
9898
99<!-- Form view for service lines -->99<!-- Form view for service lines -->
100<record id="intrastat_service_line_form" model="ir.ui.view">100<record id="l10n_fr_intrastat_service_line_form" model="ir.ui.view">
101 <field name="name">fr.intrastat.service.line.form</field>101 <field name="name">fr.intrastat.service.line.form</field>
102 <field name="model">report.intrastat.service.line</field>102 <field name="model">l10n.fr.report.intrastat.service.line</field>
103 <field name="arch" type="xml">103 <field name="arch" type="xml">
104 <form string="Intrastat service lines">104 <form string="Intrastat service lines">
105 <group colspan="4" col="4" string="Information to declare">105 <group colspan="4" col="4" string="Information to declare">
@@ -119,9 +119,9 @@
119</record>119</record>
120120
121<!-- Tree view for service lines -->121<!-- Tree view for service lines -->
122<record id="intrastat_service_line_tree" model="ir.ui.view">122<record id="l10n_fr_intrastat_service_line_tree" model="ir.ui.view">
123 <field name="name">fr.intrastat.service.line.tree</field>123 <field name="name">fr.intrastat.service.line.tree</field>
124 <field name="model">report.intrastat.service.line</field>124 <field name="model">l10n.fr.report.intrastat.service.line</field>
125 <field name="arch" type="xml">125 <field name="arch" type="xml">
126 <tree string="Intrastat service lines">126 <tree string="Intrastat service lines">
127 <field name="partner_vat" />127 <field name="partner_vat" />
@@ -135,21 +135,23 @@
135135
136136
137<!-- Action related -->137<!-- Action related -->
138<record id="intrastat_service_tree_action" model="ir.actions.act_window">138<record id="l10n_fr_intrastat_service_tree_action" model="ir.actions.act_window">
139 <field name="name">Intrastat Service</field>139 <field name="name">Intrastat Service</field>
140 <field name="res_model">report.intrastat.service</field>140 <field name="res_model">l10n.fr.report.intrastat.service</field>
141 <field name="view_mode">tree,form,graph</field>141 <field name="view_mode">tree,form,graph</field>
142</record>142</record>
143143
144144
145<!-- Intrastat service menu -->145<!-- Intrastat service menu -->
146<menuitem id="intrastat_service_menu" parent="intrastat_base.menu_intrastat_base_root" action="intrastat_service_tree_action" />146<menuitem id="l10n_fr_intrastat_service_menu"
147 parent="intrastat_base.menu_intrastat_base_root"
148 action="l10n_fr_intrastat_service_tree_action" />
147149
148150
149<!-- Notification in the chatter -->151<!-- Notification in the chatter -->
150<record id="declaration_done" model="mail.message.subtype">152<record id="l10n_fr_declaration_done" model="mail.message.subtype">
151 <field name="name">Intrastat Service Validated</field>153 <field name="name">Intrastat Service Validated</field>
152 <field name="res_model">report.intrastat.service</field>154 <field name="res_model">l10n.fr.report.intrastat.service</field>
153 <field name="default" eval="False"/>155 <field name="default" eval="False"/>
154 <field name="description">Intrastat Service Validated</field>156 <field name="description">Intrastat Service Validated</field>
155</record>157</record>
156158
=== added directory 'l10n_fr_intrastat_service/migrations'
=== added directory 'l10n_fr_intrastat_service/migrations/8.0.1.2'
=== added file 'l10n_fr_intrastat_service/migrations/8.0.1.2/pre-migration.py'
--- l10n_fr_intrastat_service/migrations/8.0.1.2/pre-migration.py 1970-01-01 00:00:00 +0000
+++ l10n_fr_intrastat_service/migrations/8.0.1.2/pre-migration.py 2014-12-13 00:30:09 +0000
@@ -0,0 +1,57 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# Report intrastat service module for OpenERP
5# Copyright (C) 2014 Akretion (http://www.akretion.com)
6# @author Alexis de Lattre <alexis.delattre@akretion.com>
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as
10# published by the Free Software Foundation, either version 3 of the
11# License, or (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23def migrate(cr, version):
24 if not version:
25 return
26
27 cr.execute(
28 'ALTER SEQUENCE "report_intrastat_service_line_id_seq" RENAME TO '
29 '"l10n_fr_report_intrastat_service_line_id_seq"')
30
31 cr.execute(
32 'ALTER TABLE "report_intrastat_service_line" RENAME TO '
33 '"l10n_fr_report_intrastat_service_line"')
34
35 cr.execute(
36 "UPDATE ir_model SET model='l10n.fr.report.intrastat.service.line' "
37 "WHERE model='report.intrastat.service.line'")
38
39 cr.execute(
40 "UPDATE ir_model_fields SET relation='l10n.fr.report.intrastat.service.line' "
41 "WHERE relation='report.intrastat.service.line'")
42
43 cr.execute(
44 'ALTER SEQUENCE "report_intrastat_service_id_seq" RENAME TO '
45 '"l10n_fr_report_intrastat_service_id_seq"')
46
47 cr.execute(
48 'ALTER TABLE "report_intrastat_service" RENAME TO '
49 '"l10n_fr_report_intrastat_service"')
50
51 cr.execute(
52 "UPDATE ir_model SET model='l10n.fr.report.intrastat.service' "
53 "WHERE model='report.intrastat.service'")
54
55 cr.execute(
56 "UPDATE ir_model_fields SET relation='l10n.fr.report.intrastat.service' "
57 "WHERE relation='report.intrastat.service'")
058
=== modified file 'l10n_fr_intrastat_service/security/intrastat_service_security.xml'
--- l10n_fr_intrastat_service/security/intrastat_service_security.xml 2014-02-01 22:43:05 +0000
+++ l10n_fr_intrastat_service/security/intrastat_service_security.xml 2014-12-13 00:30:09 +0000
@@ -2,17 +2,17 @@
2<openerp>2<openerp>
3<data noupdate="1">3<data noupdate="1">
44
5<record id="fr_intrastat_service_rule" model="ir.rule">5<record id="l10n_fr_intrastat_service_rule" model="ir.rule">
6 <field name="name">Intrastat Service multi-company</field>6 <field name="name">Intrastat Service multi-company</field>
7 <field name="model_id" ref="model_report_intrastat_service"/>7 <field name="model_id" ref="model_l10n_fr_report_intrastat_service"/>
8 <field name="global" eval="True"/>8 <field name="global" eval="True"/>
9 <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>9 <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
10</record>10</record>
1111
1212
13<record id="fr_intrastat_service_line_rule" model="ir.rule">13<record id="l10n_fr_intrastat_service_line_rule" model="ir.rule">
14 <field name="name">Intrastat Service Line multi-company</field>14 <field name="name">Intrastat Service Line multi-company</field>
15 <field name="model_id" ref="model_report_intrastat_service_line"/>15 <field name="model_id" ref="model_l10n_fr_report_intrastat_service_line"/>
16 <field name="global" eval="True"/>16 <field name="global" eval="True"/>
17 <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>17 <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
18</record>18</record>
1919
=== modified file 'l10n_fr_intrastat_service/security/ir.model.access.csv'
--- l10n_fr_intrastat_service/security/ir.model.access.csv 2011-03-27 20:59:53 +0000
+++ l10n_fr_intrastat_service/security/ir.model.access.csv 2014-12-13 00:30:09 +0000
@@ -1,3 +1,3 @@
1"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"1id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2"access_report_intrastat_service","report.intrastat.service","model_report_intrastat_service","account.group_account_manager",1,1,1,12access_l10n_fr_report_intrastat_service,Full access to l10n.fr.report.intrastat.service to accouting manager,model_l10n_fr_report_intrastat_service,account.group_account_manager,1,1,1,1
3"access_report_intrastat_service_line","report.intrastat.service.line","model_report_intrastat_service_line","account.group_account_manager",1,1,1,13access_l10n_fr_report_intrastat_service_line,Full access to l10n.fr.report.intrastat.service.line to accouting manager,model_l10n_fr_report_intrastat_service_line,account.group_account_manager,1,1,1,1

Subscribers

People subscribed via source and target branches