Merge lp:~vauxoo/addons-vauxoo/addons-vauxoo-6.0-product_partner_upc-dev-rodo into lp:addons-vauxoo

Proposed by Rodolfo Lopez
Status: Merged
Merge reported by: Moisés López - http://www.vauxoo.com
Merged at revision: not available
Proposed branch: lp:~vauxoo/addons-vauxoo/addons-vauxoo-6.0-product_partner_upc-dev-rodo
Merge into: lp:addons-vauxoo
Diff against target: 358 lines (+311/-0)
9 files modified
product_customer_code/__init__.py (+2/-0)
product_customer_code/__openerp__.py (+47/-0)
product_customer_code/i18n/es.po (+92/-0)
product_customer_code/product.py (+51/-0)
product_customer_code/product_customer_code.py (+52/-0)
product_customer_code/product_customer_code.xml (+32/-0)
product_customer_code/product_product.xml (+20/-0)
product_customer_code/security/ir.model.access.csv (+3/-0)
product_customer_code/security/product_customer_code_security.xml (+12/-0)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/addons-vauxoo-6.0-product_partner_upc-dev-rodo
Reviewer Review Type Date Requested Status
Moisés López - http://www.vauxoo.com Approve
Rodolfo Lopez Pending
Luis Torres - http://www.vauxoo.com Pending
Review via email: mp+108607@code.launchpad.net

Description of the change

[ADD][module product_partner_upc]
añade one2many en productos para agregar upc y un partner
esto permite que el mismo producto pueda ser reconocido por diferentes códigos segun el partner lo mencione.

To post a comment you must log in.
Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) wrote :

Rodo,
Cambia el author y descripción del __openerp__.py y del __terp__.py
Así como también agrega los comentarios de licencia al inicio por favor.

Sustituye los query por search a toda costa.

Y quita el search de packaging que ese es de otro módulo.

Verifica por que hay 2 campos many2one a product.

Cambia el nombre del campo upc por product_code. (Tal cual lo hace actualmente product.supplierinfo, solo cambiando donde dice supplier, ahora es customer)
        'product_code': fields.char('Supplier Product Code', size=64, help="This supplier's product code will be used when printing a request for quotation. Keep empty to use the internal one."),

Y agrega también
        'product_name': fields.char('Supplier Product Name', size=128, help="This supplier's product name will be used when printing a request for quotation. Keep empty to use the internal one."),

Hay que modificar la venta, para que tome en el descripción el product_code & product_name del cliente, en su pedido de venta.

Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) wrote :

También agrega un index del product_code, para saber como se hace esto, verifica la función "def _auto_init"
del "account/account_move_line.py"

    def _auto_init(self, cr, context=None):
        super(account_move_line, self)._auto_init(cr, context=context)
        cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'account_move_line_journal_id_period_id_index\'')
        if not cr.fetchone():
            cr.execute('CREATE INDEX account_move_line_journal_id_period_id_index ON account_move_line (journal_id, period_id)')

Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) wrote :

Agrega el campo "company_id" y pon el default, como lo hacen las demás funciones de los otros modelos.

Modifica el
_sql_constraints = [
         ('number_uniq', 'unique (upc)', 'UPC tiene que ser unico!')
     ]

Lo correcto debería de ser:
_sql_constraints = [
  ('number_uniq', 'unique(upc,partner_id,company_id)', 'UPC tiene que ser unico!')
]

(cambiar los mensajes a ingles, y con los nuevos nombres de campos)

Analizar la opción de mandar en el context el partner_id, desde la venta, para que lo procese la búsqueda de mapeo con sus códigos.

288. By Rodolfo Lopez

[MERGE][delete querys, and add licenses]

289. By Luis Torres - http://www.vauxoo.com

[REF]Names were changed

290. By Luis Torres - http://www.vauxoo.com

[REF]Names were changed from partner_upc to customer_code

291. By Luis Torres - http://www.vauxoo.com

[ REF]Was changed to required fiel partner_id

292. By Luis Torres - http://www.vauxoo.com

[ADD]Add security and goups

293. By Luis Torres - http://www.vauxoo.com

[IMP]Add fiel company_id & your default

294. By Luis Torres - http://www.vauxoo.com

