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
1=== modified file 'intrastat_base/__openerp__.py'
2--- intrastat_base/__openerp__.py 2014-03-09 08:29:59 +0000
3+++ intrastat_base/__openerp__.py 2014-12-13 00:30:09 +0000
4@@ -52,5 +52,4 @@
5 ],
6 'demo': ['intrastat_demo.xml'],
7 'installable': True,
8- 'active': False,
9 }
10
11=== added directory 'intrastat_product'
12=== added file 'intrastat_product/__init__.py'
13--- intrastat_product/__init__.py 1970-01-01 00:00:00 +0000
14+++ intrastat_product/__init__.py 2014-12-13 00:30:09 +0000
15@@ -0,0 +1,23 @@
16+# -*- encoding: utf-8 -*-
17+##############################################################################
18+#
19+# Intrastat product module for OpenERP
20+# Copyright (C) 2011-2014 Akretion (http://www.akretion.com)
21+# @author Alexis de Lattre <alexis.delattre@akretion.com>
22+#
23+# This program is free software: you can redistribute it and/or modify
24+# it under the terms of the GNU Affero General Public License as
25+# published by the Free Software Foundation, either version 3 of the
26+# License, or (at your option) any later version.
27+#
28+# This program is distributed in the hope that it will be useful,
29+# but WITHOUT ANY WARRANTY; without even the implied warranty of
30+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31+# GNU Affero General Public License for more details.
32+#
33+# You should have received a copy of the GNU Affero General Public License
34+# along with this program. If not, see <http://www.gnu.org/licenses/>.
35+#
36+##############################################################################
37+
38+from . import intrastat
39
40=== added file 'intrastat_product/__openerp__.py'
41--- intrastat_product/__openerp__.py 1970-01-01 00:00:00 +0000
42+++ intrastat_product/__openerp__.py 2014-12-13 00:30:09 +0000
43@@ -0,0 +1,46 @@
44+# -*- encoding: utf-8 -*-
45+##############################################################################
46+#
47+# Intrastat Product module for OpenERP
48+# Copyright (C) 2011-2014 Akretion (http://www.akretion.com)
49+# @author Alexis de Lattre <alexis.delattre@akretion.com>
50+#
51+# This program is free software: you can redistribute it and/or modify
52+# it under the terms of the GNU Affero General Public License as
53+# published by the Free Software Foundation, either version 3 of the
54+# License, or (at your option) any later version.
55+#
56+# This program is distributed in the hope that it will be useful,
57+# but WITHOUT ANY WARRANTY; without even the implied warranty of
58+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
59+# GNU Affero General Public License for more details.
60+#
61+# You should have received a copy of the GNU Affero General Public License
62+# along with this program. If not, see <http://www.gnu.org/licenses/>.
63+#
64+##############################################################################
65+
66+
67+{
68+ 'name': 'Intrastat Product',
69+ 'version': '1.1',
70+ 'category': 'Localisation/Report Intrastat',
71+ 'license': 'AGPL-3',
72+ 'summary': 'Base module for Intrastat Product',
73+ 'description': """
74+This module contains the common objects for the Intrastat Product.
75+This module is country-independant.
76+
77+This module has been written by Alexis de Lattre from Akretion
78+<alexis.delattre@akretion.com>
79+ """,
80+ 'author': 'Akretion',
81+ 'website': 'http://www.akretion.com',
82+ 'depends': ['intrastat_base'],
83+ 'data': [
84+ 'intrastat_view.xml',
85+ 'security/ir.model.access.csv',
86+ ],
87+ 'demo': ['intrastat_demo.xml'],
88+ 'installable': True,
89+}
90
91=== added directory 'intrastat_product/i18n'
92=== added file 'intrastat_product/i18n/intrastat_product.pot'
93--- intrastat_product/i18n/intrastat_product.pot 1970-01-01 00:00:00 +0000
94+++ intrastat_product/i18n/intrastat_product.pot 2014-12-13 00:30:09 +0000
95@@ -0,0 +1,122 @@
96+# Translation of Odoo Server.
97+# This file contains the translation of the following modules:
98+# * intrastat_product
99+#
100+msgid ""
101+msgstr ""
102+"Project-Id-Version: Odoo Server 8.0\n"
103+"Report-Msgid-Bugs-To: \n"
104+"POT-Creation-Date: 2014-11-28 22:48+0000\n"
105+"PO-Revision-Date: 2014-11-28 22:48+0000\n"
106+"Last-Translator: <>\n"
107+"Language-Team: \n"
108+"MIME-Version: 1.0\n"
109+"Content-Type: text/plain; charset=UTF-8\n"
110+"Content-Transfer-Encoding: \n"
111+"Plural-Forms: \n"
112+
113+#. module: intrastat_product
114+#: help:product.category,intrastat_id:0
115+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."
116+msgstr ""
117+
118+#. module: intrastat_product
119+#: help:product.template,intrastat_id:0
120+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."
121+msgstr ""
122+
123+#. module: intrastat_product
124+#: field:report.intrastat.code,create_uid:0
125+msgid "Created by"
126+msgstr ""
127+
128+#. module: intrastat_product
129+#: field:report.intrastat.code,create_date:0
130+msgid "Created on"
131+msgstr ""
132+
133+#. module: intrastat_product
134+#: field:report.intrastat.code,description:0
135+msgid "Description"
136+msgstr ""
137+
138+#. module: intrastat_product
139+#: help:report.intrastat.code,name:0
140+msgid "Full length Harmonized System code (digits only). Full list is available from the World Customs Organisation, see http://www.wcoomd.org"
141+msgstr ""
142+
143+#. module: intrastat_product
144+#: model:ir.model,name:intrastat_product.model_report_intrastat_code
145+msgid "H.S. Code"
146+msgstr ""
147+
148+#. module: intrastat_product
149+#: field:report.intrastat.code,name:0
150+msgid "H.S. code"
151+msgstr ""
152+
153+#. module: intrastat_product
154+#: code:addons/intrastat_product/intrastat.py:56
155+#, python-format
156+msgid "H.S. codes should only contain digits. It is not the case of H.S. code '%s'."
157+msgstr ""
158+
159+#. module: intrastat_product
160+#: field:report.intrastat.code,id:0
161+msgid "ID"
162+msgstr ""
163+
164+#. module: intrastat_product
165+#: model:ir.actions.act_window,name:intrastat_product.product_intrastat_code_act
166+#: model:ir.ui.menu,name:intrastat_product.product_intrastat_code_menu
167+#: field:product.category,intrastat_id:0
168+#: field:product.template,intrastat_id:0
169+#: view:report.intrastat.code:intrastat_product.product_intrastat_code_form
170+msgid "Intrastat Code"
171+msgstr ""
172+
173+#. module: intrastat_product
174+#: view:report.intrastat.code:intrastat_product.product_intrastat_code_tree
175+msgid "Intrastat Codes"
176+msgstr ""
177+
178+#. module: intrastat_product
179+#: view:product.category:intrastat_product.product_category_form_view
180+msgid "Intrastat Properties"
181+msgstr ""
182+
183+#. module: intrastat_product
184+#: field:report.intrastat.code,write_uid:0
185+msgid "Last Updated by"
186+msgstr ""
187+
188+#. module: intrastat_product
189+#: field:report.intrastat.code,write_date:0
190+msgid "Last Updated on"
191+msgstr ""
192+
193+#. module: intrastat_product
194+#: model:ir.model,name:intrastat_product.model_product_category
195+msgid "Product Category"
196+msgstr ""
197+
198+#. module: intrastat_product
199+#: model:ir.model,name:intrastat_product.model_product_template
200+msgid "Product Template"
201+msgstr ""
202+
203+#. module: intrastat_product
204+#: view:report.intrastat.code:intrastat_product.product_intrastat_code_search
205+msgid "Search Intrastat Codes"
206+msgstr ""
207+
208+#. module: intrastat_product
209+#: help:report.intrastat.code,description:0
210+msgid "Short text description of the H.S. category"
211+msgstr ""
212+
213+#. module: intrastat_product
214+#: sql_constraint:report.intrastat.code:0
215+msgid "This H.S. code already exists in Odoo !"
216+msgstr ""
217+
218
219=== added file 'intrastat_product/intrastat.py'
220--- intrastat_product/intrastat.py 1970-01-01 00:00:00 +0000
221+++ intrastat_product/intrastat.py 2014-12-13 00:30:09 +0000
222@@ -0,0 +1,113 @@
223+# -*- encoding: utf-8 -*-
224+##############################################################################
225+#
226+# Intrastat Product module for OpenERP
227+# Copyright (C) 2004-2009 Tiny SPRL (http://tiny.be)
228+# Copyright (C) 2010-2014 Akretion (http://www.akretion.com)
229+# @author Alexis de Lattre <alexis.delattre@akretion.com>
230+#
231+# This program is free software: you can redistribute it and/or modify
232+# it under the terms of the GNU Affero General Public License as
233+# published by the Free Software Foundation, either version 3 of the
234+# License, or (at your option) any later version.
235+#
236+# This program is distributed in the hope that it will be useful,
237+# but WITHOUT ANY WARRANTY; without even the implied warranty of
238+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
239+# GNU Affero General Public License for more details.
240+#
241+# You should have received a copy of the GNU Affero General Public License
242+# along with this program. If not, see <http://www.gnu.org/licenses/>.
243+#
244+##############################################################################
245+
246+from openerp import models, fields, api, _
247+from openerp.exceptions import ValidationError
248+
249+
250+class ReportIntrastatCode(models.Model):
251+ _name = "report.intrastat.code"
252+ _description = "H.S. Code"
253+ _order = "name"
254+
255+ name = fields.Char(
256+ string='H.S. code',
257+ help="Full length Harmonized System code (digits only). Full list is "
258+ "available from the World Customs Organisation, see "
259+ "http://www.wcoomd.org")
260+ description = fields.Char(
261+ 'Description', help="Short text description of the H.S. category")
262+ intrastat_code = fields.Char(
263+ string='European Intrastat Code', size=9, required=True,
264+ help="Code used for the Intrastat declaration. Must be part "
265+ "of the 'Combined Nomenclature' (CN), cf "
266+ "http://en.wikipedia.org/wiki/Combined_Nomenclature"
267+ "Must have 8 digits with sometimes a 9th digit.")
268+ intrastat_uom_id = fields.Many2one(
269+ 'product.uom', string='UoM for Intrastat Report',
270+ help="Select the unit of measure if one is required for "
271+ "this particular Intrastat Code (other than the weight in Kg). "
272+ "If no particular unit of measure is required, leave empty.")
273+ active = fields.Boolean(default=True)
274+
275+ @api.multi
276+ def name_get(self):
277+ res = []
278+ for code in self:
279+ name = code.name
280+ if code.description:
281+ name = u'%s %s' % (name, code.description)
282+ res.append((code.id, name))
283+ return res
284+
285+ @api.constrains('name', 'intrastat_code')
286+ def _hs_code(self):
287+ if self.name and not self.name.isdigit():
288+ raise ValidationError(
289+ _("H.S. codes should only contain digits. It is not the case "
290+ "of H.S. code '%s'.") % self.name)
291+ if self.intrastat_code and not self.intrastat_code.isdigit():
292+ raise ValidationError(
293+ _("The field Intrastat Code should only contain digits. "
294+ "It is not the case of Intrastat Code '%s'.")
295+ % self.intrastat_code)
296+ if self.intrastat_code and len(self.intrastat_code) not in (8, 9):
297+ raise ValidationError(
298+ _("The field Intrastat Code should "
299+ "contain 8 or 9 digits. It is not the case of "
300+ "Intrastat Code '%s'.")
301+ % self.intrastat_code)
302+
303+ _sql_constraints = [(
304+ 'hs_code_uniq',
305+ 'unique(name)',
306+ 'This H.S. code already exists in Odoo !'
307+ )]
308+
309+
310+class ProductTemplate(models.Model):
311+ _inherit = "product.template"
312+
313+ intrastat_id = fields.Many2one(
314+ 'report.intrastat.code', string='Intrastat Code',
315+ help="Code from the Harmonised System. Nomenclature is "
316+ "available from the World Customs Organisation, see "
317+ "http://www.wcoomd.org/. Some countries have made their own "
318+ "extensions to this nomenclature.")
319+ origin_country_id = fields.Many2one(
320+ 'res.country', string='Country of Origin',
321+ help="Country of origin of the product i.e. product "
322+ "'made in ____'. If you have different countries of origin "
323+ "depending on the supplier from which you purchased the product, "
324+ "leave this field empty and use the equivalent field on the "
325+ "'product supplier info' form.")
326+
327+
328+class ProductCategory(models.Model):
329+ _inherit = "product.category"
330+
331+ intrastat_id = fields.Many2one(
332+ 'report.intrastat.code', string='Intrastat Code',
333+ help="Code from the Harmonised System. If this code is not "
334+ "set on the product itself, it will be read here, on the "
335+ "related product category.")
336
337=== added file 'intrastat_product/intrastat_demo.xml'
338--- intrastat_product/intrastat_demo.xml 1970-01-01 00:00:00 +0000
339+++ intrastat_product/intrastat_demo.xml 2014-12-13 00:30:09 +0000
340@@ -0,0 +1,88 @@
341+<?xml version="1.0" encoding="utf-8"?>
342+
343+<!--
344+ Copyright (C) 2011-2014 Akretion (http://www.akretion.com/)
345+ @author Alexis de Lattre <alexis.delattre@akretion.com>
346+ The licence is in the file __openerp__.py
347+-->
348+
349+<openerp>
350+<data noupdate="1">
351+
352+<record id="84715000" model="report.intrastat.code">
353+ <field name="name">84715000</field>
354+ <field name="intrastat_code">84715000</field>
355+ <field name="intrastat_uom_id" ref="product.product_uom_unit"/>
356+ <field name="description">Automatic data-processing machines (computers)</field>
357+</record>
358+
359+<record id="84717050" model="report.intrastat.code">
360+ <field name="name">84717050</field>
361+ <field name="intrastat_code">84717050</field>
362+ <field name="intrastat_uom_id" ref="product.product_uom_unit"/>
363+ <field name="description">Storage units</field>
364+</record>
365+
366+<record id="85340090" model="report.intrastat.code">
367+ <field name="name">85340090</field>
368+ <field name="intrastat_code">85340090</field>
369+ <field name="description">Printed circuits</field>
370+</record>
371+
372+<record id="product.product_product_3" model="product.product">
373+ <field name="intrastat_id" ref="84715000" />
374+ <field name="origin_country_id" ref="base.tw" />
375+ <field name="weight_net">5</field>
376+</record>
377+
378+<record id="product.product_product_4" model="product.product">
379+ <field name="intrastat_id" ref="84715000" />
380+ <field name="origin_country_id" ref="base.cn" />
381+ <field name="weight_net">6</field>
382+</record>
383+
384+<record id="product.product_product_5" model="product.product">
385+ <field name="intrastat_id" ref="84715000" />
386+ <field name="origin_country_id" ref="base.cn" />
387+ <field name="weight_net">6.5</field>
388+</record>
389+
390+<record id="product.product_product_17" model="product.product">
391+ <field name="intrastat_id" ref="84717050" />
392+ <field name="origin_country_id" ref="base.sg" />
393+ <field name="weight_net">0.5</field>
394+</record>
395+
396+<record id="product.product_product_18" model="product.product">
397+ <field name="intrastat_id" ref="84717050" />
398+ <field name="origin_country_id" ref="base.sg" />
399+ <field name="weight_net">0.5</field>
400+</record>
401+
402+<record id="product.product_product_19" model="product.product">
403+ <field name="intrastat_id" ref="84717050" />
404+ <field name="origin_country_id" ref="base.sg" />
405+ <field name="weight_net">0.5</field>
406+</record>
407+
408+<record id="product.product_product_20" model="product.product">
409+ <field name="intrastat_id" ref="85340090" />
410+ <field name="origin_country_id" ref="base.tw" />
411+ <field name="weight_net">0.7</field>
412+</record>
413+
414+<record id="product.product_product_21" model="product.product">
415+ <field name="intrastat_id" ref="85340090" />
416+ <field name="origin_country_id" ref="base.tw" />
417+ <field name="weight_net">0.8</field>
418+</record>
419+
420+<record id="product.product_product_25" model="product.product">
421+ <field name="intrastat_id" ref="84715000" />
422+ <field name="origin_country_id" ref="base.be" />
423+ <field name="weight_net">2</field>
424+</record>
425+
426+
427+</data>
428+</openerp>
429
430=== added file 'intrastat_product/intrastat_view.xml'
431--- intrastat_product/intrastat_view.xml 1970-01-01 00:00:00 +0000
432+++ intrastat_product/intrastat_view.xml 2014-12-13 00:30:09 +0000
433@@ -0,0 +1,95 @@
434+<?xml version="1.0" encoding="utf-8"?>
435+
436+<!--
437+ Copyright (C) 2010-2014 Akretion (http://www.akretion.com/)
438+ @author Alexis de Lattre <alexis.delattre@akretion.com>
439+ The licence is in the file __openerp__.py
440+-->
441+
442+<openerp>
443+<data>
444+
445+<!-- product.template form view -->
446+<record id="product_template_form_view" model="ir.ui.view">
447+ <field name="name">intrastat.product.template.form</field>
448+ <field name="model">product.template</field>
449+ <field name="inherit_id" ref="intrastat_base.product_template_form_view" />
450+ <field name="arch" type="xml">
451+ <field name="exclude_from_intrastat" position="before">
452+ <field name="intrastat_id" attrs="{'invisible': [('type', '=', 'service')]}"/>
453+ <field name="origin_country_id" attrs="{'invisible': [('type', '=', 'service')]}"/>
454+ </field>
455+ </field>
456+</record>
457+
458+<!-- Product category form view -->
459+<record id="product_category_form_view" model="ir.ui.view">
460+ <field name="name">intrastat.product.category.form</field>
461+ <field name="model">product.category</field>
462+ <field name="inherit_id" ref="product.product_category_form_view"/>
463+ <field name="arch" type="xml">
464+ <xpath expr="//group[@name='parent']" position="inside">
465+ <group name="intrastat" string="Intrastat Properties" colspan="2">
466+ <field name="intrastat_id" />
467+ </group>
468+ </xpath>
469+ </field>
470+</record>
471+
472+<!-- Add search view for H.S. code -->
473+<record id="product_intrastat_code_search" model="ir.ui.view">
474+ <field name="name">intrastat.product.intrastat.code.search</field>
475+ <field name="model">report.intrastat.code</field>
476+ <field name="arch" type="xml">
477+ <search string="Search Intrastat Codes">
478+ <field name="name"
479+ filter_domain="['|', '|', ('name', 'like', self), ('intrastat_code', 'like', self), ('description', 'ilike', self)]"/>
480+ </search>
481+ </field>
482+</record>
483+
484+<!-- Add tree view for H.S. code -->
485+<record id="product_intrastat_code_tree" model="ir.ui.view">
486+ <field name="name">intrastat.product.intrastat.code.tree</field>
487+ <field name="model">report.intrastat.code</field>
488+ <field name="arch" type="xml">
489+ <tree string="Intrastat Codes">
490+ <field name="name"/>
491+ <field name="intrastat_code" />
492+ <field name="intrastat_uom_id"/>
493+ <field name="description"/>
494+ </tree>
495+ </field>
496+</record>
497+
498+<!-- Add form view for H.S. code -->
499+<record id="product_intrastat_code_form" model="ir.ui.view">
500+ <field name="name">fr.intrastat.product.intrastat.code.form</field>
501+ <field name="model">report.intrastat.code</field>
502+ <field name="arch" type="xml">
503+ <form string="Intrastat Code">
504+ <group name="main">
505+ <field name="name" />
506+ <field name="intrastat_code"/>
507+ <field name="intrastat_uom_id"/>
508+ <field name="description" />
509+ <field name="active"/>
510+ </group>
511+ </form>
512+ </field>
513+</record>
514+
515+<!-- Action for H.S. code -->
516+<record id="product_intrastat_code_act" model="ir.actions.act_window">
517+ <field name="name">Intrastat Code</field>
518+ <field name="res_model">report.intrastat.code</field>
519+ <field name="view_mode">tree,form</field>
520+</record>
521+
522+<!-- Menu entry for H.S. code -->
523+<menuitem id="product_intrastat_code_menu"
524+ action="product_intrastat_code_act"
525+ parent="product.prod_config_main" />
526+
527+</data>
528+</openerp>
529
530=== added directory 'intrastat_product/security'
531=== added file 'intrastat_product/security/ir.model.access.csv'
532--- intrastat_product/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
533+++ intrastat_product/security/ir.model.access.csv 2014-12-13 00:30:09 +0000
534@@ -0,0 +1,3 @@
535+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
536+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
537+access_report_intrastat_code_employee,Read access on report.intrastat.code to employee,model_report_intrastat_code,base.group_user,1,0,0,0
538
539=== modified file 'l10n_fr_intrastat_product/__openerp__.py'
540--- l10n_fr_intrastat_product/__openerp__.py 2014-07-03 22:18:44 +0000
541+++ l10n_fr_intrastat_product/__openerp__.py 2014-12-13 00:30:09 +0000
542@@ -23,7 +23,7 @@
543
544 {
545 'name': 'France Intrastat Product',
546- 'version': '1.1',
547+ 'version': '1.2',
548 'category': 'Localisation/Report Intrastat',
549 'license': 'AGPL-3',
550 'summary': 'Module for Intrastat product reporting (DEB) for France',
551@@ -35,7 +35,7 @@
552 """,
553 'author': 'Akretion',
554 'website': 'http://www.akretion.com',
555- 'depends': ['intrastat_base', 'sale_stock', 'purchase', 'l10n_fr_siret'],
556+ 'depends': ['intrastat_product', 'sale_stock', 'purchase', 'l10n_fr_siret'],
557 'data': [
558 'security/intrastat_product_security.xml',
559 'security/ir.model.access.csv',
560@@ -51,6 +51,5 @@
561 ],
562 'demo': ['intrastat_demo.xml'],
563 'installable': True,
564- 'active': False,
565 'application': True,
566 }
567
568=== modified file 'l10n_fr_intrastat_product/intrastat_demo.xml'
569--- l10n_fr_intrastat_product/intrastat_demo.xml 2014-10-30 12:30:41 +0000
570+++ l10n_fr_intrastat_product/intrastat_demo.xml 2014-12-13 00:30:09 +0000
571@@ -21,84 +21,10 @@
572 <field name="country_id" ref="base.fr"/>
573 </record>
574
575-<record id="84715000" model="report.intrastat.code">
576- <field name="name">84715000</field>
577- <field name="description">Automatic data-processing machines (computers)</field>
578- <field name="intrastat_code">84715000</field>
579- <field name="intrastat_uom_id" ref="product.product_uom_unit"/>
580-</record>
581-
582-<record id="84717050" model="report.intrastat.code">
583- <field name="name">84717050</field>
584- <field name="description">Storage units</field>
585- <field name="intrastat_code">84717050</field>
586- <field name="intrastat_uom_id" ref="product.product_uom_unit"/>
587-</record>
588-
589-<record id="85340090" model="report.intrastat.code">
590- <field name="name">85340090</field>
591- <field name="description">Printed circuits</field>
592- <field name="intrastat_code">85340090</field>
593-</record>
594-
595 <record id="product.product_uom_unit" model="product.uom">
596 <field name="intrastat_label">PCE</field>
597 </record>
598
599-<record id="product.product_product_3" model="product.product">
600- <field name="country_id" ref="base.tw" />
601- <field name="intrastat_id" ref="84715000" />
602- <field name="weight_net">5</field>
603-</record>
604-
605-<record id="product.product_product_4" model="product.product">
606- <field name="country_id" ref="base.cn" />
607- <field name="intrastat_id" ref="84715000" />
608- <field name="weight_net">6</field>
609-</record>
610-
611-<record id="product.product_product_5" model="product.product">
612- <field name="country_id" ref="base.cn" />
613- <field name="intrastat_id" ref="84715000" />
614- <field name="weight_net">6</field>
615-</record>
616-
617-<record id="product.product_product_25" model="product.product">
618- <field name="country_id" ref="base.be" />
619- <field name="intrastat_id" ref="84715000" />
620- <field name="weight_net">2</field>
621-</record>
622-
623-<record id="product.product_product_17" model="product.product">
624- <field name="country_id" ref="base.sg" />
625- <field name="intrastat_id" ref="84717050" />
626- <field name="weight_net">0.5</field>
627-</record>
628-
629-<record id="product.product_product_18" model="product.product">
630- <field name="country_id" ref="base.sg" />
631- <field name="intrastat_id" ref="84717050" />
632- <field name="weight_net">0.5</field>
633-</record>
634-
635-<record id="product.product_product_19" model="product.product">
636- <field name="country_id" ref="base.sg" />
637- <field name="intrastat_id" ref="84717050" />
638- <field name="weight_net">0.5</field>
639-</record>
640-
641-<record id="product.product_product_20" model="product.product">
642- <field name="country_id" ref="base.tw" />
643- <field name="intrastat_id" ref="85340090" />
644- <field name="weight_net">0.7</field>
645-</record>
646-
647-<record id="product.product_product_21" model="product.product">
648- <field name="country_id" ref="base.tw" />
649- <field name="intrastat_id" ref="85340090" />
650- <field name="weight_net">0.8</field>
651-</record>
652-
653 <!-- Elec import is the fiscal rep of Asustek -->
654 <record id="base.res_partner_1" model="res.partner">
655 <field name="intrastat_fiscal_representative" ref="base.res_partner_2" />
656
657=== modified file 'l10n_fr_intrastat_product/intrastat_product.py'
658--- l10n_fr_intrastat_product/intrastat_product.py 2014-10-30 12:30:41 +0000
659+++ l10n_fr_intrastat_product/intrastat_product.py 2014-12-13 00:30:09 +0000
660@@ -32,15 +32,15 @@
661 logger = logging.getLogger(__name__)
662
663
664-class report_intrastat_product(orm.Model):
665- _name = "report.intrastat.product"
666- _description = "Intrastat Product"
667+class l10n_fr_report_intrastat_product(orm.Model):
668+ _name = "l10n.fr.report.intrastat.product"
669+ _description = "Intrastat Product for France (DEB)"
670 _rec_name = "start_date"
671 _inherit = ['mail.thread']
672 _order = "start_date desc, type"
673 _track = {
674 'state': {
675- 'l10n_fr_intrastat_product.declaration_done': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done',
676+ 'l10n_fr_intrastat_product.l10n_fr_declaration_done': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done',
677 }
678 }
679
680@@ -53,7 +53,7 @@
681 'intrastat_line_ids': False,
682 'state': 'draft',
683 })
684- return super(report_intrastat_product, self).copy(cr, uid, id, default=default, context=context)
685+ return super(l10n_fr_report_intrastat_product, self).copy(cr, uid, id, default=default, context=context)
686
687
688 def _compute_numbers(self, cr, uid, ids, name, arg, context=None):
689@@ -73,7 +73,7 @@
690 return self.pool.get('report.intrastat.common')._compute_dates(cr, uid, ids, self, context=context)
691
692 def _get_intrastat_from_product_line(self, cr, uid, ids, context=None):
693- return self.pool.get('report.intrastat.product').search(cr, uid, [('intrastat_line_ids', 'in', ids)], context=context)
694+ return self.pool.get('l10n.fr.report.intrastat.product').search(cr, uid, [('intrastat_line_ids', 'in', ids)], context=context)
695
696 _columns = {
697 'company_id': fields.many2one('res.company', 'Company', required=True,
698@@ -84,13 +84,13 @@
699 'end_date': fields.function(_compute_dates, type='date',
700 string='End date', multi='intrastat-product-dates', readonly=True,
701 store={
702- 'report.intrastat.product': (lambda self, cr, uid, ids, c={}: ids, ['start_date'], 10),
703+ 'l10n.fr.report.intrastat.product': (lambda self, cr, uid, ids, c={}: ids, ['start_date'], 10),
704 },
705 help="End date for the declaration. Is the last day of the month of the start date."),
706 'year_month': fields.function(_compute_dates, type='char',
707 string='Month', multi='intrastat-product-dates', readonly=True,
708 track_visibility='always', store={
709- 'report.intrastat.product': (lambda self, cr, uid, ids, c={}: ids, ['start_date'], 10)
710+ 'l10n.fr.report.intrastat.product': (lambda self, cr, uid, ids, c={}: ids, ['start_date'], 10)
711 },
712 help="Year and month of the declaration."),
713 'type': fields.selection([
714@@ -104,24 +104,24 @@
715 ], 'Obligation level', required=True, track_visibility='always',
716 states={'done': [('readonly', True)]},
717 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."),
718- 'intrastat_line_ids': fields.one2many('report.intrastat.product.line',
719+ 'intrastat_line_ids': fields.one2many('l10n.fr.report.intrastat.product.line',
720 'parent_id', 'Report intrastat product lines',
721 states={'done': [('readonly', True)]}),
722 'num_lines': fields.function(_compute_numbers, type='integer',
723 multi='numbers', string='Number of lines', store={
724- 'report.intrastat.product.line': (_get_intrastat_from_product_line, ['parent_id'], 20),
725+ 'l10n.fr.report.intrastat.product.line': (_get_intrastat_from_product_line, ['parent_id'], 20),
726 },
727 track_visibility='always', help="Number of lines in this declaration."),
728 'total_amount': fields.function(_compute_numbers,
729 digits_compute=dp.get_precision('Account'), multi='numbers',
730 string='Total amount', store={
731- 'report.intrastat.product.line': (_get_intrastat_from_product_line, ['amount_company_currency', 'parent_id'], 20),
732+ 'l10n.fr.report.intrastat.product.line': (_get_intrastat_from_product_line, ['amount_company_currency', 'parent_id'], 20),
733 },
734 help="Total amount in company currency of the declaration."),
735 'total_fiscal_amount': fields.function(_compute_total_fiscal_amount,
736 digits_compute=dp.get_precision('Account'),
737 string='Total fiscal amount', track_visibility='always', store={
738- 'report.intrastat.product.line': (_get_intrastat_from_product_line, ['amount_company_currency', 'parent_id'], 20),
739+ 'l10n.fr.report.intrastat.product.line': (_get_intrastat_from_product_line, ['amount_company_currency', 'parent_id'], 20),
740 },
741 help="Total fiscal amount in company currency of the declaration. This is the total amount that is displayed on the Prodouane website."),
742 'currency_id': fields.related('company_id', 'currency_id', readonly=True,
743@@ -135,12 +135,12 @@
744 }
745
746 def default_get(self, cr, uid, fields_list, context=None):
747- res = super(report_intrastat_product, self).default_get(
748+ res = super(l10n_fr_report_intrastat_product, self).default_get(
749 cr, uid, fields_list, context=context)
750 if not res:
751 res = {}
752 company_id = self.pool['res.company']._company_default_get(
753- cr, uid, 'report.intrastat.product', context=context)
754+ cr, uid, 'l10n.fr.report.intrastat.product', context=context)
755 company = self.pool['res.company'].browse(
756 cr, uid, company_id, context=context)
757 if company.import_obligation_level == 'none':
758@@ -204,7 +204,7 @@
759 assert len(ids) == 1, "Only one ID accepted"
760 if context is None:
761 context = {}
762- line_obj = self.pool['report.intrastat.product.line']
763+ line_obj = self.pool['l10n.fr.report.intrastat.product.line']
764
765 data_obj = self.pool['ir.model.data']
766 uom_categ_model, weight_uom_categ_id = data_obj.get_object_reference(
767@@ -320,9 +320,9 @@
768 # The origin country should only be declated on Import
769 if intrastat.type == 'export':
770 product_country_origin_id_to_write = False
771- elif line.product_id.country_id:
772+ elif line.product_id.origin_country_id:
773 # If we have the country of origin on the product -> take it
774- product_country_origin_id_to_write = line.product_id.country_id.id
775+ product_country_origin_id_to_write = line.product_id.origin_country_id.id
776 else:
777 # If we don't, look on the product supplier info
778 origin_partner_id = parent_values.get('origin_partner_id', False)
779@@ -500,7 +500,7 @@
780 assert len(ids) == 1, "Only one ID accepted"
781 intrastat = self.browse(cr, uid, ids[0], context=context)
782 self.pool.get('report.intrastat.common')._check_generate_lines(cr, uid, intrastat, context=context)
783- line_obj = self.pool.get('report.intrastat.product.line')
784+ line_obj = self.pool.get('l10n.fr.report.intrastat.product.line')
785 line_remove_ids = line_obj.search(cr, uid, [('parent_id', '=', ids[0]), ('invoice_id', '!=', False)], context=context)
786 if line_remove_ids:
787 line_obj.unlink(cr, uid, line_remove_ids, context=context)
788@@ -793,13 +793,13 @@
789 return True
790
791
792-class report_intrastat_product_line(orm.Model):
793- _name = "report.intrastat.product.line"
794- _description = "Intrastat Product Lines"
795+class l10n_fr_report_intrastat_product_line(orm.Model):
796+ _name = "l10n.fr.report.intrastat.product.line"
797+ _description = "Intrastat Product Lines for France"
798 _order = 'id'
799
800 _columns = {
801- '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),
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),
806@@ -830,7 +830,7 @@
807 digits_compute=dp.get_precision('Account'), readonly=True,
808 help="Amount of product value in invoice currency ; it is the amount of the invoice line or group of invoice lines."),
809 'invoice_currency_id': fields.many2one('res.currency', "Invoice currency", readonly=True),
810- 'product_country_origin_id': fields.many2one('res.country', 'Product country of origin'),
811+ 'product_country_origin_id': fields.many2one('res.country', 'Product country of origin'), # TODO rename product_origin_country_id
812 'product_country_origin_code': fields.related('product_country_origin_id', 'code', type='char', relation='res.country', string='Product country of origin', readonly=True),
813 'transport': fields.selection([
814 (1, '1. Transport maritime'),
815
816=== modified file 'l10n_fr_intrastat_product/intrastat_product_reminder.xml'
817--- l10n_fr_intrastat_product/intrastat_product_reminder.xml 2014-04-14 17:41:39 +0000
818+++ l10n_fr_intrastat_product/intrastat_product_reminder.xml 2014-12-13 00:30:09 +0000
819@@ -9,7 +9,7 @@
820 <openerp>
821
822 <data noupdate="1"> <!-- noupdate = 1 for the 'active' field -->
823-<record id="intrastat_product_cron" model="ir.cron">
824+<record id="l10n_fr_intrastat_product_cron" model="ir.cron">
825 <field name="name">Intrastat Product Reminder</field>
826 <field name="active" eval="False"/>
827 <field name="user_id" ref="base.user_root"/>
828@@ -17,7 +17,7 @@
829 <field name="interval_type">months</field>
830 <field name="numbercall">-1</field> <!-- don't limit the number of calls -->
831 <field name="doall" eval="False"/>
832- <field name="model" eval="'report.intrastat.product'"/>
833+ <field name="model" eval="'l10n.fr.report.intrastat.product'"/>
834 <field name="function" eval="'_scheduler_reminder'" />
835 <field name="args" eval="'()'"/>
836 </record>
837@@ -25,9 +25,9 @@
838 </data>
839 <data>
840
841-<record id="intrastat_product_reminder_email_template" model="email.template">
842+<record id="l10n_fr_intrastat_product_reminder_email_template" model="email.template">
843 <field name="name">Intrastat Product Reminder</field>
844- <field name="model_id" ref="l10n_fr_intrastat_product.model_report_intrastat_product"/>
845+ <field name="model_id" ref="l10n_fr_intrastat_product.model_l10n_fr_report_intrastat_product"/>
846 <field name="email_from">${object.company_id.email or 'openerp@example.com'}</field>
847 <field name="email_to">${object.company_id.intrastat_email_list}</field>
848 <field name="subject">${object.type} Intrastat Product ${object.year_month} for ${object.company_id.name}</field>
849
850=== modified file 'l10n_fr_intrastat_product/intrastat_product_view.xml'
851--- l10n_fr_intrastat_product/intrastat_product_view.xml 2014-07-03 22:18:44 +0000
852+++ l10n_fr_intrastat_product/intrastat_product_view.xml 2014-12-13 00:30:09 +0000
853@@ -10,9 +10,9 @@
854 <data>
855
856 <!-- Form view of DEB, with integrated form+tree view of lines -->
857-<record id="intrastat_product_form" model="ir.ui.view">
858- <field name="name">fr.intrastat.product.form</field>
859- <field name="model">report.intrastat.product</field>
860+<record id="l10n_fr_intrastat_product_form" model="ir.ui.view">
861+ <field name="name">l10n.fr.intrastat.product.form</field>
862+ <field name="model">l10n.fr.report.intrastat.product</field>
863 <field name="arch" type="xml">
864 <form string="Intrastat Product">
865 <header>
866@@ -108,9 +108,9 @@
867 </record>
868
869 <!-- Tree view for DEB -->
870-<record id="intrastat_product_tree" model="ir.ui.view">
871- <field name="name">fr.intrastat.product.tree</field>
872- <field name="model">report.intrastat.product</field>
873+<record id="l10n_fr_intrastat_product_tree" model="ir.ui.view">
874+ <field name="name">l10n.fr.intrastat.product.tree</field>
875+ <field name="model">l10n.fr.report.intrastat.product</field>
876 <field name="arch" type="xml">
877 <tree string="Intrastat Product" colors="blue:state=='draft'">
878 <field name="year_month" />
879@@ -128,9 +128,9 @@
880
881
882 <!-- Search view for DEB -->
883-<record id="intrastat_product_search" model="ir.ui.view">
884- <field name="name">fr.intrastat.product.search</field>
885- <field name="model">report.intrastat.product</field>
886+<record id="l10n_fr_intrastat_product_search" model="ir.ui.view">
887+ <field name="name">l10n.fr.intrastat.product.search</field>
888+ <field name="model">l10n.fr.report.intrastat.product</field>
889 <field name="arch" type="xml">
890 <search string="Search Intrastat Products">
891 <filter name="import" string="Import" domain="[('type', '=', 'import')]" />
892@@ -146,9 +146,9 @@
893 </record>
894
895 <!-- Graph view for DEB -->
896-<record id="intrastat_product_graph" model="ir.ui.view">
897- <field name="name">fr.intrastat.product.graph</field>
898- <field name="model">report.intrastat.product</field>
899+<record id="l10n_fr_intrastat_product_graph" model="ir.ui.view">
900+ <field name="name">l10n.fr.intrastat.product.graph</field>
901+ <field name="model">l10n.fr.report.intrastat.product</field>
902 <field name="arch" type="xml">
903 <graph string="Intrastat Product" type="bar">
904 <field name="start_date" type="row"/>
905@@ -159,21 +159,23 @@
906 </record>
907
908 <!-- Action related -->
909-<record id="intrastat_product_tree_action" model="ir.actions.act_window">
910+<record id="l10n_fr_intrastat_product_tree_action" model="ir.actions.act_window">
911 <field name="name">Intrastat Product</field>
912- <field name="res_model">report.intrastat.product</field>
913+ <field name="res_model">l10n.fr.report.intrastat.product</field>
914 <field name="view_mode">tree,form,graph</field>
915 </record>
916
917
918 <!-- Intrastat product menu -->
919-<menuitem id="intrastat_product_menu" parent="intrastat_base.menu_intrastat_base_root" action="intrastat_product_tree_action" />
920+<menuitem id="l10n_fr_intrastat_product_menu"
921+ parent="intrastat_base.menu_intrastat_base_root"
922+ action="l10n_fr_intrastat_product_tree_action" />
923
924
925 <!-- Notification in the chatter -->
926-<record id="declaration_done" model="mail.message.subtype">
927+<record id="l10n_fr_declaration_done" model="mail.message.subtype">
928 <field name="name">Intrastat Product Validated</field>
929- <field name="res_model">report.intrastat.product</field>
930+ <field name="res_model">l10n.fr.report.intrastat.product</field>
931 <field name="default" eval="False"/>
932 <field name="description">Intrastat Product Validated</field>
933 </record>
934
935=== added directory 'l10n_fr_intrastat_product/migrations'
936=== added directory 'l10n_fr_intrastat_product/migrations/8.0.1.2'
937=== added file 'l10n_fr_intrastat_product/migrations/8.0.1.2/pre-migration.py'
938--- l10n_fr_intrastat_product/migrations/8.0.1.2/pre-migration.py 1970-01-01 00:00:00 +0000
939+++ l10n_fr_intrastat_product/migrations/8.0.1.2/pre-migration.py 2014-12-13 00:30:09 +0000
940@@ -0,0 +1,57 @@
941+# -*- encoding: utf-8 -*-
942+##############################################################################
943+#
944+# Report intrastat product module for OpenERP
945+# Copyright (C) 2014 Akretion (http://www.akretion.com)
946+# @author Alexis de Lattre <alexis.delattre@akretion.com>
947+#
948+# This program is free software: you can redistribute it and/or modify
949+# it under the terms of the GNU Affero General Public License as
950+# published by the Free Software Foundation, either version 3 of the
951+# License, or (at your option) any later version.
952+#
953+# This program is distributed in the hope that it will be useful,
954+# but WITHOUT ANY WARRANTY; without even the implied warranty of
955+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
956+# GNU Affero General Public License for more details.
957+#
958+# You should have received a copy of the GNU Affero General Public License
959+# along with this program. If not, see <http://www.gnu.org/licenses/>.
960+#
961+##############################################################################
962+
963+def migrate(cr, version):
964+ if not version:
965+ return
966+
967+ cr.execute(
968+ 'ALTER SEQUENCE "report_intrastat_product_line_id_seq" RENAME TO '
969+ '"l10n_fr_report_intrastat_product_line_id_seq"')
970+
971+ cr.execute(
972+ 'ALTER TABLE "report_intrastat_product_line" RENAME TO '
973+ '"l10n_fr_report_intrastat_product_line"')
974+
975+ cr.execute(
976+ "UPDATE ir_model SET model='l10n.fr.report.intrastat.product.line' "
977+ "WHERE model='report.intrastat.product.line'")
978+
979+ cr.execute(
980+ "UPDATE ir_model_fields SET relation='l10n.fr.report.intrastat.product.line' "
981+ "WHERE relation='report.intrastat.product.line'")
982+
983+ cr.execute(
984+ 'ALTER SEQUENCE "report_intrastat_product_id_seq" RENAME TO '
985+ '"l10n_fr_report_intrastat_product_id_seq"')
986+
987+ cr.execute(
988+ 'ALTER TABLE "report_intrastat_product" RENAME TO '
989+ '"l10n_fr_report_intrastat_product"')
990+
991+ cr.execute(
992+ "UPDATE ir_model SET model='l10n.fr.report.intrastat.product' "
993+ "WHERE model='report.intrastat.product'")
994+
995+ cr.execute(
996+ "UPDATE ir_model_fields SET relation='l10n.fr.report.intrastat.product' "
997+ "WHERE relation='report.intrastat.product'")
998
999=== modified file 'l10n_fr_intrastat_product/product.py'
1000--- l10n_fr_intrastat_product/product.py 2014-10-30 12:30:41 +0000
1001+++ l10n_fr_intrastat_product/product.py 2014-12-13 00:30:09 +0000
1002@@ -21,158 +21,47 @@
1003 #
1004 ##############################################################################
1005
1006-from openerp.osv import orm, fields
1007-from openerp.tools.translate import _
1008-
1009-
1010-class report_intrastat_code(orm.Model):
1011- _name = "report.intrastat.code"
1012- _description = "Intrastat code"
1013- _order = "name"
1014- _columns = {
1015- 'name': fields.char(
1016- 'H.S. code', size=16, required=True,
1017- help="Full lenght H.S. code"),
1018- 'description': fields.char(
1019- 'Description', size=255,
1020- help='Short text description of the H.S. category'),
1021- 'intrastat_code': fields.char(
1022- 'Intrastat code for DEB', size=9, required=True,
1023- help="H.S. code used for the DEB in France. Must be part "
1024- "of the 'Nomenclature combinée' (NC) with 8 digits with "
1025- "sometimes a 9th digit for the "
1026- "'Nomenclature Générale des Produits' (NGP)."),
1027- 'intrastat_uom_id': fields.many2one(
1028- 'product.uom', 'UoM for intrastat product report',
1029- help="Select the unit of measure if one is required for "
1030- "this particular intrastat code (other than the weight in Kg). "
1031- "If no particular unit of measure is required, leave empty."),
1032- }
1033-
1034- def name_get(self, cr, uid, ids, context=None):
1035- res = []
1036- for code in self.read(
1037- cr, uid, ids, ['name', 'description'], context=context):
1038- display_name = code['name']
1039- if code['description']:
1040- display_name = '%s %s' % (display_name, code['description'])
1041- res.append((code['id'], display_name))
1042- return res
1043-
1044- def _intrastat_code(self, cr, uid, ids):
1045- for intrastat_code_to_check in self.read(
1046- cr, uid, ids, ['intrastat_code']):
1047- if intrastat_code_to_check['intrastat_code']:
1048- if (not intrastat_code_to_check['intrastat_code'].isdigit()
1049- or len(intrastat_code_to_check['intrastat_code'])
1050- not in (8, 9)):
1051- return False
1052- return True
1053-
1054- def _hs_code(self, cr, uid, ids):
1055- for code_to_check in self.read(cr, uid, ids, ['name']):
1056- if code_to_check['name']:
1057- if not code_to_check['name'].isdigit():
1058- return False
1059- return True
1060-
1061- _constraints = [
1062- (
1063- _intrastat_code,
1064- "The 'Intrastat code for DEB' should have exactly 8 or 9 digits.",
1065- ['intrastat_code']
1066- ),
1067- (
1068- _hs_code,
1069- "'Intrastat code' should only contain digits.",
1070- ['name']
1071- ),
1072- ]
1073-
1074-
1075-class product_uom(orm.Model):
1076+from openerp import models, fields, api, _
1077+from openerp.exceptions import ValidationError
1078+
1079+
1080+class ProductUom(models.Model):
1081 _inherit = "product.uom"
1082- _columns = {
1083- 'intrastat_label': fields.char(
1084- 'Intrastat label', size=12,
1085- help="Label used in the XML file export of the Intrastat "
1086- "product report for this unit of measure."),
1087- }
1088-
1089-
1090-class product_template(orm.Model):
1091- _inherit = "product.template"
1092- _columns = {
1093- 'intrastat_id': fields.many2one(
1094- 'report.intrastat.code', 'Intrastat code',
1095- help="Code from the Harmonised System. Nomenclature is "
1096- "available from the World Customs Organisation, see "
1097- "http://www.wcoomd.org/. Some countries have made their own "
1098- "extensions to this nomenclature."),
1099- 'country_id': fields.many2one(
1100- 'res.country', 'Country of origin',
1101- help="Country of origin of the product i.e. product "
1102- "'made in ____'. If you have different countries of origin "
1103- "depending on the supplier from which you purchased the product, "
1104- "leave this field empty and use the equivalent field on the "
1105- "'product supplier info' form."),
1106- # This field should be called origin_country_id, but it's named
1107- # country_id to keep "compatibility with OpenERP users that used
1108- # the "report_intrastat" module
1109- }
1110-
1111-
1112-class product_category(orm.Model):
1113- _inherit = "product.category"
1114- _columns = {
1115- 'intrastat_id': fields.many2one(
1116- 'report.intrastat.code', 'Intrastat code',
1117- help="Code from the Harmonised System. If this code is not "
1118- "set on the product itself, it will be read here, on the "
1119- "related product category."),
1120- }
1121-
1122-
1123-class product_supplierinfo(orm.Model):
1124+
1125+ intrastat_label = fields.Char(
1126+ string='Intrastat Label', size=12,
1127+ help="Label used in the XML file export of the Intrastat "
1128+ "Product Report for this unit of measure.")
1129+
1130+
1131+class ProductSupplierinfo(models.Model):
1132 _inherit = "product.supplierinfo"
1133- _columns = {
1134- 'origin_country_id': fields.many2one(
1135- 'res.country', 'Country of origin',
1136- help="Country of origin of the product "
1137- "(i.e. product 'made in ____') when purchased from this supplier. "
1138- "This field is used only when the equivalent field on the product "
1139- "form is empty."),
1140- }
1141-
1142- def _same_supplier_same_origin(self, cr, uid, ids):
1143+
1144+ origin_country_id = fields.Many2one(
1145+ 'res.country', string='Country of Origin',
1146+ help="Country of origin of the product "
1147+ "(i.e. product 'made in ____') when purchased from this supplier. "
1148+ "This field is used only when the equivalent field on the product "
1149+ "form is empty.")
1150+
1151+ @api.constrains('origin_country_id', 'name', 'product_tmpl_id')
1152+ def _same_supplier_same_origin(self):
1153 """Products from the same supplier should have the same origin"""
1154- for supplierinfo in self.browse(cr, uid, ids):
1155- country_origin_id = supplierinfo.origin_country_id.id
1156- # Search for same supplier and same product
1157- same_product_same_supplier_ids = self.search(
1158- cr, uid, [
1159- ('product_id', '=', supplierinfo.product_id.id),
1160- ('name', '=', supplierinfo.name.id)])
1161+ # Search for same supplier and same product tmpl
1162+ same_product_same_suppliers = self.search([
1163+ ('product_tmpl_id', '=', self.product_tmpl_id.id),
1164+ ('name', '=', self.name.id)])
1165 # 'name' on product_supplierinfo is a many2one to res.partner
1166- for supplieri in self.browse(
1167- cr, uid, same_product_same_supplier_ids):
1168- if country_origin_id != supplieri.origin_country_id.id:
1169- raise orm.except_orm(
1170- _('Error !'),
1171- _("For a particular product, all supplier info "
1172- "entries with the same supplier should have the "
1173- "same country of origin. But, for product '%s' "
1174- "with supplier '%s', there is one entry with "
1175- "country of origin '%s' and another entry with "
1176- "country of origin '%s'.")
1177- % (supplieri.product_id.name,
1178- supplieri.name.name,
1179- supplierinfo.origin_country_id.name,
1180- supplieri.origin_country_id.name))
1181- return True
1182-
1183- _constraints = [(
1184- _same_supplier_same_origin,
1185- "Wrong configuration of the supplier information",
1186- ['origin_country_id', 'name', 'product_id']
1187- )]
1188+ for supplieri in same_product_same_suppliers:
1189+ if self.origin_country_id != supplieri.origin_country_id:
1190+ raise ValidationError(
1191+ _("For a particular product, all supplier info "
1192+ "entries with the same supplier should have the "
1193+ "same country of origin. But, for product '%s' "
1194+ "with supplier '%s', there is one entry with "
1195+ "country of origin '%s' and another entry with "
1196+ "country of origin '%s'.")
1197+ % (self.product_tmpl_id.name,
1198+ self.name.name,
1199+ self.origin_country_id.name,
1200+ supplieri.origin_country_id.name))
1201
1202=== modified file 'l10n_fr_intrastat_product/product_view.xml'
1203--- l10n_fr_intrastat_product/product_view.xml 2014-07-03 22:15:06 +0000
1204+++ l10n_fr_intrastat_product/product_view.xml 2014-12-13 00:30:09 +0000
1205@@ -9,19 +9,6 @@
1206 <openerp>
1207 <data>
1208
1209-<!-- Add fields on product.template view -->
1210-<record id="product_template_form_view" model="ir.ui.view">
1211- <field name="name">fr.intrastat.product.template.form</field>
1212- <field name="model">product.template</field>
1213- <field name="inherit_id" ref="intrastat_base.product_template_form_view" />
1214- <field name="arch" type="xml">
1215- <field name="exclude_from_intrastat" position="before">
1216- <field name="intrastat_id" attrs="{'invisible': [('type', '=', 'service')]}"/>
1217- <field name="country_id" attrs="{'invisible': [('type', '=', 'service')]}"/>
1218- </field>
1219- </field>
1220-</record>
1221-
1222 <!-- Add field on product.supplierinfo -->
1223 <record id="product_supplierinfo_form_view" model="ir.ui.view">
1224 <field name="name">fr.intrastat.product.product.supplierinfo.form</field>
1225@@ -34,89 +21,19 @@
1226 </field>
1227 </record>
1228
1229-<!-- Add intrastat_id on Product category -->
1230-<record id="product_category_form_view" model="ir.ui.view">
1231- <field name="name">fr.intrastat.product.category.form</field>
1232- <field name="model">product.category</field>
1233- <field name="inherit_id" ref="product.product_category_form_view"/>
1234- <field name="arch" type="xml">
1235- <xpath expr="//group[@name='parent']" position="inside">
1236- <group name="intrastat" string="Intrastat Properties" colspan="2">
1237- <field name="intrastat_id" />
1238- </group>
1239- </xpath>
1240- </field>
1241-</record>
1242-
1243 <!-- Add the field intrastat_label on product UoM -->
1244 <record id="product_uom_form_view" model="ir.ui.view">
1245 <field name="name">fr.intrastat.product.uom.form</field>
1246 <field name="model">product.uom</field>
1247 <field name="inherit_id" ref="product.product_uom_form_view" />
1248 <field name="arch" type="xml">
1249- <data>
1250- <field name="category_id" position="after">
1251- <field name="intrastat_label" groups="l10n_fr_intrastat_product.group_detailed_intrastat_product"/>
1252- </field>
1253- </data>
1254- </field>
1255-</record>
1256-
1257-<!-- Add search view for H.S. code -->
1258-<record id="product_intrastat_code_search" model="ir.ui.view">
1259- <field name="name">fr.intrastat.product.intrastat.code.search</field>
1260- <field name="model">report.intrastat.code</field>
1261- <field name="arch" type="xml">
1262- <search string="Search Intrastat Code">
1263- <field name="name" />
1264- <field name="description" />
1265- </search>
1266- </field>
1267-</record>
1268-
1269-
1270-<!-- Add tree view for H.S. code -->
1271-<record id="product_intrastat_code_tree" model="ir.ui.view">
1272- <field name="name">fr.intrastat.product.intrastat.code.tree</field>
1273- <field name="model">report.intrastat.code</field>
1274- <field name="arch" type="xml">
1275- <tree string="Intrastat code">
1276- <field name="name" />
1277- <field name="intrastat_code" />
1278- <field name="description" />
1279- <field name="intrastat_uom_id" groups="l10n_fr_intrastat_product.group_detailed_intrastat_product"/>
1280- </tree>
1281- </field>
1282-</record>
1283-
1284-
1285-<!-- Add form view for H.S. code -->
1286-<record id="product_intrastat_code_form" model="ir.ui.view">
1287- <field name="name">fr.intrastat.product.intrastat.code.form</field>
1288- <field name="model">report.intrastat.code</field>
1289- <field name="arch" type="xml">
1290- <form string="Intrastat code">
1291- <field name="name" />
1292- <field name="intrastat_code" />
1293- <field name="description" />
1294- <field name="intrastat_uom_id" />
1295- </form>
1296- </field>
1297-</record>
1298-
1299-<!-- Action for H.S. code -->
1300-<record id="product_intrastat_code_act" model="ir.actions.act_window">
1301- <field name="name">Intrastat Code</field>
1302- <field name="res_model">report.intrastat.code</field>
1303- <field name="view_mode">tree,form</field>
1304-</record>
1305-
1306-<!-- Menu entry for H.S. code -->
1307-<menuitem id="product_intrastat_code_menu" action="product_intrastat_code_act" parent="product.prod_config_main" />
1308-
1309-<menuitem id="product_intrastat_code_menu_purchase" action="product_intrastat_code_act" parent="purchase.menu_product_in_config_purchase" />
1310-
1311-<menuitem id="product_intrastat_code_menu_stock" action="product_intrastat_code_act" parent="stock.menu_product_in_config_stock" />
1312+ <field name="category_id" position="after">
1313+ <field name="intrastat_label"
1314+ groups="l10n_fr_intrastat_product.group_detailed_intrastat_product"/>
1315+ </field>
1316+ </field>
1317+</record>
1318+
1319
1320 </data>
1321 </openerp>
1322
1323=== modified file 'l10n_fr_intrastat_product/security/intrastat_product_security.xml'
1324--- l10n_fr_intrastat_product/security/intrastat_product_security.xml 2014-02-01 22:43:05 +0000
1325+++ l10n_fr_intrastat_product/security/intrastat_product_security.xml 2014-12-13 00:30:09 +0000
1326@@ -15,14 +15,14 @@
1327
1328 <record id="fr_intrastat_product_rule" model="ir.rule">
1329 <field name="name">Intrastat Product multi-company</field>
1330- <field name="model_id" ref="model_report_intrastat_product"/>
1331+ <field name="model_id" ref="model_l10n_fr_report_intrastat_product"/>
1332 <field name="global" eval="True"/>
1333 <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
1334 </record>
1335
1336 <record id="fr_intrastat_product_line_rule" model="ir.rule">
1337 <field name="name">Intrastat Product Line multi-company</field>
1338- <field name="model_id" ref="model_report_intrastat_product_line"/>
1339+ <field name="model_id" ref="model_l10n_fr_report_intrastat_product_line"/>
1340 <field name="global" eval="True"/>
1341 <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
1342 </record>
1343
1344=== modified file 'l10n_fr_intrastat_product/security/ir.model.access.csv'
1345--- l10n_fr_intrastat_product/security/ir.model.access.csv 2011-04-26 07:28:46 +0000
1346+++ l10n_fr_intrastat_product/security/ir.model.access.csv 2014-12-13 00:30:09 +0000
1347@@ -1,7 +1,5 @@
1348-"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
1349-"access_report_intrastat_type","report.intrastat.type","model_report_intrastat_type","account.group_account_manager",1,1,1,1
1350-"access_report_intrastat_code","report.intrastat.code finance manager","model_report_intrastat_code","account.group_account_manager",1,1,1,1
1351-"access_report_intrastat_code_product_manager","report.intrastat.code product manager","model_report_intrastat_code","account.group_account_manager",1,1,1,1
1352-"access_report_intrastat_code_employee","report.intrastat.code read for employee","model_report_intrastat_code","base.group_user",1,0,0,0
1353-"access_report_intrastat_product","report.intrastat.product","model_report_intrastat_product","account.group_account_manager",1,1,1,1
1354-"access_report_intrastat_product_line","report.intrastat.product.line","model_report_intrastat_product_line","account.group_account_manager",1,1,1,1
1355+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
1356+access_report_intrastat_type,report.intrastat.type,model_report_intrastat_type,account.group_account_manager,1,1,1,1
1357+access_report_intrastat_code,report.intrastat.code finance manager,intrastat_product.model_report_intrastat_code,account.group_account_manager,1,1,1,1
1358+access_report_intrastat_product,report.intrastat.product,model_l10n_fr_report_intrastat_product,account.group_account_manager,1,1,1,1
1359+access_report_intrastat_product_line,report.intrastat.product.line,model_l10n_fr_report_intrastat_product_line,account.group_account_manager,1,1,1,1
1360
1361=== modified file 'l10n_fr_intrastat_service/__openerp__.py'
1362--- l10n_fr_intrastat_service/__openerp__.py 2014-02-01 22:43:05 +0000
1363+++ l10n_fr_intrastat_service/__openerp__.py 2014-12-13 00:30:09 +0000
1364@@ -23,7 +23,7 @@
1365
1366 {
1367 'name': 'France Intrastat Service',
1368- 'version': '1.1',
1369+ 'version': '1.2',
1370 'category': 'Localisation/Report Intrastat',
1371 'license': 'AGPL-3',
1372 'summary': 'Module for Intrastat service reporting (DES) for France',
1373@@ -46,6 +46,5 @@
1374 ],
1375 'demo': [],
1376 'installable': True,
1377- 'active': False,
1378 'application': True,
1379 }
1380
1381=== modified file 'l10n_fr_intrastat_service/intrastat_service.py'
1382--- l10n_fr_intrastat_service/intrastat_service.py 2014-04-14 17:41:39 +0000
1383+++ l10n_fr_intrastat_service/intrastat_service.py 2014-12-13 00:30:09 +0000
1384@@ -33,15 +33,15 @@
1385 logger = logging.getLogger(__name__)
1386
1387
1388-class report_intrastat_service(orm.Model):
1389- _name = "report.intrastat.service"
1390+class l10n_fr_report_intrastat_service(orm.Model):
1391+ _name = "l10n.fr.report.intrastat.service"
1392 _order = "start_date desc"
1393 _rec_name = "start_date"
1394 _inherit = ['mail.thread']
1395 _description = "Intrastat Service"
1396 _track = {
1397 'state': {
1398- 'l10n_fr_intrastat_service.declaration_done':
1399+ 'l10n_fr_intrastat_service.l10n_fr_declaration_done':
1400 lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done',
1401 }
1402 }
1403@@ -56,7 +56,7 @@
1404 'intrastat_line_ids': False,
1405 'state': 'draft',
1406 })
1407- return super(report_intrastat_service, self).copy(
1408+ return super(l10n_fr_report_intrastat_service, self).copy(
1409 cr, uid, id, default=default, context=context)
1410
1411 def _compute_numbers(self, cr, uid, ids, name, arg, context=None):
1412@@ -68,7 +68,7 @@
1413 cr, uid, ids, self, context=context)
1414
1415 def _get_intrastat_from_service_line(self, cr, uid, ids, context=None):
1416- return self.pool['report.intrastat.service'].search(
1417+ return self.pool['l10n.fr.report.intrastat.service'].search(
1418 cr, uid, [('intrastat_line_ids', 'in', ids)], context=context)
1419
1420 _columns = {
1421@@ -85,7 +85,7 @@
1422 _compute_dates, type='date',
1423 string='End date', multi='intrastat-service-dates', readonly=True,
1424 store={
1425- 'report.intrastat.service': (
1426+ 'l10n.fr.report.intrastat.service': (
1427 lambda self, cr, uid, ids, c={}: ids, ['start_date'], 20),
1428 },
1429 help="End date for the declaration. Must be the last day of the "
1430@@ -94,19 +94,19 @@
1431 _compute_dates, type='char',
1432 string='Month', multi='intrastat-service-dates', readonly=True,
1433 track_visibility='always', store={
1434- 'report.intrastat.service': (
1435+ 'l10n.fr.report.intrastat.service': (
1436 lambda self, cr, uid, ids, c={}: ids, ['start_date'], 20),
1437 },
1438 help="Year and month of the declaration."),
1439 'intrastat_line_ids': fields.one2many(
1440- 'report.intrastat.service.line',
1441+ 'l10n.fr.report.intrastat.service.line',
1442 'parent_id', 'Report intrastat service lines',
1443 states={'done': [('readonly', True)]}),
1444 'num_lines': fields.function(
1445 _compute_numbers,
1446 type='integer', multi='numbers', string='Number of lines',
1447 store={
1448- 'report.intrastat.service.line': (
1449+ 'l10n.fr.report.intrastat.service.line': (
1450 _get_intrastat_from_service_line, ['parent_id'], 20),
1451 },
1452 track_visibility='always',
1453@@ -116,7 +116,7 @@
1454 digits_compute=dp.get_precision('Account'),
1455 multi='numbers', string='Total amount',
1456 store={
1457- 'report.intrastat.service.line': (
1458+ 'l10n.fr.report.intrastat.service.line': (
1459 _get_intrastat_from_service_line,
1460 ['amount_company_currency', 'parent_id'], 20),
1461 },
1462@@ -145,7 +145,7 @@
1463 'state': 'draft',
1464 'company_id': lambda self, cr, uid, context:
1465 self.pool['res.company']._company_default_get(
1466- cr, uid, 'report.intrastat.service', context=context),
1467+ cr, uid, 'l10n.fr.report.intrastat.service', context=context),
1468 }
1469
1470 def _check_start_date(self, cr, uid, ids):
1471@@ -165,7 +165,7 @@
1472
1473 def generate_service_lines(self, cr, uid, ids, context=None):
1474 intrastat = self.browse(cr, uid, ids[0], context=context)
1475- line_obj = self.pool['report.intrastat.service.line']
1476+ line_obj = self.pool['l10n.fr.report.intrastat.service.line']
1477 invoice_obj = self.pool['account.invoice']
1478 self.pool['report.intrastat.common']._check_generate_lines(
1479 cr, uid, intrastat, context=context)
1480@@ -421,14 +421,14 @@
1481 return True
1482
1483
1484-class report_intrastat_service_line(orm.Model):
1485- _name = "report.intrastat.service.line"
1486+class l10n_fr_report_intrastat_service_line(orm.Model):
1487+ _name = "l10n.fr.report.intrastat.service.line"
1488 _description = "Intrastat Service Lines"
1489 _rec_name = "partner_vat"
1490 _order = 'id'
1491 _columns = {
1492 'parent_id': fields.many2one(
1493- 'report.intrastat.service',
1494+ 'l10n.fr.report.intrastat.service',
1495 'Intrastat service ref', ondelete='cascade'),
1496 'company_id': fields.related(
1497 'parent_id', 'company_id',
1498
1499=== modified file 'l10n_fr_intrastat_service/intrastat_service_view.xml'
1500--- l10n_fr_intrastat_service/intrastat_service_view.xml 2014-10-30 12:30:41 +0000
1501+++ l10n_fr_intrastat_service/intrastat_service_view.xml 2014-12-13 00:30:09 +0000
1502@@ -10,9 +10,9 @@
1503 <data>
1504
1505 <!-- Form view for DES -->
1506-<record id="intrastat_service_form" model="ir.ui.view">
1507+<record id="l10n_fr_intrastat_service_form" model="ir.ui.view">
1508 <field name="name">fr.intrastat.service.form</field>
1509- <field name="model">report.intrastat.service</field>
1510+ <field name="model">l10n.fr.report.intrastat.service</field>
1511 <field name="arch" type="xml">
1512 <form string="Intrastat Service">
1513 <header>
1514@@ -54,9 +54,9 @@
1515 </record>
1516
1517 <!-- Tree view for DES -->
1518-<record id="intrastat_service_tree" model="ir.ui.view">
1519+<record id="l10n_fr_intrastat_service_tree" model="ir.ui.view">
1520 <field name="name">fr.intrastat.service.tree</field>
1521- <field name="model">report.intrastat.service</field>
1522+ <field name="model">l10n.fr.report.intrastat.service</field>
1523 <field name="arch" type="xml">
1524 <tree string="Intrastat Service" colors="blue:state=='draft'">
1525 <field name="year_month" />
1526@@ -70,9 +70,9 @@
1527 </record>
1528
1529 <!-- Search view for DES -->
1530-<record id="intrastat_service_search" model="ir.ui.view">
1531+<record id="l10n_fr_intrastat_service_search" model="ir.ui.view">
1532 <field name="name">fr.intrastat.service.search</field>
1533- <field name="model">report.intrastat.service</field>
1534+ <field name="model">l10n.fr.report.intrastat.service</field>
1535 <field name="arch" type="xml">
1536 <search string="Search Intrastat Service">
1537 <filter name="draft" string="Draft" domain="[('state', '=', 'draft')]" />
1538@@ -85,9 +85,9 @@
1539 </record>
1540
1541 <!-- Graph view for DES -->
1542-<record id="intrastat_service_graph" model="ir.ui.view">
1543+<record id="l10n_fr_intrastat_service_graph" model="ir.ui.view">
1544 <field name="name">fr.intrastat.service.graph</field>
1545- <field name="model">report.intrastat.service</field>
1546+ <field name="model">l10n.fr.report.intrastat.service</field>
1547 <field name="arch" type="xml">
1548 <graph string="Intrastat Service" type="bar">
1549 <field name="start_date" type="row"/>
1550@@ -97,9 +97,9 @@
1551 </record>
1552
1553 <!-- Form view for service lines -->
1554-<record id="intrastat_service_line_form" model="ir.ui.view">
1555+<record id="l10n_fr_intrastat_service_line_form" model="ir.ui.view">
1556 <field name="name">fr.intrastat.service.line.form</field>
1557- <field name="model">report.intrastat.service.line</field>
1558+ <field name="model">l10n.fr.report.intrastat.service.line</field>
1559 <field name="arch" type="xml">
1560 <form string="Intrastat service lines">
1561 <group colspan="4" col="4" string="Information to declare">
1562@@ -119,9 +119,9 @@
1563 </record>
1564
1565 <!-- Tree view for service lines -->
1566-<record id="intrastat_service_line_tree" model="ir.ui.view">
1567+<record id="l10n_fr_intrastat_service_line_tree" model="ir.ui.view">
1568 <field name="name">fr.intrastat.service.line.tree</field>
1569- <field name="model">report.intrastat.service.line</field>
1570+ <field name="model">l10n.fr.report.intrastat.service.line</field>
1571 <field name="arch" type="xml">
1572 <tree string="Intrastat service lines">
1573 <field name="partner_vat" />
1574@@ -135,21 +135,23 @@
1575
1576
1577 <!-- Action related -->
1578-<record id="intrastat_service_tree_action" model="ir.actions.act_window">
1579+<record id="l10n_fr_intrastat_service_tree_action" model="ir.actions.act_window">
1580 <field name="name">Intrastat Service</field>
1581- <field name="res_model">report.intrastat.service</field>
1582+ <field name="res_model">l10n.fr.report.intrastat.service</field>
1583 <field name="view_mode">tree,form,graph</field>
1584 </record>
1585
1586
1587 <!-- Intrastat service menu -->
1588-<menuitem id="intrastat_service_menu" parent="intrastat_base.menu_intrastat_base_root" action="intrastat_service_tree_action" />
1589+<menuitem id="l10n_fr_intrastat_service_menu"
1590+ parent="intrastat_base.menu_intrastat_base_root"
1591+ action="l10n_fr_intrastat_service_tree_action" />
1592
1593
1594 <!-- Notification in the chatter -->
1595-<record id="declaration_done" model="mail.message.subtype">
1596+<record id="l10n_fr_declaration_done" model="mail.message.subtype">
1597 <field name="name">Intrastat Service Validated</field>
1598- <field name="res_model">report.intrastat.service</field>
1599+ <field name="res_model">l10n.fr.report.intrastat.service</field>
1600 <field name="default" eval="False"/>
1601 <field name="description">Intrastat Service Validated</field>
1602 </record>
1603
1604=== added directory 'l10n_fr_intrastat_service/migrations'
1605=== added directory 'l10n_fr_intrastat_service/migrations/8.0.1.2'
1606=== added file 'l10n_fr_intrastat_service/migrations/8.0.1.2/pre-migration.py'
1607--- l10n_fr_intrastat_service/migrations/8.0.1.2/pre-migration.py 1970-01-01 00:00:00 +0000
1608+++ l10n_fr_intrastat_service/migrations/8.0.1.2/pre-migration.py 2014-12-13 00:30:09 +0000
1609@@ -0,0 +1,57 @@
1610+# -*- encoding: utf-8 -*-
1611+##############################################################################
1612+#
1613+# Report intrastat service module for OpenERP
1614+# Copyright (C) 2014 Akretion (http://www.akretion.com)
1615+# @author Alexis de Lattre <alexis.delattre@akretion.com>
1616+#
1617+# This program is free software: you can redistribute it and/or modify
1618+# it under the terms of the GNU Affero General Public License as
1619+# published by the Free Software Foundation, either version 3 of the
1620+# License, or (at your option) any later version.
1621+#
1622+# This program is distributed in the hope that it will be useful,
1623+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1624+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1625+# GNU Affero General Public License for more details.
1626+#
1627+# You should have received a copy of the GNU Affero General Public License
1628+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1629+#
1630+##############################################################################
1631+
1632+def migrate(cr, version):
1633+ if not version:
1634+ return
1635+
1636+ cr.execute(
1637+ 'ALTER SEQUENCE "report_intrastat_service_line_id_seq" RENAME TO '
1638+ '"l10n_fr_report_intrastat_service_line_id_seq"')
1639+
1640+ cr.execute(
1641+ 'ALTER TABLE "report_intrastat_service_line" RENAME TO '
1642+ '"l10n_fr_report_intrastat_service_line"')
1643+
1644+ cr.execute(
1645+ "UPDATE ir_model SET model='l10n.fr.report.intrastat.service.line' "
1646+ "WHERE model='report.intrastat.service.line'")
1647+
1648+ cr.execute(
1649+ "UPDATE ir_model_fields SET relation='l10n.fr.report.intrastat.service.line' "
1650+ "WHERE relation='report.intrastat.service.line'")
1651+
1652+ cr.execute(
1653+ 'ALTER SEQUENCE "report_intrastat_service_id_seq" RENAME TO '
1654+ '"l10n_fr_report_intrastat_service_id_seq"')
1655+
1656+ cr.execute(
1657+ 'ALTER TABLE "report_intrastat_service" RENAME TO '
1658+ '"l10n_fr_report_intrastat_service"')
1659+
1660+ cr.execute(
1661+ "UPDATE ir_model SET model='l10n.fr.report.intrastat.service' "
1662+ "WHERE model='report.intrastat.service'")
1663+
1664+ cr.execute(
1665+ "UPDATE ir_model_fields SET relation='l10n.fr.report.intrastat.service' "
1666+ "WHERE relation='report.intrastat.service'")
1667
1668=== modified file 'l10n_fr_intrastat_service/security/intrastat_service_security.xml'
1669--- l10n_fr_intrastat_service/security/intrastat_service_security.xml 2014-02-01 22:43:05 +0000
1670+++ l10n_fr_intrastat_service/security/intrastat_service_security.xml 2014-12-13 00:30:09 +0000
1671@@ -2,17 +2,17 @@
1672 <openerp>
1673 <data noupdate="1">
1674
1675-<record id="fr_intrastat_service_rule" model="ir.rule">
1676+<record id="l10n_fr_intrastat_service_rule" model="ir.rule">
1677 <field name="name">Intrastat Service multi-company</field>
1678- <field name="model_id" ref="model_report_intrastat_service"/>
1679+ <field name="model_id" ref="model_l10n_fr_report_intrastat_service"/>
1680 <field name="global" eval="True"/>
1681 <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
1682 </record>
1683
1684
1685-<record id="fr_intrastat_service_line_rule" model="ir.rule">
1686+<record id="l10n_fr_intrastat_service_line_rule" model="ir.rule">
1687 <field name="name">Intrastat Service Line multi-company</field>
1688- <field name="model_id" ref="model_report_intrastat_service_line"/>
1689+ <field name="model_id" ref="model_l10n_fr_report_intrastat_service_line"/>
1690 <field name="global" eval="True"/>
1691 <field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
1692 </record>
1693
1694=== modified file 'l10n_fr_intrastat_service/security/ir.model.access.csv'
1695--- l10n_fr_intrastat_service/security/ir.model.access.csv 2011-03-27 20:59:53 +0000
1696+++ l10n_fr_intrastat_service/security/ir.model.access.csv 2014-12-13 00:30:09 +0000
1697@@ -1,3 +1,3 @@
1698-"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
1699-"access_report_intrastat_service","report.intrastat.service","model_report_intrastat_service","account.group_account_manager",1,1,1,1
1700-"access_report_intrastat_service_line","report.intrastat.service.line","model_report_intrastat_service_line","account.group_account_manager",1,1,1,1
1701+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
1702+access_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
1703+access_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