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
=== added directory 'picking_line_description'
=== added file 'picking_line_description/__init__.py'
--- picking_line_description/__init__.py 1970-01-01 00:00:00 +0000
+++ picking_line_description/__init__.py 2014-05-21 14:34:26 +0000
@@ -0,0 +1,23 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Author: Alex Comba <alex.comba@agilebg.com>
5# Copyright (C) 2014 Agile Business Group sagl
6# (<http://www.agilebg.com>)
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as published
10# by the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22from . import res_config
23from . import stock
024
=== added file 'picking_line_description/__openerp__.py'
--- picking_line_description/__openerp__.py 1970-01-01 00:00:00 +0000
+++ picking_line_description/__openerp__.py 2014-05-21 14:34:26 +0000
@@ -0,0 +1,49 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Author: Alex Comba <alex.comba@agilebg.com>
5# Copyright (C) 2014 Agile Business Group sagl
6# (<http://www.agilebg.com>)
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as published
10# by the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22{
23 'name': "Picking line description",
24 'version': '0.1',
25 'category': 'Warehouse Management',
26 'description': """
27This module allows to use only the product description on the picking lines.
28To do so, the user has to belong to
29group_use_product_description_per_picking_line.
30This is possible by selecting the related option in the following menu:
31
32Settings --> Configuration --> Warehouse --> Products
33 """,
34 'author': 'Agile Business Group',
35 'website': 'http://www.agilebg.com',
36 'license': 'AGPL-3',
37 'depends': [
38 'stock',
39 ],
40 'data': [
41 'security/stock_security.xml',
42 'res_config_view.xml',
43 'stock_view.xml',
44 ],
45 'test': [
46 'test/picking_line_description.yml',
47 ],
48 'installable': True
49}
050
=== added directory 'picking_line_description/i18n'
=== added file 'picking_line_description/i18n/it.po'
--- picking_line_description/i18n/it.po 1970-01-01 00:00:00 +0000
+++ picking_line_description/i18n/it.po 2014-05-21 14:34:26 +0000
@@ -0,0 +1,46 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * picking_line_description
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-05-19 12:12+0000\n"
10"PO-Revision-Date: 2014-05-19 14:17+0100\n"
11"Last-Translator: Alex Comba <alex.comba@agilebg.com>\n"
12"Language-Team: \n"
13"MIME-Version: 1.0\n"
14"Content-Type: text/plain; charset=UTF-8\n"
15"Content-Transfer-Encoding: 8bit\n"
16"Plural-Forms: \n"
17"X-Generator: Poedit 1.5.4\n"
18
19#. module: picking_line_description
20#: field:stock.config.settings,group_use_product_description_per_picking_line:0
21msgid "Allow using only the product description on the picking lines"
22msgstr ""
23"Permette di usare solamente la descrizione del prodotto sulle righe del "
24"picking"
25
26#. module: picking_line_description
27#: help:stock.config.settings,group_use_product_description_per_picking_line:0
28msgid "Allows you to use only product description on the picking lines."
29msgstr ""
30"Permette di usare solamente la descrizione del prodotto sulle righe del "
31"picking."
32
33#. module: picking_line_description
34#: model:ir.model,name:picking_line_description.model_stock_config_settings
35msgid "stock.config.settings"
36msgstr "stock.config.settings"
37
38#. module: picking_line_description
39#: model:res.groups,name:picking_line_description.group_use_product_description_per_picking_line
40msgid "Use only product description on picking lines"
41msgstr "Usa solo la descrizione del prodotto sulle righe del picking"
42
43#. module: picking_line_description
44#: model:ir.model,name:picking_line_description.model_stock_move
45msgid "Stock Move"
46msgstr "Movimento di magazzino"
047
=== added file 'picking_line_description/i18n/picking_line_description.pot'
--- picking_line_description/i18n/picking_line_description.pot 1970-01-01 00:00:00 +0000
+++ picking_line_description/i18n/picking_line_description.pot 2014-05-21 14:34:26 +0000
@@ -0,0 +1,42 @@
1# Translation of OpenERP Server.
2# This file contains the translation of the following modules:
3# * picking_line_description
4#
5msgid ""
6msgstr ""
7"Project-Id-Version: OpenERP Server 7.0\n"
8"Report-Msgid-Bugs-To: \n"
9"POT-Creation-Date: 2014-05-19 12:11+0000\n"
10"PO-Revision-Date: 2014-05-19 12:11+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: picking_line_description
19#: field:stock.config.settings,group_use_product_description_per_picking_line:0
20msgid "Allow using only the product description on the picking lines"
21msgstr ""
22
23#. module: picking_line_description
24#: help:stock.config.settings,group_use_product_description_per_picking_line:0
25msgid "Allows you to use only product description on the picking lines."
26msgstr ""
27
28#. module: picking_line_description
29#: model:ir.model,name:picking_line_description.model_stock_config_settings
30msgid "stock.config.settings"
31msgstr ""
32
33#. module: picking_line_description
34#: model:res.groups,name:picking_line_description.group_use_product_description_per_picking_line
35msgid "Use only product description on picking lines"
36msgstr ""
37
38#. module: picking_line_description
39#: model:ir.model,name:picking_line_description.model_stock_move
40msgid "Stock Move"
41msgstr ""
42
043
=== added file 'picking_line_description/res_config.py'
--- picking_line_description/res_config.py 1970-01-01 00:00:00 +0000
+++ picking_line_description/res_config.py 2014-05-21 14:34:26 +0000
@@ -0,0 +1,37 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Author: Alex Comba <alex.comba@agilebg.com>
5# Copyright (C) 2014 Agile Business Group sagl
6# (<http://www.agilebg.com>)
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as published
10# by the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.osv import fields, osv
24
25
26class stock_config_settings(osv.TransientModel):
27 _inherit = 'stock.config.settings'
28
29 _columns = {
30 'group_use_product_description_per_picking_line': fields.boolean(
31 "Allow using only the product description on the picking lines",
32 implied_group="picking_line_description."
33 "group_use_product_description_per_picking_line",
34 help="Allows you to use only product description on the "
35 "picking lines."
36 ),
37 }
038
=== added file 'picking_line_description/res_config_view.xml'
--- picking_line_description/res_config_view.xml 1970-01-01 00:00:00 +0000
+++ picking_line_description/res_config_view.xml 2014-05-21 14:34:26 +0000
@@ -0,0 +1,20 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record id="view_stock_config_settings" model="ir.ui.view">
6 <field name="name">stock settings</field>
7 <field name="model">stock.config.settings</field>
8 <field name="inherit_id" ref="stock.view_stock_config_settings"/>
9 <field name="arch" type="xml">
10 <xpath expr="//label[@for='group_uos']" position="after">
11 <div>
12 <field name="group_use_product_description_per_picking_line" class="oe_inline"/>
13 <label for="group_use_product_description_per_picking_line"/>
14 </div>
15 </xpath>
16 </field>
17 </record>
18
19 </data>
20</openerp>
0\ No newline at end of file21\ No newline at end of file
122
=== added directory 'picking_line_description/security'
=== added file 'picking_line_description/security/stock_security.xml'
--- picking_line_description/security/stock_security.xml 1970-01-01 00:00:00 +0000
+++ picking_line_description/security/stock_security.xml 2014-05-21 14:34:26 +0000
@@ -0,0 +1,13 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3
4 <data noupdate="0">
5
6 <record id="group_use_product_description_per_picking_line" model="res.groups">
7 <field name="name">Use only product description on picking lines</field>
8 <field name="category_id" ref="base.module_category_hidden"/>
9 </record>
10
11 </data>
12
13</openerp>
014
=== added file 'picking_line_description/stock.py'
--- picking_line_description/stock.py 1970-01-01 00:00:00 +0000
+++ picking_line_description/stock.py 2014-05-21 14:34:26 +0000
@@ -0,0 +1,66 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# Author: Alex Comba <alex.comba@agilebg.com>
5# Copyright (C) 2014 Agile Business Group sagl
6# (<http://www.agilebg.com>)
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Affero General Public License as published
10# by the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU Affero General Public License for more details.
17#
18# You should have received a copy of the GNU Affero General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23from openerp.osv import orm, fields
24
25
26class stock_move(orm.Model):
27 _inherit = "stock.move"
28
29 _columns = {
30 'name': fields.text('Description'),
31 }
32
33 def onchange_product_id(
34 self, cr, uid, ids, prod_id=False, loc_id=False,
35 loc_dest_id=False, partner_id=False
36 ):
37 res = super(stock_move, self).onchange_product_id(
38 cr, uid, ids, prod_id=prod_id, loc_id=loc_id,
39 loc_dest_id=loc_dest_id, partner_id=partner_id
40 )
41 if prod_id:
42 user = self.pool.get('res.users').browse(cr, uid, uid)
43 lang = user and user.lang or False
44 if partner_id:
45 addr_rec = self.pool.get('res.partner').browse(
46 cr, uid, partner_id)
47 if addr_rec:
48 lang = addr_rec and addr_rec.lang or False
49 ctx = {'lang': lang}
50 user_groups = [g.id for g in user.groups_id]
51 ref = self.pool.get('ir.model.data').get_object_reference(
52 cr, uid, 'picking_line_description',
53 'group_use_product_description_per_picking_line'
54 )
55 if ref and len(ref) > 1 and ref[1]:
56 group_id = ref[1]
57 if group_id in user_groups:
58 product_obj = self.pool.get('product.product')
59 product = product_obj.browse(cr, uid, prod_id, context=ctx)
60 if (
61 product
62 and product.description
63 and 'value' in res
64 ):
65 res['value']['name'] = product.description
66 return res
067
=== added file 'picking_line_description/stock_view.xml'
--- picking_line_description/stock_view.xml 1970-01-01 00:00:00 +0000
+++ picking_line_description/stock_view.xml 2014-05-21 14:34:26 +0000
@@ -0,0 +1,29 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record id="view_move_picking_tree" model="ir.ui.view">
6 <field name="name">stock.move.tree</field>
7 <field name="model">stock.move</field>
8 <field name="inherit_id" ref="stock.view_move_picking_tree" />
9 <field name="arch" type="xml">
10 <xpath expr="//field[@name='product_id']" position="after">
11 <field name="name"/>
12 </xpath>
13 </field>
14 </record>
15
16 <record id="view_move_picking_form" model="ir.ui.view">
17 <field name="name">stock.move.form</field>
18 <field name="model">stock.move</field>
19 <field name="inherit_id" ref="stock.view_move_picking_form" />
20 <field name="arch" type="xml">
21 <xpath expr="//field[@name='name']" position="replace"/>
22 <xpath expr="//field[@name='product_id']" position="after">
23 <field name="name"/>
24 </xpath>
25 </field>
26 </record>
27
28 </data>
29</openerp>
030
=== added directory 'picking_line_description/test'
=== added file 'picking_line_description/test/picking_line_description.yml'
--- picking_line_description/test/picking_line_description.yml 1970-01-01 00:00:00 +0000
+++ picking_line_description/test/picking_line_description.yml 2014-05-21 14:34:26 +0000
@@ -0,0 +1,26 @@
1-
2 In order to test picking_line_description,
3 I assign group_use_product_description_per_picking_line group to the admin user
4-
5 !record {model: res.users, id: base.user_root}:
6 groups_id:
7 - picking_line_description.group_use_product_description_per_picking_line
8-
9 I set the description field on the product 'USB Adapter'
10-
11 !record {model: product.product, id: product.product_product_48}:
12 description: 'Wi-Fi Adapter'
13-
14 Now i create an outgoing picking order that uses my product
15-
16 !record {model: stock.picking, id: stock_picking_out0}:
17 partner_id: base.res_partner_2
18 move_lines:
19 - product_id: product.product_product_48
20 product_qty: 10
21-
22 I verify that the onchange of product on move line was correctly triggered
23-
24 !assert {model: stock.picking, id: stock_picking_out0, string: The onchange function of product was not correctly triggered}:
25 - move_lines[0].name == move_lines[0].product_id.description
26 - move_lines[0].name == u'Wi-Fi Adapter'

Subscribers

People subscribed via source and target branches