Merge lp:~numerigraphe-team/openerp-product-attributes/7.0-add-bremskrel-modules into lp:~product-core-editors/openerp-product-attributes/7.0

Proposed by Loïc Bellier - Numérigraphe
Status: Rejected
Rejected by: Pedro Manuel Baeza
Proposed branch: lp:~numerigraphe-team/openerp-product-attributes/7.0-add-bremskrel-modules
Merge into: lp:~product-core-editors/openerp-product-attributes/7.0
Diff against target: 283 lines
To merge this branch: bzr merge lp:~numerigraphe-team/openerp-product-attributes/7.0-add-bremskrel-modules
Reviewer Review Type Date Requested Status
Laetitia Gangloff (Acsone) (community) Needs Resubmitting
Bremskerl Pending
Product Core Editors Pending
Review via email: mp+219858@code.launchpad.net

Description of the change

I propose these 2 new modules :
product_code_mandatory: all is in the module name.
product_code_unique: having a unique product code, without sequence.
These modules have come from BREMSKERL branch (they are OK to merge).
Loïc BELLIER

To post a comment you must log in.
Revision history for this message
Laetitia Gangloff (Acsone) (laetitia-gangloff) wrote :

This project is now hosted on https://github.com/OCA/product-attribute. Please move your proposal there. This guide may help you https://github.com/OCA/maintainers-tools/wiki/How-to-move-a-Merge-Proposal-to-GitHub

review: Needs Resubmitting
Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote :

Gihubified here: https://github.com/OCA/product-attribute/pull/23
Please reject the MP here on Launchpad to avoid confusion.

Unmerged revisions

243. By Loïc Bellier - Numérigraphe

