Merge lp:~jonatan-cloutier/multi-company/product_management into lp:multi-company

Proposed by Jonatan Cloutier
Status: Merged
Merged at revision: 2
Proposed branch: lp:~jonatan-cloutier/multi-company/product_management
Merge into: lp:multi-company
Diff against target: 321 lines (+273/-0)
9 files modified
product_multicompany_automatic_management/__init__.py (+24/-0)
product_multicompany_automatic_management/__openerp__.py (+41/-0)
product_multicompany_automatic_management/product_multicompany_automatic_management.py (+34/-0)
product_multicompany_automatic_management/product_multicompany_automatic_management_view.xml (+18/-0)
product_unique_per_company/__init__.py (+24/-0)
product_unique_per_company/__openerp__.py (+39/-0)
product_unique_per_company/i18n/fr.po (+32/-0)
product_unique_per_company/i18n/product_unique_per_company.pot (+32/-0)
product_unique_per_company/product_unique_per_company.py (+29/-0)
To merge this branch: bzr merge lp:~jonatan-cloutier/multi-company/product_management
Reviewer Review Type Date Requested Status
Maxime Chambreuil (http://www.savoirfairelinux.com) lgtm, no test. Approve
Joao Alfredo Gama Batista Pending
Review via email: mp+161035@code.launchpad.net

Description of the change

Create a module that forbid duplicated new product within a company.
Create a module that manage company affectation for product.

To post a comment you must log in.
Revision history for this message
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) :
review: Approve (lgtm, no test.)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'product_multicompany_automatic_management'
2=== added file 'product_multicompany_automatic_management/__init__.py'
3--- product_multicompany_automatic_management/__init__.py 1970-01-01 00:00:00 +0000
4+++ product_multicompany_automatic_management/__init__.py 2013-04-25 22:30:34 +0000
5@@ -0,0 +1,24 @@
6+# -*- encoding: utf-8 -*-
7+##############################################################################
8+#
9+# OpenERP, Open Source Management Solution
10+# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
11+#
12+# This program is free software: you can redistribute it and/or modify
13+# it under the terms of the GNU General Public License as
14+# published by the Free Software Foundation, either version 3 of the
15+# License, or (at your option) any later version.
16+#
17+# This program is distributed in the hope that it will be useful,
18+# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+# GNU General Public License for more details.
21+#
22+# You should have received a copy of the GNU General Public License
23+# along with this program. If not, see <http://www.gnu.org/licenses/>.
24+#
25+##############################################################################
26+
27+import product_multicompany_automatic_management
28+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
29+
30
31=== added file 'product_multicompany_automatic_management/__openerp__.py'
32--- product_multicompany_automatic_management/__openerp__.py 1970-01-01 00:00:00 +0000
33+++ product_multicompany_automatic_management/__openerp__.py 2013-04-25 22:30:34 +0000
34@@ -0,0 +1,41 @@
35+# -*- encoding: utf-8 -*-
36+
37+##############################################################################
38+#
39+# OpenERP, Open Source Management Solution
40+# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
41+#
42+# This program is free software: you can redistribute it and/or modify
43+# it under the terms of the GNU Affero General Public License as
44+# published by the Free Software Foundation, either version 3 of the
45+# License, or (at your option) any later version.
46+#
47+# This program is distributed in the hope that it will be useful,
48+# but WITHOUT ANY WARRANTY; without even the implied warranty of
49+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50+# GNU Affero General Public License for more details.
51+#
52+# You should have received a copy of the GNU Affero General Public License
53+# along with this program. If not, see <http://www.gnu.org/licenses/>.
54+#
55+##############################################################################
56+
57+{
58+ 'name' : 'Product multicompany automatic management',
59+ 'version' : '1.0',
60+ "author" : "Savoir-faire Linux",
61+ "website" : "http://www.savoirfairelinux.com",
62+ 'license': 'AGPL-3',
63+ 'category' : 'Sales',
64+ 'depends' : ['product', 'stock'],
65+ 'description': """
66+ Make company field mandatory on product.
67+ Set the default to the company of the user session.
68+ Hide the field to the user.
69+""",
70+ 'data' : ['product_multicompany_automatic_management_view.xml'],
71+ 'auto_install': False,
72+ 'installable': True
73+}
74+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
75+
76
77=== added file 'product_multicompany_automatic_management/product_multicompany_automatic_management.py'
78--- product_multicompany_automatic_management/product_multicompany_automatic_management.py 1970-01-01 00:00:00 +0000
79+++ product_multicompany_automatic_management/product_multicompany_automatic_management.py 2013-04-25 22:30:34 +0000
80@@ -0,0 +1,34 @@
81+# -*- encoding: utf-8 -*-
82+##############################################################################
83+#
84+# OpenERP, Open Source Management Solution
85+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
86+#
87+# This program is free software: you can redistribute it and/or modify
88+# it under the terms of the GNU General Public License as
89+# published by the Free Software Foundation, either version 3 of the
90+# License, or (at your option) any later version.
91+#
92+# This program is distributed in the hope that it will be useful,
93+# but WITHOUT ANY WARRANTY; without even the implied warranty of
94+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
95+# GNU General Public License for more details.
96+#
97+# You should have received a copy of the GNU General Public License
98+# along with this program. If not, see <http://www.gnu.org/licenses/>.
99+#
100+##############################################################################
101+
102+from openerp.osv import fields, orm
103+
104+class product_template(orm.Model):
105+ _inherit = 'product.template'
106+
107+ _columns = {
108+ 'company_id': fields.many2one('res.company', 'Company', required=True),
109+ }
110+
111+ _defaults = {
112+ 'company_id': lambda self,cr,uid,ctx: self.pool['res.company']._company_default_get(cr,uid,object='product.template',context=ctx)
113+ }
114+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
115
116=== added file 'product_multicompany_automatic_management/product_multicompany_automatic_management_view.xml'
117--- product_multicompany_automatic_management/product_multicompany_automatic_management_view.xml 1970-01-01 00:00:00 +0000
118+++ product_multicompany_automatic_management/product_multicompany_automatic_management_view.xml 2013-04-25 22:30:34 +0000
119@@ -0,0 +1,18 @@
120+<?xml version="1.0" encoding="utf-8"?>
121+<openerp>
122+ <data>
123+
124+ <record id="product_normal_form_inherit" model="ir.ui.view">
125+ <field name="name">product.normal.form.inherit</field>
126+ <field name="model">product.product</field>
127+ <field name="inherit_id" ref="stock.view_normal_procurement_locations_form"/>
128+ <field name="arch" type="xml">
129+ <field name="company_id" position="attributes">
130+ <attribute name="invisible">True</attribute>
131+ </field>
132+ </field>
133+ </record>
134+
135+
136+ </data>
137+</openerp>
138\ No newline at end of file
139
140=== added directory 'product_unique_per_company'
141=== added file 'product_unique_per_company/__init__.py'
142--- product_unique_per_company/__init__.py 1970-01-01 00:00:00 +0000
143+++ product_unique_per_company/__init__.py 2013-04-25 22:30:34 +0000
144@@ -0,0 +1,24 @@
145+# -*- encoding: utf-8 -*-
146+##############################################################################
147+#
148+# OpenERP, Open Source Management Solution
149+# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
150+#
151+# This program is free software: you can redistribute it and/or modify
152+# it under the terms of the GNU General Public License as
153+# published by the Free Software Foundation, either version 3 of the
154+# License, or (at your option) any later version.
155+#
156+# This program is distributed in the hope that it will be useful,
157+# but WITHOUT ANY WARRANTY; without even the implied warranty of
158+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
159+# GNU General Public License for more details.
160+#
161+# You should have received a copy of the GNU General Public License
162+# along with this program. If not, see <http://www.gnu.org/licenses/>.
163+#
164+##############################################################################
165+
166+import product_unique_per_company
167+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
168+
169
170=== added file 'product_unique_per_company/__openerp__.py'
171--- product_unique_per_company/__openerp__.py 1970-01-01 00:00:00 +0000
172+++ product_unique_per_company/__openerp__.py 2013-04-25 22:30:34 +0000
173@@ -0,0 +1,39 @@
174+# -*- encoding: utf-8 -*-
175+
176+##############################################################################
177+#
178+# OpenERP, Open Source Management Solution
179+# Copyright (C) 2013 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
180+#
181+# This program is free software: you can redistribute it and/or modify
182+# it under the terms of the GNU Affero General Public License as
183+# published by the Free Software Foundation, either version 3 of the
184+# License, or (at your option) any later version.
185+#
186+# This program is distributed in the hope that it will be useful,
187+# but WITHOUT ANY WARRANTY; without even the implied warranty of
188+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
189+# GNU Affero General Public License for more details.
190+#
191+# You should have received a copy of the GNU Affero General Public License
192+# along with this program. If not, see <http://www.gnu.org/licenses/>.
193+#
194+##############################################################################
195+
196+{
197+ 'name' : 'Product unique per company',
198+ 'version' : '1.0',
199+ "author" : "Savoir-faire Linux",
200+ "website" : "http://www.savoirfairelinux.com",
201+ 'license': 'AGPL-3',
202+ 'category' : 'Sales',
203+ 'depends' : ['product'],
204+ 'description': """
205+Make the product name unique per company.
206+""",
207+ 'data' : [],
208+ 'auto_install': False,
209+ 'installable': True
210+}
211+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
212+
213
214=== added directory 'product_unique_per_company/i18n'
215=== added file 'product_unique_per_company/i18n/fr.po'
216--- product_unique_per_company/i18n/fr.po 1970-01-01 00:00:00 +0000
217+++ product_unique_per_company/i18n/fr.po 2013-04-25 22:30:34 +0000
218@@ -0,0 +1,32 @@
219+# Translation of OpenERP Server.
220+# This file contains the translation of the following modules:
221+# * product_unique_per_company
222+#
223+msgid ""
224+msgstr ""
225+"Project-Id-Version: OpenERP Server 7.0\n"
226+"Report-Msgid-Bugs-To: \n"
227+"POT-Creation-Date: 2013-04-25 20:35+0000\n"
228+"PO-Revision-Date: 2013-04-25 20:35+0000\n"
229+"Last-Translator: <>\n"
230+"Language-Team: \n"
231+"MIME-Version: 1.0\n"
232+"Content-Type: text/plain; charset=UTF-8\n"
233+"Content-Transfer-Encoding: \n"
234+"Plural-Forms: \n"
235+
236+#. module: product_unique_per_company
237+#: sql_constraint:product.template:0
238+msgid "Product must be unique for a company."
239+msgstr "Le produit doit ĂȘtre unique pour une compagny !"
240+
241+#. module: product_unique_per_company
242+#: model:ir.model,name:product_unique_per_company.model_product_template
243+msgid "Product Template"
244+msgstr "Template de produit"
245+
246+#. module: product_unique_per_company
247+#: model:ir.model,name:product_unique_per_company.model_product_product
248+msgid "Product"
249+msgstr "Produit"
250+
251
252=== added file 'product_unique_per_company/i18n/product_unique_per_company.pot'
253--- product_unique_per_company/i18n/product_unique_per_company.pot 1970-01-01 00:00:00 +0000
254+++ product_unique_per_company/i18n/product_unique_per_company.pot 2013-04-25 22:30:34 +0000
255@@ -0,0 +1,32 @@
256+# Translation of OpenERP Server.
257+# This file contains the translation of the following modules:
258+# * product_unique_per_company
259+#
260+msgid ""
261+msgstr ""
262+"Project-Id-Version: OpenERP Server 7.0\n"
263+"Report-Msgid-Bugs-To: \n"
264+"POT-Creation-Date: 2013-04-25 20:35+0000\n"
265+"PO-Revision-Date: 2013-04-25 20:35+0000\n"
266+"Last-Translator: <>\n"
267+"Language-Team: \n"
268+"MIME-Version: 1.0\n"
269+"Content-Type: text/plain; charset=UTF-8\n"
270+"Content-Transfer-Encoding: \n"
271+"Plural-Forms: \n"
272+
273+#. module: product_unique_per_company
274+#: sql_constraint:product.template:0
275+msgid "Product must be unique for a company."
276+msgstr ""
277+
278+#. module: product_unique_per_company
279+#: model:ir.model,name:product_unique_per_company.model_product_template
280+msgid "Product Template"
281+msgstr ""
282+
283+#. module: product_unique_per_company
284+#: model:ir.model,name:product_unique_per_company.model_product_product
285+msgid "Product"
286+msgstr ""
287+
288
289=== added file 'product_unique_per_company/product_unique_per_company.py'
290--- product_unique_per_company/product_unique_per_company.py 1970-01-01 00:00:00 +0000
291+++ product_unique_per_company/product_unique_per_company.py 2013-04-25 22:30:34 +0000
292@@ -0,0 +1,29 @@
293+# -*- encoding: utf-8 -*-
294+##############################################################################
295+#
296+# OpenERP, Open Source Management Solution
297+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
298+#
299+# This program is free software: you can redistribute it and/or modify
300+# it under the terms of the GNU General Public License as
301+# published by the Free Software Foundation, either version 3 of the
302+# License, or (at your option) any later version.
303+#
304+# This program is distributed in the hope that it will be useful,
305+# but WITHOUT ANY WARRANTY; without even the implied warranty of
306+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
307+# GNU General Public License for more details.
308+#
309+# You should have received a copy of the GNU General Public License
310+# along with this program. If not, see <http://www.gnu.org/licenses/>.
311+#
312+##############################################################################
313+
314+from openerp.osv import fields, orm
315+
316+class product_template(orm.Model):
317+ _inherit = 'product.template'
318+
319+ _sql_constraints = [ ('product_unique_per_company', 'unique (name, company_id)', "Product must be unique for a company.") ]
320+
321+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

Subscribers

People subscribed via source and target branches