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
=== added directory 'product_code_mandatory'
=== added file 'product_code_mandatory/__init__.py'
--- product_code_mandatory/__init__.py 1970-01-01 00:00:00 +0000
+++ product_code_mandatory/__init__.py 2014-05-16 15:13:56 +0000
@@ -0,0 +1,1 @@
1import product
0\ No newline at end of file2\ No newline at end of file
13
=== added file 'product_code_mandatory/__openerp__.py'
--- product_code_mandatory/__openerp__.py 1970-01-01 00:00:00 +0000
+++ product_code_mandatory/__openerp__.py 2014-05-16 15:13:56 +0000
@@ -0,0 +1,38 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP Module
5#
6# Copyright (C) 2010-2011 BREMSKERL-REIBBELAGWERKE EMMERLING GmbH & Co. KG
7# Author Marco Dieckhoff
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU Affero General Public License as
11# published by the Free Software Foundation, either version 3 of the
12# License, or (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU Affero General Public License for more details.
18#
19# You should have received a copy of the GNU Affero General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21#
22##############################################################################
23{
24 "name": "Make product code mandatory",
25 "version": "1.01",
26 "depends": ["product"],
27 "author": "Marco Dieckhoff, BREMSKERL",
28 "category": "Inventory Control",
29 "description": """Makes product code (default_code) a mandatory field
30 """,
31 'depends' : ['product'],
32 "init_xml": [],
33 'update_xml': [],
34 'demo_xml': [],
35 'installable': True,
36 'active': False,
37# 'certificate': '${certificate}',
38}
0\ No newline at end of file39\ No newline at end of file
140
=== added file 'product_code_mandatory/product.py'
--- product_code_mandatory/product.py 1970-01-01 00:00:00 +0000
+++ product_code_mandatory/product.py 2014-05-16 15:13:56 +0000
@@ -0,0 +1,16 @@
1# -*- coding: utf-8 -*-
2
3from openerp.osv import osv, fields
4
5
6class product_code_mandatory_product(osv.osv):
7 _name = "product.product"
8 _inherit = "product.product"
9
10 _columns = {
11 'default_code': fields.char('Reference', size=64, required=True),
12 }
13
14 _defaults ={
15 'default_code': lambda *a: 'NEW',
16 }
017
=== added directory 'product_code_unique'
=== added file 'product_code_unique/__init__.py'
--- product_code_unique/__init__.py 1970-01-01 00:00:00 +0000
+++ product_code_unique/__init__.py 2014-05-16 15:13:56 +0000
@@ -0,0 +1,1 @@
1import product
0\ No newline at end of file2\ No newline at end of file
13
=== added file 'product_code_unique/__openerp__.py'
--- product_code_unique/__openerp__.py 1970-01-01 00:00:00 +0000
+++ product_code_unique/__openerp__.py 2014-05-16 15:13:56 +0000
@@ -0,0 +1,38 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP Module
5#
6# Copyright (C) 2010-2011 BREMSKERL-REIBBELAGWERKE EMMERLING GmbH & Co. KG
7# Author Marco Dieckhoff
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU Affero General Public License as
11# published by the Free Software Foundation, either version 3 of the
12# License, or (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU Affero General Public License for more details.
18#
19# You should have received a copy of the GNU Affero General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21#
22##############################################################################
23{
24 "name": "Make product code unique",
25 "version": "1.01",
26 "depends": ["product"],
27 "author": "Marco Dieckhoff, BREMSKERL",
28 "category": "Inventory Control",
29 "description": """Makes product code (default_code) a unique field
30 """,
31 'depends': ['product'],
32 "init_xml": [],
33 'update_xml': [],
34 'demo_xml': [],
35 'installable': True,
36 'active': False,
37# 'certificate': '${certificate}',
38}
0\ No newline at end of file39\ No newline at end of file
140
=== added directory 'product_code_unique/i18n'
=== added file 'product_code_unique/i18n/de.po'
--- product_code_unique/i18n/de.po 1970-01-01 00:00:00 +0000
+++ product_code_unique/i18n/de.po 2014-05-16 15:13:56 +0000
@@ -0,0 +1,50 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * product_code_unique
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 6.0.1\n"
8"Report-Msgid-Bugs-To: support@openerp.com\n"
9"POT-Creation-Date: 2011-03-24 15:58+0000\n"
10"PO-Revision-Date: 2011-03-24 15:58+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#: model:ir.model,name:product_code_unique.model_product_product
19#. module: product_code_unique
20msgid "Product"
21msgstr "Produkt"
22
23#: model:ir.module.module,description:product_code_unique.module_meta_information
24#. module: product_code_unique
25msgid "Makes product code (default_code) a unique field \n"
26msgstr "Produkt-Referenz (und Variante) muss eindeutig sein.\n"
027
28#: constraint:product.product:0
29#. module: product_code_unique
30msgid "Error: Invalid ean code"
31msgstr "Fehler: Falscher EAN code"
32
33#: code:addons\product_code_unique\product.py:38
34#. module: product_code_unique
35#, python-format
36msgid " (copy)"
37msgstr " (Kopie)"
38
39#: code:addons\product_code_unique\product.py:24
40#: constraint:product.product:0
41#: sql_constraint:product.product:0
42#. module: product_code_unique
43#, python-format
44msgid "Reference/Variant has to be unique."
45msgstr "Referenz/Variante muss eindeutig sein."
46
47#: model:ir.module.module,shortdesc:product_code_unique.module_meta_information
48#. module: product_code_unique
49msgid "Make product code unique"
50msgstr "Macht die Produktreferenz (und Variante) eindeutig"
51
152
=== added file 'product_code_unique/i18n/product-code-unique.pot'
--- product_code_unique/i18n/product-code-unique.pot 1970-01-01 00:00:00 +0000
+++ product_code_unique/i18n/product-code-unique.pot 2014-05-16 15:13:56 +0000
@@ -0,0 +1,50 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * product_code_unique
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 6.0.1\n"
8"Report-Msgid-Bugs-To: https://bugs.launchpad.net/bremskerl-addons/\n"
9"POT-Creation-Date: 2011-03-24 15:58+0000\n"
10"PO-Revision-Date: 2011-03-24 15:58+0000\n"
11"Last-Translator: <>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: \n"
16"Plural-Forms: \n"
17
18#: model:ir.model,name:product_code_unique.model_product_product
19#. module: product_code_unique
20msgid "Product"
21msgstr ""
22
23#: model:ir.module.module,description:product_code_unique.module_meta_information
24#. module: product_code_unique
25msgid "Makes product code (default_code) a unique field \n"
26msgstr ""
27#: constraint:product.product:0
28#. module: product_code_unique
29msgid "Error: Invalid ean code"
30msgstr ""
31
32#: code:addons\product_code_unique\product.py:38
33#. module: product_code_unique
34#, python-format
35msgid " (copy)"
36msgstr ""
37
38#: code:addons\product_code_unique\product.py:24
39#: constraint:product.product:0
40#: sql_constraint:product.product:0
41#. module: product_code_unique
42#, python-format
43msgid "Reference/Variant has to be unique."
44msgstr ""
45
46#: model:ir.module.module,shortdesc:product_code_unique.module_meta_information
47#. module: product_code_unique
48msgid "Make product code unique"
49msgstr ""
50
051
=== added file 'product_code_unique/product.py'
--- product_code_unique/product.py 1970-01-01 00:00:00 +0000
+++ product_code_unique/product.py 2014-05-16 15:13:56 +0000
@@ -0,0 +1,43 @@
1# -*- coding: utf-8 -*-
2
3from openerp.osv import osv
4from openerp.tools.translate import _
5
6
7class product_code_unique_product(osv.osv):
8 _name = "product.product"
9 _inherit = "product.product"
10
11 def _check_defaultcode_and_variants(self, cr, uid, ids):
12 for product in self.browse(cr, uid, ids):
13 res = self.search(cr, uid, [('default_code', '=', product.default_code),
14 ('variants', '=', product.variants)
15 ])
16 # Result may contain the current product if it's active: we remove it here.
17 if product.id in res:
18 res.remove(product.id)
19 if len(res):
20 # If we have any results left
21 # we have duplicate entries
22 return False
23 return True
24
25 _constraints = [(_check_defaultcode_and_variants,
26 _('Reference/Variant has to be unique.'),
27 ['default_code', 'variants'])
28 ]
29
30 _sql_constraints = [('default_code_uniq', 'unique (default_code, variants)', """Reference/Variant has to be unique."""),]
31
32 def copy(self, cr, uid, id, default=None, context=None):
33 if context is None:
34 context = {}
35
36 if not default:
37 default = {}
38 if 'default_code' not in default:
39 default = default.copy()
40 product = self.read(cr, uid, id, ['default_code'], context=context)
41 default['default_code'] = product['default_code'] + _(' (copy)')
42
43 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