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

Proposed by Alex Comba - Agile BG
Status: Needs review
Proposed branch: lp:~agilebg/stock-logistic-flows/adding_picking_line_description_7
Merge into: lp:stock-logistic-flows
Diff against target: 405 lines (+351/-0)
10 files modified
picking_line_description/__init__.py (+23/-0)
picking_line_description/__openerp__.py (+49/-0)
picking_line_description/i18n/it.po (+46/-0)
picking_line_description/i18n/picking_line_description.pot (+42/-0)
picking_line_description/res_config.py (+37/-0)
picking_line_description/res_config_view.xml (+20/-0)
picking_line_description/security/stock_security.xml (+13/-0)
picking_line_description/stock.py (+66/-0)
picking_line_description/stock_view.xml (+29/-0)
picking_line_description/test/picking_line_description.yml (+26/-0)
To merge this branch: bzr merge lp:~agilebg/stock-logistic-flows/adding_picking_line_description_7
Reviewer Review Type Date Requested Status
Alexandre Fayolle - camptocamp Needs Resubmitting
Lorenzo Battistini (community) code review Approve
Review via email: mp+219800@code.launchpad.net

Commit message

[ADD] module picking_line_description

Description of the change

On the basis of 'invoice_line_description' and 'sale_line_description' modules, previously released, I created 'picking_line_description' which allows to use only the product description on the picking order lines. To do so, the user has to belong to group_use_product_description_per_picking_line.
This is possible by selecting the related option in the following menu:

Settings --> Configuration --> Warehouse --> Products

To post a comment you must log in.
64. By Alex Comba - Agile BG

[FIX] Added field name to view_move_picking_form

65. By Alex Comba - Agile BG

[FIX] Get visible field name

66. By Alex Comba - Agile BG

[FIX] Moved field name after product_id

67. By Alex Comba - Agile BG

[FIX] some minor typos

68. By Alex Comba - Agile BG

[FIX] Updated the translation files

Revision history for this message
Lorenzo Battistini (elbati) :
review: Approve (code review)
69. By Alex Comba - Agile BG

[FIX] Pushed lang trough the product context to fix the missing propagation of the context in the method onchange_product_id

70. By Alex Comba - Agile BG

[FIX] Applied some PEP8

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 :

Hi Alexandre,

sure, I'll migrate it to github asap.

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

Alexandre,

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

Unmerged revisions

70. By Alex Comba - Agile BG

[FIX] Applied some PEP8

69. By Alex Comba - Agile BG

[FIX] Pushed lang trough the product context to fix the missing propagation of the context in the method onchange_product_id

68. By Alex Comba - Agile BG

[FIX] Updated the translation files

67. By Alex Comba - Agile BG

[FIX] some minor typos

66. By Alex Comba - Agile BG

[FIX] Moved field name after product_id

65. By Alex Comba - Agile BG

[FIX] Get visible field name

64. By Alex Comba - Agile BG

[FIX] Added field name to view_move_picking_form

63. By Alex Comba - Agile BG

[FIX] test/picking_line_description.yml

62. By Alex Comba - Agile BG

[ADD] test/picking_line_description.yml

61. By Alex Comba - Agile BG

