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
=== added directory 'product_customer_code'
=== added file 'product_customer_code/__init__.py'
--- product_customer_code/__init__.py 1970-01-01 00:00:00 +0000
+++ product_customer_code/__init__.py 2012-07-07 21:55:21 +0000
@@ -0,0 +1,2 @@
1import product_customer_code
2import product
03
=== added file 'product_customer_code/__openerp__.py'
--- product_customer_code/__openerp__.py 1970-01-01 00:00:00 +0000
+++ product_customer_code/__openerp__.py 2012-07-07 21:55:21 +0000
@@ -0,0 +1,47 @@
1# -*- encoding: utf-8 -*-
2###########################################################################
3# Module Writen to OpenERP, Open Source Management Solution
4#
5# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com/
6# All Rights Reserved.
7# info Vauxoo (info@vauxoo.com)
8############################################################################
9# Coded by: el_rodo_1 (rodo@vauxoo.com)
10############################################################################
11#
12# This program is free software: you can redistribute it and/or modify
13# it under the terms of the GNU Affero 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 Affero General Public License for more details.
21#
22# You should have received a copy of the GNU Affero General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24#
25##############################################################################
26{
27 "name" : "Products Customer Code",
28 "version" : "1.0",
29 "author" : "Vauxoo",
30 "website" : "http://www.vauxoo.com/",
31 "license" : "AGPL-3",
32 "category" : "Generic Modules/Product",
33 "depends" : ["base", "product"],
34 "init_xml" : [],
35 "demo_xml" : [],
36 "description": """
37Add manies Codes of Customer's in product
38 """,
39 "update_xml" : ["security/product_customer_code_security.xml",
40 "security/ir.model.access.csv",
41 "product_customer_code.xml",
42 "product_product.xml",
43
44 ],
45 "active": False,
46 "installable": True,
47}
048
=== added directory 'product_customer_code/i18n'
=== added file 'product_customer_code/i18n/es.po'
--- product_customer_code/i18n/es.po 1970-01-01 00:00:00 +0000
+++ product_customer_code/i18n/es.po 2012-07-07 21:55:21 +0000
@@ -0,0 +1,92 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * product_customer_code
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 6.1\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2012-07-02 20:40+0000\n"
10"PO-Revision-Date: 2012-07-02 20:40+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#. module: product_customer_code
19#: view:product.product:0
20msgid "Information"
21msgstr "Información"
22
23#. module: product_customer_code
24#: view:product.product:0
25msgid "Customer Code"
26msgstr "Código del Cliente"
27
28#. module: product_customer_code
29#: model:res.groups,name:product_customer_code.group_product_customer_code
30msgid "Product_Customer / Manager"
31msgstr "Producto_Cliente / Gerente"
32
33#. module: product_customer_code
34#: field:product.customer.code,product_code:0
35msgid "Customer Product Code"
36msgstr "Código del Producto por Cliente"
37
38#. module: product_customer_code
39#: field:product.customer.code,company_id:0
40msgid "Company"
41msgstr "Compañia"
42
43#. module: product_customer_code
44#: view:product.customer.code:0
45msgid "Product Customer Code"
46msgstr "Código del Producto por Cliente"
47
48#. module: product_customer_code
49#: model:ir.model,name:product_customer_code.model_product_product
50#: field:product.customer.code,product_id:0
51msgid "Product"
52msgstr "Producto"
53
54#. module: product_customer_code
55#: field:product.product,product_customer_code_ids:0
56msgid "Customer Codes"
57msgstr "Código del Cliente"
58
59#. module: product_customer_code
60#: constraint:product.product:0
61msgid "Error: Invalid ean code"
62msgstr "Error: Código EAN erróneo"
63
64#. module: product_customer_code
65#: help:product.customer.code,product_code:0
66msgid "This customer's product code will be used when searching into a request for quotation."
67msgstr "El código de producto de este cliente se utiliza cuando se busca dentro de una solicitud de cotización."
68
69#. module: product_customer_code
70#: field:product.customer.code,product_name:0
71msgid "Customer Product Name"
72msgstr "Nombre del producto"
73
74#. module: product_customer_code
75#: field:product.customer.code,partner_id:0
76msgid "Customer"
77msgstr "Cliente"
78
79#. module: product_customer_code
80#: help:product.customer.code,product_name:0
81msgid "This customer's product name will be used when searching into a request for quotation."
82msgstr "El nombre de producto de este cliente se utiliza cuando se busca dentro de una solicitud de cotización."
83
84#. module: product_customer_code
85#: model:ir.model,name:product_customer_code.model_product_customer_code
86msgid "Add manies Code of Customer's"
87msgstr "Agregar varios códigos de clientes"
88
89#. module: product_customer_code
90#: sql_constraint:product.customer.code:0
91msgid "Product Code must be unique"
92msgstr "El código del producto debe ser unico"
093
=== added file 'product_customer_code/product.py'
--- product_customer_code/product.py 1970-01-01 00:00:00 +0000
+++ product_customer_code/product.py 2012-07-07 21:55:21 +0000
@@ -0,0 +1,51 @@
1# -*- coding: utf-8 -*-
2###########################################################################
3# Module Writen to OpenERP, Open Source Management Solution
4#
5# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com
6# All Rights Reserved.
7# info@vauxoo.com
8############################################################################
9# Coded by: Rodo (rodo@vauxoo.com),Moy (moylop260@vauxoo.com)
10############################################################################
11#
12# This program is free software: you can redistribute it and/or modify
13# it under the terms of the GNU Affero 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 Affero General Public License for more details.
21#
22# You should have received a copy of the GNU Affero General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24#
25##############################################################################
26from osv import osv, fields
27from tools.translate import _
28
29class product_product(osv.osv):
30 _inherit = "product.product"
31
32 _columns = {
33 'product_customer_code_ids': fields.one2many('product.customer.code', 'product_id', 'Customer Codes'),
34 }
35
36 def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=80):
37 res = super(product_product, self).name_search(cr, user, name, args, operator, context, limit)
38 product_customer_code_obj=self.pool.get('product.customer.code')
39 if not res:
40 ids=[]
41 partner_id = context.get('partner_id', False)
42 if partner_id:
43 id_prod_code=product_customer_code_obj.search(cr, user, [('product_code','=',name),('partner_id','=',partner_id)], limit=limit, context=context)
44 #TODO: Search for product customer name
45 id_prod=id_prod_code and product_customer_code_obj.browse(cr, user, id_prod_code, context=context) or []
46 for ppu in id_prod:
47 ids.append(ppu.product_id.id)
48 if ids:
49 res = self.name_get(cr, user, ids, context)
50 return res
51product_product()
052
=== added file 'product_customer_code/product_customer_code.py'
--- product_customer_code/product_customer_code.py 1970-01-01 00:00:00 +0000
+++ product_customer_code/product_customer_code.py 2012-07-07 21:55:21 +0000
@@ -0,0 +1,52 @@
1# -*- coding: utf-8 -*-
2###########################################################################
3# Module Writen to OpenERP, Open Source Management Solution
4#
5# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com
6# All Rights Reserved.
7# info@vauxoo.com
8############################################################################
9# Coded by: Rodo (rodo@vauxoo.com),Moy (moylop260@vauxoo.com)
10############################################################################
11#
12# This program is free software: you can redistribute it and/or modify
13# it under the terms of the GNU Affero 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 Affero General Public License for more details.
21#
22# You should have received a copy of the GNU Affero General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24#
25##############################################################################
26from osv import osv, fields
27from tools.translate import _
28
29class product_customer_code(osv.osv):
30 _name = "product.customer.code"
31 _description = "Add manies Code of Customer's"
32
33 _rec_name = 'product_code'
34
35 _columns = {
36 '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."),
37 '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."),
38 'product_id': fields.many2one('product.product', 'Product', required=True),
39 'partner_id': fields.many2one('res.partner', 'Customer', required=True),
40 'company_id': fields.many2one('res.company','Company', required=True),
41 }
42
43 _defaults = {
44 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'product.customer.code', context=c),
45 }
46
47 _sql_constraints = [
48 ('unique_code', 'unique(product_code,company_id,partner_id)', 'Product Code must be unique'),
49 ]
50
51 #TODO: Add index to product_code, partner_id
52product_customer_code()
053
=== added file 'product_customer_code/product_customer_code.xml'
--- product_customer_code/product_customer_code.xml 1970-01-01 00:00:00 +0000
+++ product_customer_code/product_customer_code.xml 2012-07-07 21:55:21 +0000
@@ -0,0 +1,32 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record model="ir.ui.view" id="view_product_customer_code_form">
6 <field name="name">view.product.customer.code.form</field>
7 <field name="model">product.customer.code</field>
8 <field name="type">form</field>
9 <field name="arch" type="xml">
10 <form string="Product Customer Code">
11 <field name="product_code"/>
12 <field name="partner_id"/>
13 <field name="company_id" widget="selection" groups="base.group_multi_company"/>
14 </form>
15 </field>
16 </record>
17 <record model="ir.ui.view" id="view_product_customer_code_tree">
18 <field name="name">view.product.customer.code.tree</field>
19 <field name="model">product.customer.code</field>
20 <field name="type">tree</field>
21 <field name="arch" type="xml">
22 <tree string="Product Customer Code" editable="bottom">
23 <field name="product_code"/>
24 <field name="partner_id"/>
25 <field name="company_id" widget="selection" groups="base.group_multi_company"/>
26 </tree>
27 </field>
28 </record>
29
30 </data>
31</openerp>
32
033
=== added file 'product_customer_code/product_product.xml'
--- product_customer_code/product_product.xml 1970-01-01 00:00:00 +0000
+++ product_customer_code/product_product.xml 2012-07-07 21:55:21 +0000
@@ -0,0 +1,20 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record model="ir.ui.view" id="product_normal_form_inh_product_customer_code_01">
6 <field name="name">product.normal.form.inh.product.customer.code.01</field>
7 <field name="model">product.product</field>
8 <field name="type">form</field>
9 <field name="inherit_id" ref="product.product_normal_form_view"/>
10 <field name="arch" type="xml">
11 <page string="Information" position="after">
12 <page string="Customer Code">
13 <field name="product_customer_code_ids" colspan="4" nolabel="1"/>
14 </page>
15 </page>
16 </field>
17 </record>
18
19 </data>
20</openerp>
021
=== added directory 'product_customer_code/security'
=== added file 'product_customer_code/security/ir.model.access.csv'
--- product_customer_code/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
+++ product_customer_code/security/ir.model.access.csv 2012-07-07 21:55:21 +0000
@@ -0,0 +1,3 @@
1id,name,model_id:id,group_id:id,perm_create,perm_unlink,perm_write,perm_read
2access_product_customer_code_user,product.customer.code.user,model_product_customer_code,,0,0,0,1
3access_product_customer_code_manager,product.customer.code.manager,model_product_customer_code,,1,1,1,1
04
=== added file 'product_customer_code/security/product_customer_code_security.xml'
--- product_customer_code/security/product_customer_code_security.xml 1970-01-01 00:00:00 +0000
+++ product_customer_code/security/product_customer_code_security.xml 2012-07-07 21:55:21 +0000
@@ -0,0 +1,12 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data noupdate="0">
4 <record id="group_product_customer_code_manager" model="res.groups">
5 <field name="name">Product_Customer / Manager</field>
6 </record>
7 <record id="group_product_customer_code_user" model="res.groups">
8 <field name="name">Product_Customer / User</field>
9 </record>
10
11 </data>
12</openerp>