[IMP][product_customer_code]Add traducction & Constrains of product code

295. By Luis Torres - http://www.vauxoo.com

[ADD][product_customer_code]Sale.order.line was added to a context for when seeking the product_id just look client code that partner.

Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) wrote :

Modifica lo siguiente:
1) Crear el grupo manager y user (uno ya está creado)
2) Asignar al ir.rules el grupo manager & user segúń corresponda

Apóyate de la siguiente propuesta de merge:
https://code.launchpad.net/~vauxoo/addons-vauxoo/customs_rate_dev_jcarlos/+merge/112864

296. By Luis Torres - http://www.vauxoo.com

[ADD][product_customer_code]Was create the groups user

297. By Luis Torres - http://www.vauxoo.com

[IMP][product_customer_code]Add traduction of english

Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) wrote :

Dejar solo un es_MX.po (hay 2 el otro es es_Mx.po)
Eliminar el .pot (es un binario que te genera poedit, que no se necesita)
Eliminar los comentarios de TODO
Agregar index para búsquedas más eficientes.

review: Needs Fixing
298. By Moisés López - http://www.vauxoo.com

[REF] [product_customer_code] Rename standard security xml file

299. By Moisés López - http://www.vauxoo.com

[REF] [product_customer_code] Standard to i18n

300. By Moisés López - http://www.vauxoo.com

[FIX] [product_customer_code] Fix context.get('partner_id') validation

301. By Moisés López - http://www.vauxoo.com

[REF][product_customer_code] Change code to file product.py. Remove comment's. Add ToDo messages

302. By Moisés López - http://www.vauxoo.com

[FIX][product_customer_code] Add import to new file.

303. By Moisés López - http://www.vauxoo.com

[REF] [product_custome_code] Replace tab for spaces in xml view file

Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) wrote :

Agregarle al campo company_id el grupo multi-company

review: Needs Fixing
304. By Moisés López - http://www.vauxoo.com

[REF] [product_customer_code] Add group multi-company to field company_id.
Add required company_id.
Change help text