[ADD]: Add new modules product_code_mandatory and product_code_unique from BREMSKERL

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'product_code_mandatory'
2=== added file 'product_code_mandatory/__init__.py'
3--- product_code_mandatory/__init__.py 1970-01-01 00:00:00 +0000
4+++ product_code_mandatory/__init__.py 2014-05-16 15:13:56 +0000
5@@ -0,0 +1,1 @@
6+import product
7\ No newline at end of file
8
9=== added file 'product_code_mandatory/__openerp__.py'
10--- product_code_mandatory/__openerp__.py 1970-01-01 00:00:00 +0000
11+++ product_code_mandatory/__openerp__.py 2014-05-16 15:13:56 +0000
12@@ -0,0 +1,38 @@
13+# -*- coding: utf-8 -*-
14+##############################################################################
15+#
16+# OpenERP Module
17+#
18+# Copyright (C) 2010-2011 BREMSKERL-REIBBELAGWERKE EMMERLING GmbH & Co. KG
19+# Author Marco Dieckhoff
20+#
21+# This program is free software: you can redistribute it and/or modify
22+# it under the terms of the GNU Affero General Public License as
23+# published by the Free Software Foundation, either version 3 of the
24+# License, or (at your option) any later version.
25+#
26+# This program is distributed in the hope that it will be useful,
27+# but WITHOUT ANY WARRANTY; without even the implied warranty of
28+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29+# GNU Affero General Public License for more details.
30+#
31+# You should have received a copy of the GNU Affero General Public License
32+# along with this program. If not, see <http://www.gnu.org/licenses/>.
33+#
34+##############################################################################
35+{
36+ "name": "Make product code mandatory",
37+ "version": "1.01",
38+ "depends": ["product"],
39+ "author": "Marco Dieckhoff, BREMSKERL",
40+ "category": "Inventory Control",
41+ "description": """Makes product code (default_code) a mandatory field
42+ """,
43+ 'depends' : ['product'],
44+ "init_xml": [],
45+ 'update_xml': [],
46+ 'demo_xml': [],
47+ 'installable': True,
48+ 'active': False,
49+# 'certificate': '${certificate}',
50+}
51\ No newline at end of file
52
53=== added file 'product_code_mandatory/product.py'
54--- product_code_mandatory/product.py 1970-01-01 00:00:00 +0000
55+++ product_code_mandatory/product.py 2014-05-16 15:13:56 +0000
56@@ -0,0 +1,16 @@
57+# -*- coding: utf-8 -*-
58+
59+from openerp.osv import osv, fields
60+
61+
62+class product_code_mandatory_product(osv.osv):
63+ _name = "product.product"
64+ _inherit = "product.product"
65+
66+ _columns = {
67+ 'default_code': fields.char('Reference', size=64, required=True),
68+ }
69+
70+ _defaults ={
71+ 'default_code': lambda *a: 'NEW',
72+ }
73
74=== added directory 'product_code_unique'
75=== added file 'product_code_unique/__init__.py'
76--- product_code_unique/__init__.py 1970-01-01 00:00:00 +0000
77+++ product_code_unique/__init__.py 2014-05-16 15:13:56 +0000
78@@ -0,0 +1,1 @@
79+import product
80\ No newline at end of file
81
82=== added file 'product_code_unique/__openerp__.py'
83--- product_code_unique/__openerp__.py 1970-01-01 00:00:00 +0000
84+++ product_code_unique/__openerp__.py 2014-05-16 15:13:56 +0000
85@@ -0,0 +1,38 @@
86+# -*- coding: utf-8 -*-
87+##############################################################################
88+#
89+# OpenERP Module
90+#
91+# Copyright (C) 2010-2011 BREMSKERL-REIBBELAGWERKE EMMERLING GmbH & Co. KG
92+# Author Marco Dieckhoff
93+#
94+# This program is free software: you can redistribute it and/or modify
95+# it under the terms of the GNU Affero General Public License as
96+# published by the Free Software Foundation, either version 3 of the
97+# License, or (at your option) any later version.
98+#
99+# This program is distributed in the hope that it will be useful,
100+# but WITHOUT ANY WARRANTY; without even the implied warranty of
101+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
102+# GNU Affero General Public License for more details.
103+#
104+# You should have received a copy of the GNU Affero General Public License
105+# along with this program. If not, see <http://www.gnu.org/licenses/>.
106+#
107+##############################################################################
108+{
109+ "name": "Make product code unique",
110+ "version": "1.01",
111+ "depends": ["product"],
112+ "author": "Marco Dieckhoff, BREMSKERL",
113+ "category": "Inventory Control",
114+ "description": """Makes product code (default_code) a unique field
115+ """,
116+ 'depends': ['product'],
117+ "init_xml": [],
118+ 'update_xml': [],
119+ 'demo_xml': [],
120+ 'installable': True,
121+ 'active': False,
122+# 'certificate': '${certificate}',
123+}
124\ No newline at end of file
125
126=== added directory 'product_code_unique/i18n'
127=== added file 'product_code_unique/i18n/de.po'
128--- product_code_unique/i18n/de.po 1970-01-01 00:00:00 +0000
129+++ product_code_unique/i18n/de.po 2014-05-16 15:13:56 +0000
130@@ -0,0 +1,50 @@
131+# Translation of OpenERP Server.
132+# This file contains the translation of the following modules:
133+# * product_code_unique
134+#
135+msgid ""
136+msgstr ""
137+"Project-Id-Version: OpenERP Server 6.0.1\n"
138+"Report-Msgid-Bugs-To: support@openerp.com\n"
139+"POT-Creation-Date: 2011-03-24 15:58+0000\n"
140+"PO-Revision-Date: 2011-03-24 15:58+0000\n"
141+"Last-Translator: <>\n"
142+"Language-Team: \n"
143+"MIME-Version: 1.0\n"
144+"Content-Type: text/plain; charset=UTF-8\n"
145+"Content-Transfer-Encoding: \n"
146+"Plural-Forms: \n"
147+
148+#: model:ir.model,name:product_code_unique.model_product_product
149+#. module: product_code_unique
150+msgid "Product"
151+msgstr "Produkt"
152+
153+#: model:ir.module.module,description:product_code_unique.module_meta_information
154+#. module: product_code_unique
155+msgid "Makes product code (default_code) a unique field \n"
156+msgstr "Produkt-Referenz (und Variante) muss eindeutig sein.\n"
157
158+#: constraint:product.product:0
159+#. module: product_code_unique
160+msgid "Error: Invalid ean code"
161+msgstr "Fehler: Falscher EAN code"
162+
163+#: code:addons\product_code_unique\product.py:38
164+#. module: product_code_unique
165+#, python-format
166+msgid " (copy)"
167+msgstr " (Kopie)"
168+
169+#: code:addons\product_code_unique\product.py:24
170+#: constraint:product.product:0
171+#: sql_constraint:product.product:0
172+#. module: product_code_unique
173+#, python-format
174+msgid "Reference/Variant has to be unique."
175+msgstr "Referenz/Variante muss eindeutig sein."
176+
177+#: model:ir.module.module,shortdesc:product_code_unique.module_meta_information
178+#. module: product_code_unique
179+msgid "Make product code unique"
180+msgstr "Macht die Produktreferenz (und Variante) eindeutig"
181+
182
183=== added file 'product_code_unique/i18n/product-code-unique.pot'
184--- product_code_unique/i18n/product-code-unique.pot 1970-01-01 00:00:00 +0000
185+++ product_code_unique/i18n/product-code-unique.pot 2014-05-16 15:13:56 +0000
186@@ -0,0 +1,50 @@
187+# Translation of OpenERP Server.
188+# This file contains the translation of the following modules:
189+# * product_code_unique
190+#
191+msgid ""
192+msgstr ""
193+"Project-Id-Version: OpenERP Server 6.0.1\n"
194+"Report-Msgid-Bugs-To: https://bugs.launchpad.net/bremskerl-addons/\n"
195+"POT-Creation-Date: 2011-03-24 15:58+0000\n"
196+"PO-Revision-Date: 2011-03-24 15:58+0000\n"
197+"Last-Translator: <>\n"
198+"Language-Team: \n"
199+"MIME-Version: 1.0\n"
200+"Content-Type: text/plain; charset=UTF-8\n"
201+"Content-Transfer-Encoding: \n"
202+"Plural-Forms: \n"
203+
204+#: model:ir.model,name:product_code_unique.model_product_product
205+#. module: product_code_unique
206+msgid "Product"
207+msgstr ""
208+
209+#: model:ir.module.module,description:product_code_unique.module_meta_information
210+#. module: product_code_unique
211+msgid "Makes product code (default_code) a unique field \n"
212+msgstr ""
213+#: constraint:product.product:0
214+#. module: product_code_unique
215+msgid "Error: Invalid ean code"
216+msgstr ""
217+
218+#: code:addons\product_code_unique\product.py:38
219+#. module: product_code_unique
220+#, python-format
221+msgid " (copy)"
222+msgstr ""
223+
224+#: code:addons\product_code_unique\product.py:24
225+#: constraint:product.product:0
226+#: sql_constraint:product.product:0
227+#. module: product_code_unique
228+#, python-format
229+msgid "Reference/Variant has to be unique."
230+msgstr ""
231+
232+#: model:ir.module.module,shortdesc:product_code_unique.module_meta_information
233+#. module: product_code_unique
234+msgid "Make product code unique"
235+msgstr ""
236+
237
238=== added file 'product_code_unique/product.py'
239--- product_code_unique/product.py 1970-01-01 00:00:00 +0000
240+++ product_code_unique/product.py 2014-05-16 15:13:56 +0000
241@@ -0,0 +1,43 @@
242+# -*- coding: utf-8 -*-
243+
244+from openerp.osv import osv
245+from openerp.tools.translate import _
246+
247+
248+class product_code_unique_product(osv.osv):
249+ _name = "product.product"
250+ _inherit = "product.product"
251+
252+ def _check_defaultcode_and_variants(self, cr, uid, ids):
253+ for product in self.browse(cr, uid, ids):
254+ res = self.search(cr, uid, [('default_code', '=', product.default_code),
255+ ('variants', '=', product.variants)
256+ ])
257+ # Result may contain the current product if it's active: we remove it here.
258+ if product.id in res:
259+ res.remove(product.id)
260+ if len(res):
261+ # If we have any results left
262+ # we have duplicate entries
263+ return False
264+ return True
265+
266+ _constraints = [(_check_defaultcode_and_variants,
267+ _('Reference/Variant has to be unique.'),
268+ ['default_code', 'variants'])
269+ ]
270+
271+ _sql_constraints = [('default_code_uniq', 'unique (default_code, variants)', """Reference/Variant has to be unique."""),]
272+
273+ def copy(self, cr, uid, id, default=None, context=None):
274+ if context is None:
275+ context = {}
276+
277+ if not default:
278+ default = {}
279+ if 'default_code' not in default:
280+ default = default.copy()
281+ product = self.read(cr, uid, id, ['default_code'], context=context)
282+ default['default_code'] = product['default_code'] + _(' (copy)')
283+
284+ return super(product_code_unique_product, self).copy(cr=cr, uid=uid, id=id, default=default, context=context)

Subscribers

People subscribed via source and target branches