Merge lp:~agilebg/stock-logistic-flows/adding_product_customer_code_picking into lp:stock-logistic-flows

Proposed by Nicola Malcontenti - Agile BG
Status: Needs review
Proposed branch: lp:~agilebg/stock-logistic-flows/adding_product_customer_code_picking
Merge into: lp:stock-logistic-flows
Diff against target: 260 lines (+229/-0)
6 files modified
product_customer_code_picking/__init__.py (+21/-0)
product_customer_code_picking/__openerp__.py (+48/-0)
product_customer_code_picking/i18n/it.po (+33/-0)
product_customer_code_picking/i18n/product_customer_code_picking.pot (+32/-0)
product_customer_code_picking/stock_picking.py (+59/-0)
product_customer_code_picking/stock_picking_view.xml (+36/-0)
To merge this branch: bzr merge lp:~agilebg/stock-logistic-flows/adding_product_customer_code_picking
Reviewer Review Type Date Requested Status
Alexandre Fayolle - camptocamp Needs Resubmitting
Lorenzo Battistini (community) Needs Fixing
Pedro Manuel Baeza code review Needs Fixing
Raphaël Valyi - http://www.akretion.com Approve
Joël Grand-Guillaume @ camptocamp depends on an mp work in progress Needs Fixing
Review via email: mp+202472@code.launchpad.net

Description of the change

Based on product_customer_code,this module loads in every stock picking the customer code defined in the product.
This module depends on https://code.launchpad.net/~akretion-team/openerp-product-attributes/7.0-product-customer-code-extraction/+merge/198296.

To post a comment you must log in.
Revision history for this message
Lorenzo Battistini (elbati) :
review: Approve (code review)
Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Do not merge until other MP is ready

review: Needs Fixing (depends on an mp work in progress)
Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

LGTM, pending merges have been processed now

review: Approve
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

I have made some comments inline, and I wonder if the module name wouldn't be better as stock_picking_product_customer_code to follow current core conventions (more or less, you know that there is no written rules).

Regards.

review: Needs Fixing (code review)
58. By Alex Comba - Agile BG

[FIX] how to get partner inside of _get_product_customer_code method

59. By Alex Comba - Agile BG

[FIX] Removed context assignement because not needed

60. By Alex Comba - Agile BG

[IMP] Better practices

61. By Alex Comba - Agile BG

[IMP] better readibility

62. By Alex Comba - Agile BG

[IMP] Replaced browse by read to improve performance

63. By Alex Comba - Agile BG

[FIX] keys in manifest file

64. By Alex Comba - Agile BG

[FIX] Applies some PEP8 cleanup

65. By Alex Comba - Agile BG

[ADD] contributors section

Revision history for this message
Alex Comba - Agile BG (tafaru) wrote :

Hi Pedro,

thank you for your review and for your precious hints!

I made the changes as you suggested us. In addition I fixed a bug in rev.58.

Cheers.

Revision history for this message
Lorenzo Battistini (elbati) wrote :

Including 1 diff comment

About the module name: in general I agree with Pedro.
In this case, the other modules follow the same naming as this: see
http://bazaar.launchpad.net/~account-core-editors/account-invoicing/7.0/files/47/product_customer_code_invoice/
So, for now, I would keep the current name

review: Needs Fixing
66. By Alex Comba - Agile BG

[FIX] Added retrieve of parentd_id

Revision history for this message
Alex Comba - Agile BG (tafaru) wrote :

Lorenzo,

please have a look at my last commit, now it should be ok.

Cheers.

Revision history for this message
Lorenzo Battistini (elbati) wrote :

2014-06-22 23:10 GMT+02:00 Alex Comba - Agile BG <email address hidden>:

> Lorenzo,
>
> please have a look at my last commit, now it should be ok.
>
>
Thanks Alex,

maybe we could handle even more particular cases by using the address_get
method to retrieve the company?

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

The source code management for this project has been moved to https://github.com/OCA/stock-logistics-workflow

Could you resubmit this MP on the new site?

review: Needs Resubmitting
Revision history for this message
Alex Comba - Agile BG (tafaru) wrote :

Alexandre, I'll do it asap.

Cheers.

Revision history for this message
Alex Comba - Agile BG (tafaru) wrote :

Alexandre,

you can find the related PR on github here: https://github.com/OCA/stock-logistics-workflow/pull/2

Unmerged revisions

66. By Alex Comba - Agile BG

[FIX] Added retrieve of parentd_id

65. By Alex Comba - Agile BG

[ADD] contributors section

64. By Alex Comba - Agile BG

[FIX] Applies some PEP8 cleanup

63. By Alex Comba - Agile BG

[FIX] keys in manifest file

62. By Alex Comba - Agile BG

[IMP] Replaced browse by read to improve performance

61. By Alex Comba - Agile BG

[IMP] better readibility

60. By Alex Comba - Agile BG

[IMP] Better practices

59. By Alex Comba - Agile BG

[FIX] Removed context assignement because not needed

58. By Alex Comba - Agile BG