[IMP] Added author and key test in the file manifest

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'picking_line_description'
2=== added file 'picking_line_description/__init__.py'
3--- picking_line_description/__init__.py 1970-01-01 00:00:00 +0000
4+++ picking_line_description/__init__.py 2014-05-21 14:34:26 +0000
5@@ -0,0 +1,23 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# Author: Alex Comba <alex.comba@agilebg.com>
10+# Copyright (C) 2014 Agile Business Group sagl
11+# (<http://www.agilebg.com>)
12+#
13+# This program is free software: you can redistribute it and/or modify
14+# it under the terms of the GNU Affero General Public License as published
15+# by the Free Software Foundation, either version 3 of the License, or
16+# (at your option) any later version.
17+#
18+# This program is distributed in the hope that it will be useful,
19+# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+# GNU Affero General Public License for more details.
22+#
23+# You should have received a copy of the GNU Affero General Public License
24+# along with this program. If not, see <http://www.gnu.org/licenses/>.
25+#
26+##############################################################################
27+from . import res_config
28+from . import stock
29
30=== added file 'picking_line_description/__openerp__.py'
31--- picking_line_description/__openerp__.py 1970-01-01 00:00:00 +0000
32+++ picking_line_description/__openerp__.py 2014-05-21 14:34:26 +0000
33@@ -0,0 +1,49 @@
34+# -*- coding: utf-8 -*-
35+##############################################################################
36+#
37+# Author: Alex Comba <alex.comba@agilebg.com>
38+# Copyright (C) 2014 Agile Business Group sagl
39+# (<http://www.agilebg.com>)
40+#
41+# This program is free software: you can redistribute it and/or modify
42+# it under the terms of the GNU Affero General Public License as published
43+# by the Free Software Foundation, either version 3 of the License, or
44+# (at your option) any later version.
45+#
46+# This program is distributed in the hope that it will be useful,
47+# but WITHOUT ANY WARRANTY; without even the implied warranty of
48+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
49+# GNU Affero General Public License for more details.
50+#
51+# You should have received a copy of the GNU Affero General Public License
52+# along with this program. If not, see <http://www.gnu.org/licenses/>.
53+#
54+##############################################################################
55+{
56+ 'name': "Picking line description",
57+ 'version': '0.1',
58+ 'category': 'Warehouse Management',
59+ 'description': """
60+This module allows to use only the product description on the picking lines.
61+To do so, the user has to belong to
62+group_use_product_description_per_picking_line.
63+This is possible by selecting the related option in the following menu:
64+
65+Settings --> Configuration --> Warehouse --> Products
66+ """,
67+ 'author': 'Agile Business Group',
68+ 'website': 'http://www.agilebg.com',
69+ 'license': 'AGPL-3',
70+ 'depends': [
71+ 'stock',
72+ ],
73+ 'data': [
74+ 'security/stock_security.xml',
75+ 'res_config_view.xml',
76+ 'stock_view.xml',
77+ ],
78+ 'test': [
79+ 'test/picking_line_description.yml',
80+ ],
81+ 'installable': True
82+}
83
84=== added directory 'picking_line_description/i18n'
85=== added file 'picking_line_description/i18n/it.po'
86--- picking_line_description/i18n/it.po 1970-01-01 00:00:00 +0000
87+++ picking_line_description/i18n/it.po 2014-05-21 14:34:26 +0000
88@@ -0,0 +1,46 @@
89+# Translation of OpenERP Server.
90+# This file contains the translation of the following modules:
91+# * picking_line_description
92+#
93+msgid ""
94+msgstr ""
95+"Project-Id-Version: OpenERP Server 7.0\n"
96+"Report-Msgid-Bugs-To: \n"
97+"POT-Creation-Date: 2014-05-19 12:12+0000\n"
98+"PO-Revision-Date: 2014-05-19 14:17+0100\n"
99+"Last-Translator: Alex Comba <alex.comba@agilebg.com>\n"
100+"Language-Team: \n"
101+"MIME-Version: 1.0\n"
102+"Content-Type: text/plain; charset=UTF-8\n"
103+"Content-Transfer-Encoding: 8bit\n"
104+"Plural-Forms: \n"
105+"X-Generator: Poedit 1.5.4\n"
106+
107+#. module: picking_line_description
108+#: field:stock.config.settings,group_use_product_description_per_picking_line:0
109+msgid "Allow using only the product description on the picking lines"
110+msgstr ""
111+"Permette di usare solamente la descrizione del prodotto sulle righe del "
112+"picking"
113+
114+#. module: picking_line_description
115+#: help:stock.config.settings,group_use_product_description_per_picking_line:0
116+msgid "Allows you to use only product description on the picking lines."
117+msgstr ""
118+"Permette di usare solamente la descrizione del prodotto sulle righe del "
119+"picking."
120+
121+#. module: picking_line_description
122+#: model:ir.model,name:picking_line_description.model_stock_config_settings
123+msgid "stock.config.settings"
124+msgstr "stock.config.settings"
125+
126+#. module: picking_line_description
127+#: model:res.groups,name:picking_line_description.group_use_product_description_per_picking_line
128+msgid "Use only product description on picking lines"
129+msgstr "Usa solo la descrizione del prodotto sulle righe del picking"
130+
131+#. module: picking_line_description
132+#: model:ir.model,name:picking_line_description.model_stock_move
133+msgid "Stock Move"
134+msgstr "Movimento di magazzino"
135
136=== added file 'picking_line_description/i18n/picking_line_description.pot'
137--- picking_line_description/i18n/picking_line_description.pot 1970-01-01 00:00:00 +0000
138+++ picking_line_description/i18n/picking_line_description.pot 2014-05-21 14:34:26 +0000
139@@ -0,0 +1,42 @@
140+# Translation of OpenERP Server.
141+# This file contains the translation of the following modules:
142+# * picking_line_description
143+#
144+msgid ""
145+msgstr ""
146+"Project-Id-Version: OpenERP Server 7.0\n"
147+"Report-Msgid-Bugs-To: \n"
148+"POT-Creation-Date: 2014-05-19 12:11+0000\n"
149+"PO-Revision-Date: 2014-05-19 12:11+0000\n"
150+"Last-Translator: <>\n"
151+"Language-Team: \n"
152+"MIME-Version: 1.0\n"
153+"Content-Type: text/plain; charset=UTF-8\n"
154+"Content-Transfer-Encoding: \n"
155+"Plural-Forms: \n"
156+
157+#. module: picking_line_description
158+#: field:stock.config.settings,group_use_product_description_per_picking_line:0
159+msgid "Allow using only the product description on the picking lines"
160+msgstr ""
161+
162+#. module: picking_line_description
163+#: help:stock.config.settings,group_use_product_description_per_picking_line:0
164+msgid "Allows you to use only product description on the picking lines."
165+msgstr ""
166+
167+#. module: picking_line_description
168+#: model:ir.model,name:picking_line_description.model_stock_config_settings
169+msgid "stock.config.settings"
170+msgstr ""
171+
172+#. module: picking_line_description
173+#: model:res.groups,name:picking_line_description.group_use_product_description_per_picking_line
174+msgid "Use only product description on picking lines"
175+msgstr ""
176+
177+#. module: picking_line_description
178+#: model:ir.model,name:picking_line_description.model_stock_move
179+msgid "Stock Move"
180+msgstr ""
181+
182
183=== added file 'picking_line_description/res_config.py'
184--- picking_line_description/res_config.py 1970-01-01 00:00:00 +0000
185+++ picking_line_description/res_config.py 2014-05-21 14:34:26 +0000
186@@ -0,0 +1,37 @@
187+# -*- coding: utf-8 -*-
188+##############################################################################
189+#
190+# Author: Alex Comba <alex.comba@agilebg.com>
191+# Copyright (C) 2014 Agile Business Group sagl
192+# (<http://www.agilebg.com>)
193+#
194+# This program is free software: you can redistribute it and/or modify
195+# it under the terms of the GNU Affero General Public License as published
196+# by the Free Software Foundation, either version 3 of the License, or
197+# (at your option) any later version.
198+#
199+# This program is distributed in the hope that it will be useful,
200+# but WITHOUT ANY WARRANTY; without even the implied warranty of
201+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
202+# GNU Affero General Public License for more details.
203+#
204+# You should have received a copy of the GNU Affero General Public License
205+# along with this program. If not, see <http://www.gnu.org/licenses/>.
206+#
207+##############################################################################
208+
209+from openerp.osv import fields, osv
210+
211+
212+class stock_config_settings(osv.TransientModel):
213+ _inherit = 'stock.config.settings'
214+
215+ _columns = {
216+ 'group_use_product_description_per_picking_line': fields.boolean(
217+ "Allow using only the product description on the picking lines",
218+ implied_group="picking_line_description."
219+ "group_use_product_description_per_picking_line",
220+ help="Allows you to use only product description on the "
221+ "picking lines."
222+ ),
223+ }
224
225=== added file 'picking_line_description/res_config_view.xml'
226--- picking_line_description/res_config_view.xml 1970-01-01 00:00:00 +0000
227+++ picking_line_description/res_config_view.xml 2014-05-21 14:34:26 +0000
228@@ -0,0 +1,20 @@
229+<?xml version="1.0" encoding="utf-8"?>
230+<openerp>
231+ <data>
232+
233+ <record id="view_stock_config_settings" model="ir.ui.view">
234+ <field name="name">stock settings</field>
235+ <field name="model">stock.config.settings</field>
236+ <field name="inherit_id" ref="stock.view_stock_config_settings"/>
237+ <field name="arch" type="xml">
238+ <xpath expr="//label[@for='group_uos']" position="after">
239+ <div>
240+ <field name="group_use_product_description_per_picking_line" class="oe_inline"/>
241+ <label for="group_use_product_description_per_picking_line"/>
242+ </div>
243+ </xpath>
244+ </field>
245+ </record>
246+
247+ </data>
248+</openerp>
249\ No newline at end of file
250
251=== added directory 'picking_line_description/security'
252=== added file 'picking_line_description/security/stock_security.xml'
253--- picking_line_description/security/stock_security.xml 1970-01-01 00:00:00 +0000
254+++ picking_line_description/security/stock_security.xml 2014-05-21 14:34:26 +0000
255@@ -0,0 +1,13 @@
256+<?xml version="1.0" encoding="utf-8"?>
257+<openerp>
258+
259+ <data noupdate="0">
260+
261+ <record id="group_use_product_description_per_picking_line" model="res.groups">
262+ <field name="name">Use only product description on picking lines</field>
263+ <field name="category_id" ref="base.module_category_hidden"/>
264+ </record>
265+
266+ </data>
267+
268+</openerp>
269
270=== added file 'picking_line_description/stock.py'
271--- picking_line_description/stock.py 1970-01-01 00:00:00 +0000
272+++ picking_line_description/stock.py 2014-05-21 14:34:26 +0000
273@@ -0,0 +1,66 @@
274+# -*- coding: utf-8 -*-
275+##############################################################################
276+#
277+# Author: Alex Comba <alex.comba@agilebg.com>
278+# Copyright (C) 2014 Agile Business Group sagl
279+# (<http://www.agilebg.com>)
280+#
281+# This program is free software: you can redistribute it and/or modify
282+# it under the terms of the GNU Affero General Public License as published
283+# by the Free Software Foundation, either version 3 of the License, or
284+# (at your option) any later version.
285+#
286+# This program is distributed in the hope that it will be useful,
287+# but WITHOUT ANY WARRANTY; without even the implied warranty of
288+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
289+# GNU Affero General Public License for more details.
290+#
291+# You should have received a copy of the GNU Affero General Public License
292+# along with this program. If not, see <http://www.gnu.org/licenses/>.
293+#
294+##############################################################################
295+
296+from openerp.osv import orm, fields
297+
298+
299+class stock_move(orm.Model):
300+ _inherit = "stock.move"
301+
302+ _columns = {
303+ 'name': fields.text('Description'),
304+ }
305+
306+ def onchange_product_id(
307+ self, cr, uid, ids, prod_id=False, loc_id=False,
308+ loc_dest_id=False, partner_id=False
309+ ):
310+ res = super(stock_move, self).onchange_product_id(
311+ cr, uid, ids, prod_id=prod_id, loc_id=loc_id,
312+ loc_dest_id=loc_dest_id, partner_id=partner_id
313+ )
314+ if prod_id:
315+ user = self.pool.get('res.users').browse(cr, uid, uid)
316+ lang = user and user.lang or False
317+ if partner_id:
318+ addr_rec = self.pool.get('res.partner').browse(
319+ cr, uid, partner_id)
320+ if addr_rec:
321+ lang = addr_rec and addr_rec.lang or False
322+ ctx = {'lang': lang}
323+ user_groups = [g.id for g in user.groups_id]
324+ ref = self.pool.get('ir.model.data').get_object_reference(
325+ cr, uid, 'picking_line_description',
326+ 'group_use_product_description_per_picking_line'
327+ )
328+ if ref and len(ref) > 1 and ref[1]:
329+ group_id = ref[1]
330+ if group_id in user_groups:
331+ product_obj = self.pool.get('product.product')
332+ product = product_obj.browse(cr, uid, prod_id, context=ctx)
333+ if (
334+ product
335+ and product.description
336+ and 'value' in res
337+ ):
338+ res['value']['name'] = product.description
339+ return res
340
341=== added file 'picking_line_description/stock_view.xml'
342--- picking_line_description/stock_view.xml 1970-01-01 00:00:00 +0000
343+++ picking_line_description/stock_view.xml 2014-05-21 14:34:26 +0000
344@@ -0,0 +1,29 @@
345+<?xml version="1.0" encoding="utf-8"?>
346+<openerp>
347+ <data>
348+
349+ <record id="view_move_picking_tree" model="ir.ui.view">
350+ <field name="name">stock.move.tree</field>
351+ <field name="model">stock.move</field>
352+ <field name="inherit_id" ref="stock.view_move_picking_tree" />
353+ <field name="arch" type="xml">
354+ <xpath expr="//field[@name='product_id']" position="after">
355+ <field name="name"/>
356+ </xpath>
357+ </field>
358+ </record>
359+
360+ <record id="view_move_picking_form" model="ir.ui.view">
361+ <field name="name">stock.move.form</field>
362+ <field name="model">stock.move</field>
363+ <field name="inherit_id" ref="stock.view_move_picking_form" />
364+ <field name="arch" type="xml">
365+ <xpath expr="//field[@name='name']" position="replace"/>
366+ <xpath expr="//field[@name='product_id']" position="after">
367+ <field name="name"/>
368+ </xpath>
369+ </field>
370+ </record>
371+
372+ </data>
373+</openerp>
374
375=== added directory 'picking_line_description/test'
376=== added file 'picking_line_description/test/picking_line_description.yml'
377--- picking_line_description/test/picking_line_description.yml 1970-01-01 00:00:00 +0000
378+++ picking_line_description/test/picking_line_description.yml 2014-05-21 14:34:26 +0000
379@@ -0,0 +1,26 @@
380+-
381+ In order to test picking_line_description,
382+ I assign group_use_product_description_per_picking_line group to the admin user
383+-
384+ !record {model: res.users, id: base.user_root}:
385+ groups_id:
386+ - picking_line_description.group_use_product_description_per_picking_line
387+-
388+ I set the description field on the product 'USB Adapter'
389+-
390+ !record {model: product.product, id: product.product_product_48}:
391+ description: 'Wi-Fi Adapter'
392+-
393+ Now i create an outgoing picking order that uses my product
394+-
395+ !record {model: stock.picking, id: stock_picking_out0}:
396+ partner_id: base.res_partner_2
397+ move_lines:
398+ - product_id: product.product_product_48
399+ product_qty: 10
400+-
401+ I verify that the onchange of product on move line was correctly triggered
402+-
403+ !assert {model: stock.picking, id: stock_picking_out0, string: The onchange function of product was not correctly triggered}:
404+ - move_lines[0].name == move_lines[0].product_id.description
405+ - move_lines[0].name == u'Wi-Fi Adapter'

Subscribers

People subscribed via source and target branches