Revision history for this message
Moisés López - http://www.vauxoo.com (moylop260) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'product_customer_code'
2=== added file 'product_customer_code/__init__.py'
3--- product_customer_code/__init__.py 1970-01-01 00:00:00 +0000
4+++ product_customer_code/__init__.py 2012-07-07 21:55:21 +0000
5@@ -0,0 +1,2 @@
6+import product_customer_code
7+import product
8
9=== added file 'product_customer_code/__openerp__.py'
10--- product_customer_code/__openerp__.py 1970-01-01 00:00:00 +0000
11+++ product_customer_code/__openerp__.py 2012-07-07 21:55:21 +0000
12@@ -0,0 +1,47 @@
13+# -*- encoding: utf-8 -*-
14+###########################################################################
15+# Module Writen to OpenERP, Open Source Management Solution
16+#
17+# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com/
18+# All Rights Reserved.
19+# info Vauxoo (info@vauxoo.com)
20+############################################################################
21+# Coded by: el_rodo_1 (rodo@vauxoo.com)
22+############################################################################
23+#
24+# This program is free software: you can redistribute it and/or modify
25+# it under the terms of the GNU Affero General Public License as
26+# published by the Free Software Foundation, either version 3 of the
27+# License, or (at your option) any later version.
28+#
29+# This program is distributed in the hope that it will be useful,
30+# but WITHOUT ANY WARRANTY; without even the implied warranty of
31+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32+# GNU Affero General Public License for more details.
33+#
34+# You should have received a copy of the GNU Affero General Public License
35+# along with this program. If not, see <http://www.gnu.org/licenses/>.
36+#
37+##############################################################################
38+{
39+ "name" : "Products Customer Code",
40+ "version" : "1.0",
41+ "author" : "Vauxoo",
42+ "website" : "http://www.vauxoo.com/",
43+ "license" : "AGPL-3",
44+ "category" : "Generic Modules/Product",
45+ "depends" : ["base", "product"],
46+ "init_xml" : [],
47+ "demo_xml" : [],
48+ "description": """
49+Add manies Codes of Customer's in product
50+ """,
51+ "update_xml" : ["security/product_customer_code_security.xml",
52+ "security/ir.model.access.csv",
53+ "product_customer_code.xml",
54+ "product_product.xml",
55+
56+ ],
57+ "active": False,
58+ "installable": True,
59+}
60
61=== added directory 'product_customer_code/i18n'
62=== added file 'product_customer_code/i18n/es.po'
63--- product_customer_code/i18n/es.po 1970-01-01 00:00:00 +0000
64+++ product_customer_code/i18n/es.po 2012-07-07 21:55:21 +0000
65@@ -0,0 +1,92 @@
66+# Translation of OpenERP Server.
67+# This file contains the translation of the following modules:
68+# * product_customer_code
69+#
70+msgid ""
71+msgstr ""
72+"Project-Id-Version: OpenERP Server 6.1\n"
73+"Report-Msgid-Bugs-To: \n"
74+"POT-Creation-Date: 2012-07-02 20:40+0000\n"
75+"PO-Revision-Date: 2012-07-02 20:40+0000\n"
76+"Last-Translator: <>\n"
77+"Language-Team: \n"
78+"MIME-Version: 1.0\n"
79+"Content-Type: text/plain; charset=UTF-8\n"
80+"Content-Transfer-Encoding: \n"
81+"Plural-Forms: \n"
82+
83+#. module: product_customer_code
84+#: view:product.product:0
85+msgid "Information"
86+msgstr "Información"
87+
88+#. module: product_customer_code
89+#: view:product.product:0
90+msgid "Customer Code"
91+msgstr "Código del Cliente"
92+
93+#. module: product_customer_code
94+#: model:res.groups,name:product_customer_code.group_product_customer_code
95+msgid "Product_Customer / Manager"
96+msgstr "Producto_Cliente / Gerente"
97+
98+#. module: product_customer_code
99+#: field:product.customer.code,product_code:0
100+msgid "Customer Product Code"
101+msgstr "Código del Producto por Cliente"
102+
103+#. module: product_customer_code
104+#: field:product.customer.code,company_id:0
105+msgid "Company"
106+msgstr "Compañia"
107+
108+#. module: product_customer_code
109+#: view:product.customer.code:0
110+msgid "Product Customer Code"
111+msgstr "Código del Producto por Cliente"
112+
113+#. module: product_customer_code
114+#: model:ir.model,name:product_customer_code.model_product_product
115+#: field:product.customer.code,product_id:0
116+msgid "Product"
117+msgstr "Producto"
118+
119+#. module: product_customer_code
120+#: field:product.product,product_customer_code_ids:0
121+msgid "Customer Codes"
122+msgstr "Código del Cliente"
123+
124+#. module: product_customer_code
125+#: constraint:product.product:0
126+msgid "Error: Invalid ean code"
127+msgstr "Error: Código EAN erróneo"
128+
129+#. module: product_customer_code
130+#: help:product.customer.code,product_code:0
131+msgid "This customer's product code will be used when searching into a request for quotation."
132+msgstr "El código de producto de este cliente se utiliza cuando se busca dentro de una solicitud de cotización."
133+
134+#. module: product_customer_code
135+#: field:product.customer.code,product_name:0
136+msgid "Customer Product Name"
137+msgstr "Nombre del producto"
138+
139+#. module: product_customer_code
140+#: field:product.customer.code,partner_id:0
141+msgid "Customer"
142+msgstr "Cliente"
143+
144+#. module: product_customer_code
145+#: help:product.customer.code,product_name:0
146+msgid "This customer's product name will be used when searching into a request for quotation."
147+msgstr "El nombre de producto de este cliente se utiliza cuando se busca dentro de una solicitud de cotización."
148+
149+#. module: product_customer_code
150+#: model:ir.model,name:product_customer_code.model_product_customer_code
151+msgid "Add manies Code of Customer's"
152+msgstr "Agregar varios códigos de clientes"
153+
154+#. module: product_customer_code
155+#: sql_constraint:product.customer.code:0
156+msgid "Product Code must be unique"
157+msgstr "El código del producto debe ser unico"
158
159=== added file 'product_customer_code/product.py'
160--- product_customer_code/product.py 1970-01-01 00:00:00 +0000
161+++ product_customer_code/product.py 2012-07-07 21:55:21 +0000
162@@ -0,0 +1,51 @@
163+# -*- coding: utf-8 -*-
164+###########################################################################
165+# Module Writen to OpenERP, Open Source Management Solution
166+#
167+# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com
168+# All Rights Reserved.
169+# info@vauxoo.com
170+############################################################################
171+# Coded by: Rodo (rodo@vauxoo.com),Moy (moylop260@vauxoo.com)
172+############################################################################
173+#
174+# This program is free software: you can redistribute it and/or modify
175+# it under the terms of the GNU Affero General Public License as
176+# published by the Free Software Foundation, either version 3 of the
177+# License, or (at your option) any later version.
178+#
179+# This program is distributed in the hope that it will be useful,
180+# but WITHOUT ANY WARRANTY; without even the implied warranty of
181+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
182+# GNU Affero General Public License for more details.
183+#
184+# You should have received a copy of the GNU Affero General Public License
185+# along with this program. If not, see <http://www.gnu.org/licenses/>.
186+#
187+##############################################################################
188+from osv import osv, fields
189+from tools.translate import _
190+
191+class product_product(osv.osv):
192+ _inherit = "product.product"
193+
194+ _columns = {
195+ 'product_customer_code_ids': fields.one2many('product.customer.code', 'product_id', 'Customer Codes'),
196+ }
197+
198+ def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=80):
199+ res = super(product_product, self).name_search(cr, user, name, args, operator, context, limit)
200+ product_customer_code_obj=self.pool.get('product.customer.code')
201+ if not res:
202+ ids=[]
203+ partner_id = context.get('partner_id', False)
204+ if partner_id:
205+ id_prod_code=product_customer_code_obj.search(cr, user, [('product_code','=',name),('partner_id','=',partner_id)], limit=limit, context=context)
206+ #TODO: Search for product customer name
207+ id_prod=id_prod_code and product_customer_code_obj.browse(cr, user, id_prod_code, context=context) or []
208+ for ppu in id_prod:
209+ ids.append(ppu.product_id.id)
210+ if ids:
211+ res = self.name_get(cr, user, ids, context)
212+ return res
213+product_product()
214
215=== added file 'product_customer_code/product_customer_code.py'
216--- product_customer_code/product_customer_code.py 1970-01-01 00:00:00 +0000
217+++ product_customer_code/product_customer_code.py 2012-07-07 21:55:21 +0000
218@@ -0,0 +1,52 @@
219+# -*- coding: utf-8 -*-
220+###########################################################################
221+# Module Writen to OpenERP, Open Source Management Solution
222+#
223+# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com
224+# All Rights Reserved.
225+# info@vauxoo.com
226+############################################################################
227+# Coded by: Rodo (rodo@vauxoo.com),Moy (moylop260@vauxoo.com)
228+############################################################################
229+#
230+# This program is free software: you can redistribute it and/or modify
231+# it under the terms of the GNU Affero General Public License as
232+# published by the Free Software Foundation, either version 3 of the
233+# License, or (at your option) any later version.
234+#
235+# This program is distributed in the hope that it will be useful,
236+# but WITHOUT ANY WARRANTY; without even the implied warranty of
237+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
238+# GNU Affero General Public License for more details.
239+#
240+# You should have received a copy of the GNU Affero General Public License
241+# along with this program. If not, see <http://www.gnu.org/licenses/>.
242+#
243+##############################################################################
244+from osv import osv, fields
245+from tools.translate import _
246+
247+class product_customer_code(osv.osv):
248+ _name = "product.customer.code"
249+ _description = "Add manies Code of Customer's"
250+
251+ _rec_name = 'product_code'
252+
253+ _columns = {
254+ 'product_code': fields.char('Customer Product Code', size=64, required=True, help="This customer's product code will be used when searching into a request for quotation."),
255+ 'product_name': fields.char('Customer Product Name', size=128, help="This customer's product name will be used when searching into a request for quotation."),
256+ 'product_id': fields.many2one('product.product', 'Product', required=True),
257+ 'partner_id': fields.many2one('res.partner', 'Customer', required=True),
258+ 'company_id': fields.many2one('res.company','Company', required=True),
259+ }
260+
261+ _defaults = {
262+ 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'product.customer.code', context=c),
263+ }
264+
265+ _sql_constraints = [
266+ ('unique_code', 'unique(product_code,company_id,partner_id)', 'Product Code must be unique'),
267+ ]
268+
269+ #TODO: Add index to product_code, partner_id
270+product_customer_code()
271
272=== added file 'product_customer_code/product_customer_code.xml'
273--- product_customer_code/product_customer_code.xml 1970-01-01 00:00:00 +0000
274+++ product_customer_code/product_customer_code.xml 2012-07-07 21:55:21 +0000
275@@ -0,0 +1,32 @@
276+<?xml version="1.0" encoding="utf-8"?>
277+<openerp>
278+ <data>
279+
280+ <record model="ir.ui.view" id="view_product_customer_code_form">
281+ <field name="name">view.product.customer.code.form</field>
282+ <field name="model">product.customer.code</field>
283+ <field name="type">form</field>
284+ <field name="arch" type="xml">
285+ <form string="Product Customer Code">
286+ <field name="product_code"/>
287+ <field name="partner_id"/>
288+ <field name="company_id" widget="selection" groups="base.group_multi_company"/>
289+ </form>
290+ </field>
291+ </record>
292+ <record model="ir.ui.view" id="view_product_customer_code_tree">
293+ <field name="name">view.product.customer.code.tree</field>
294+ <field name="model">product.customer.code</field>
295+ <field name="type">tree</field>
296+ <field name="arch" type="xml">
297+ <tree string="Product Customer Code" editable="bottom">
298+ <field name="product_code"/>
299+ <field name="partner_id"/>
300+ <field name="company_id" widget="selection" groups="base.group_multi_company"/>
301+ </tree>
302+ </field>
303+ </record>
304+
305+ </data>
306+</openerp>
307+
308
309=== added file 'product_customer_code/product_product.xml'
310--- product_customer_code/product_product.xml 1970-01-01 00:00:00 +0000
311+++ product_customer_code/product_product.xml 2012-07-07 21:55:21 +0000
312@@ -0,0 +1,20 @@
313+<?xml version="1.0" encoding="utf-8"?>
314+<openerp>
315+ <data>
316+
317+ <record model="ir.ui.view" id="product_normal_form_inh_product_customer_code_01">
318+ <field name="name">product.normal.form.inh.product.customer.code.01</field>
319+ <field name="model">product.product</field>
320+ <field name="type">form</field>
321+ <field name="inherit_id" ref="product.product_normal_form_view"/>
322+ <field name="arch" type="xml">
323+ <page string="Information" position="after">
324+ <page string="Customer Code">
325+ <field name="product_customer_code_ids" colspan="4" nolabel="1"/>
326+ </page>
327+ </page>
328+ </field>
329+ </record>
330+
331+ </data>
332+</openerp>
333
334=== added directory 'product_customer_code/security'
335=== added file 'product_customer_code/security/ir.model.access.csv'
336--- product_customer_code/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
337+++ product_customer_code/security/ir.model.access.csv 2012-07-07 21:55:21 +0000
338@@ -0,0 +1,3 @@
339+id,name,model_id:id,group_id:id,perm_create,perm_unlink,perm_write,perm_read
340+access_product_customer_code_user,product.customer.code.user,model_product_customer_code,,0,0,0,1
341+access_product_customer_code_manager,product.customer.code.manager,model_product_customer_code,,1,1,1,1
342
343=== added file 'product_customer_code/security/product_customer_code_security.xml'
344--- product_customer_code/security/product_customer_code_security.xml 1970-01-01 00:00:00 +0000
345+++ product_customer_code/security/product_customer_code_security.xml 2012-07-07 21:55:21 +0000
346@@ -0,0 +1,12 @@
347+<?xml version="1.0" encoding="utf-8"?>
348+<openerp>
349+ <data noupdate="0">
350+ <record id="group_product_customer_code_manager" model="res.groups">
351+ <field name="name">Product_Customer / Manager</field>
352+ </record>
353+ <record id="group_product_customer_code_user" model="res.groups">
354+ <field name="name">Product_Customer / User</field>
355+ </record>
356+
357+ </data>
358+</openerp>