[FIX] how to get partner inside of _get_product_customer_code method

57. By Nicola Malcontenti - Agile BG

[FIX] added pot

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'product_customer_code_picking'
2=== added file 'product_customer_code_picking/__init__.py'
3--- product_customer_code_picking/__init__.py 1970-01-01 00:00:00 +0000
4+++ product_customer_code_picking/__init__.py 2014-06-22 21:01:44 +0000
5@@ -0,0 +1,21 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
10+# Author: Nicola Malcontenti <nicola.malcontenti@agilebg.com>
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 published
14+# by the Free Software Foundation, either version 3 of the License, or
15+# (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+from . import stock_picking
27
28=== added file 'product_customer_code_picking/__openerp__.py'
29--- product_customer_code_picking/__openerp__.py 1970-01-01 00:00:00 +0000
30+++ product_customer_code_picking/__openerp__.py 2014-06-22 21:01:44 +0000
31@@ -0,0 +1,48 @@
32+# -*- coding: utf-8 -*-
33+##############################################################################
34+#
35+# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
36+# Author: Nicola Malcontenti <nicola.malcontenti@agilebg.com>
37+#
38+# This program is free software: you can redistribute it and/or modify
39+# it under the terms of the GNU Affero General Public License as published
40+# by the Free Software Foundation, either version 3 of the License, or
41+# (at your option) any later version.
42+#
43+# This program is distributed in the hope that it will be useful,
44+# but WITHOUT ANY WARRANTY; without even the implied warranty of
45+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46+# GNU Affero General Public License for more details.
47+#
48+# You should have received a copy of the GNU Affero General Public License
49+# along with this program. If not, see <http://www.gnu.org/licenses/>.
50+#
51+##############################################################################
52+{
53+ "name": "Product Customer code for stock picking",
54+ "version": "1.0",
55+ "author": "Agile Business Group",
56+ "website": "http://www.agilebg.com",
57+ "license": 'AGPL-3',
58+ "category": "Stock",
59+ "depends": [
60+ 'base',
61+ 'product',
62+ 'stock',
63+ 'product_customer_code'
64+ ],
65+ "description": """
66+Based on product_customer_code, this module loads in every stock picking
67+the customer code defined in the product.
68+
69+Contributors
70+------------
71+* Nicola Malcontenti <nicola.malcontenti@agilebg.com>
72+* Alex Comba <alex.comba@agilebg.com>
73+""",
74+ "demo": [],
75+ "data": [
76+ 'stock_picking_view.xml',
77+ ],
78+ "installable": True,
79+}
80
81=== added directory 'product_customer_code_picking/i18n'
82=== added file 'product_customer_code_picking/i18n/it.po'
83--- product_customer_code_picking/i18n/it.po 1970-01-01 00:00:00 +0000
84+++ product_customer_code_picking/i18n/it.po 2014-06-22 21:01:44 +0000
85@@ -0,0 +1,33 @@
86+# Translation of OpenERP Server.
87+# This file contains the translation of the following modules:
88+# * product_customer_code_picking
89+#
90+msgid ""
91+msgstr ""
92+"Project-Id-Version: OpenERP Server 7.0\n"
93+"Report-Msgid-Bugs-To: \n"
94+"POT-Creation-Date: 2014-01-15 14:28+0000\n"
95+"PO-Revision-Date: 2014-01-15 15:29+0100\n"
96+"Last-Translator: <>\n"
97+"Language-Team: \n"
98+"MIME-Version: 1.0\n"
99+"Content-Type: text/plain; charset=UTF-8\n"
100+"Content-Transfer-Encoding: 8bit\n"
101+"Plural-Forms: \n"
102+"Language: it\n"
103+"X-Generator: Poedit 1.6.2\n"
104+
105+#. module: product_customer_code_picking
106+#: field:stock.move,product_customer_code:0
107+msgid "Product Customer Code"
108+msgstr "Codice Prodotto Cliente"
109+
110+#. module: product_customer_code_picking
111+#: model:ir.model,name:product_customer_code_picking.model_stock_move
112+msgid "Stock Move"
113+msgstr "Movimento di magazzino"
114+
115+#. module: product_customer_code_picking
116+#: model:ir.model,name:product_customer_code_picking.model_stock_picking
117+msgid "Picking List"
118+msgstr "Documento di trasporto"
119
120=== added file 'product_customer_code_picking/i18n/product_customer_code_picking.pot'
121--- product_customer_code_picking/i18n/product_customer_code_picking.pot 1970-01-01 00:00:00 +0000
122+++ product_customer_code_picking/i18n/product_customer_code_picking.pot 2014-06-22 21:01:44 +0000
123@@ -0,0 +1,32 @@
124+# Translation of OpenERP Server.
125+# This file contains the translation of the following modules:
126+# * product_customer_code_picking
127+#
128+msgid ""
129+msgstr ""
130+"Project-Id-Version: OpenERP Server 7.0\n"
131+"Report-Msgid-Bugs-To: \n"
132+"POT-Creation-Date: 2014-01-15 14:28+0000\n"
133+"PO-Revision-Date: 2014-01-15 14:28+0000\n"
134+"Last-Translator: <>\n"
135+"Language-Team: \n"
136+"MIME-Version: 1.0\n"
137+"Content-Type: text/plain; charset=UTF-8\n"
138+"Content-Transfer-Encoding: \n"
139+"Plural-Forms: \n"
140+
141+#. module: product_customer_code_picking
142+#: field:stock.move,product_customer_code:0
143+msgid "Product Customer Code"
144+msgstr ""
145+
146+#. module: product_customer_code_picking
147+#: model:ir.model,name:product_customer_code_picking.model_stock_move
148+msgid "Stock Move"
149+msgstr ""
150+
151+#. module: product_customer_code_picking
152+#: model:ir.model,name:product_customer_code_picking.model_stock_picking
153+msgid "Picking List"
154+msgstr ""
155+
156
157=== added file 'product_customer_code_picking/stock_picking.py'
158--- product_customer_code_picking/stock_picking.py 1970-01-01 00:00:00 +0000
159+++ product_customer_code_picking/stock_picking.py 2014-06-22 21:01:44 +0000
160@@ -0,0 +1,59 @@
161+# -*- coding: utf-8 -*-
162+##############################################################################
163+#
164+# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
165+# Author: Nicola Malcontenti <nicola.malcontenti@agilebg.com>
166+#
167+# This program is free software: you can redistribute it and/or modify
168+# it under the terms of the GNU Affero General Public License as published
169+# by the Free Software Foundation, either version 3 of the License, or
170+# (at your option) any later version.
171+#
172+# This program is distributed in the hope that it will be useful,
173+# but WITHOUT ANY WARRANTY; without even the implied warranty of
174+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
175+# GNU Affero General Public License for more details.
176+#
177+# You should have received a copy of the GNU Affero General Public License
178+# along with this program. If not, see <http://www.gnu.org/licenses/>.
179+#
180+##############################################################################
181+from openerp.osv import fields, orm
182+
183+
184+class stock_move(orm.Model):
185+ _inherit = 'stock.move'
186+
187+ def _get_product_customer_code(
188+ self, cr, uid, ids, name, args, context=None
189+ ):
190+ res = {}
191+ product_customer_code_obj = self.pool['product.customer.code']
192+ for move in self.browse(cr, uid, ids, context=context):
193+ res[move.id] = ''
194+ partner = move.picking_id.partner_id
195+ if move.picking_id.partner_id.parent_id:
196+ partner = move.picking_id.partner_id.parent_id
197+ product = move.product_id
198+ if product and partner:
199+ code_ids = product_customer_code_obj.search(cr, uid, [
200+ ('product_id', '=', product.id),
201+ ('partner_id', '=', partner.id),
202+ ], limit=1, context=context)
203+ if code_ids:
204+ data = product_customer_code_obj.read(
205+ cr, uid, code_ids[0],
206+ ['product_code'], context=context
207+ )
208+ res[move.id] = (
209+ 'product_code' in data
210+ and data['product_code']
211+ or ''
212+ )
213+ return res
214+
215+ _columns = {
216+ 'product_customer_code': fields.function(
217+ _get_product_customer_code,
218+ string='Product Customer Code', type='char', size=64),
219+ }
220
221=== added file 'product_customer_code_picking/stock_picking_view.xml'
222--- product_customer_code_picking/stock_picking_view.xml 1970-01-01 00:00:00 +0000
223+++ product_customer_code_picking/stock_picking_view.xml 2014-06-22 21:01:44 +0000
224@@ -0,0 +1,36 @@
225+<?xml version="1.0" encoding="utf-8"?>
226+<!--
227+ product customer code picking for OpenERP
228+ Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>).
229+ Authors, Nicola Malcontenti, nicola.malcontenti@agilebg.com
230+ The licence is in the file __openerp__.py
231+-->
232+<openerp>
233+ <data>
234+
235+ <record id="view_move_picking_tree" model="ir.ui.view">
236+ <field name="name">stock.move.product.code.tree</field>
237+ <field name="model">stock.move</field>
238+ <field name="inherit_id" ref="stock.view_move_picking_tree"/>
239+ <field eval="16" name="priority"/>
240+ <field name="arch" type="xml">
241+ <field name="product_id" position="after">
242+ <field name="product_customer_code" />
243+ </field>
244+ </field>
245+ </record>
246+
247+ <record id="view_move_picking_form" model="ir.ui.view">
248+ <field name="name">stock.move.product.code.form</field>
249+ <field name="model">stock.move</field>
250+ <field name="inherit_id" ref="stock.view_move_picking_form"/>
251+ <field eval="16" name="priority"/>
252+ <field name="arch" type="xml">
253+ <field name="product_id" position="after">
254+ <field name="product_customer_code" />
255+ </field>
256+ </field>
257+ </record>
258+
259+ </data>
260+</openerp>

Subscribers

People subscribed via source and target branches