Alex Comba - Agile BG has proposed merging 
lp:~agilebg/stock-logistic-flows/adding_picking_line_description_7 into 
lp:stock-logistic-flows.

Commit message:
[ADD] module picking_line_description

Requested reviews:
  Stock and Logistic Core Editors (stock-logistic-core-editors)

For more details, see:
https://code.launchpad.net/~agilebg/stock-logistic-flows/adding_picking_line_description_7/+merge/219800

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
-- 
https://code.launchpad.net/~agilebg/stock-logistic-flows/adding_picking_line_description_7/+merge/219800
Your team Stock and Logistic Core Editors is requested to review the proposed 
merge of lp:~agilebg/stock-logistic-flows/adding_picking_line_description_7 
into lp:stock-logistic-flows.
=== 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-16 09:05:37 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Alex Comba <alex.co...@agilebg.com>
+#    Copyright (C) 2014 Agile Business Group sagl
+#    (<http://www.agilebg.com>)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published
+#    by the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from . import res_config
+from . import stock

=== 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-16 09:05:37 +0000
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Alex Comba <alex.co...@agilebg.com>
+#    Copyright (C) 2014 Agile Business Group sagl
+#    (<http://www.agilebg.com>)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published
+#    by the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+{
+    'name': "Picking line description",
+    'version': '0.1',
+    'category': 'Warehouse Management',
+    'description': """
+This module 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
+    """,
+    'author': 'Agile Business Group',
+    'website': 'http://www.agilebg.com',
+    'license': 'AGPL-3',
+    'depends': [
+        'stock',
+    ],
+    'data': [
+        'security/stock_security.xml',
+        'res_config_view.xml',
+        'stock_view.xml',
+    ],
+    'test': [
+        'test/picking_line_description.yml',
+    ],
+    'installable': True
+}

=== 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-16 09:05:37 +0000
@@ -0,0 +1,42 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# 	* picking_line_description
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-05-13 16:07+0000\n"
+"PO-Revision-Date: 2014-05-13 18:09+0100\n"
+"Last-Translator: Alex Comba <alex.co...@agilebg.com>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+"X-Generator: Poedit 1.5.4\n"
+
+#. module: picking_line_description
+#: help:stock.config.settings,group_use_product_description_per_picking_line:0
+msgid "Allows you to use only product description on the picking order lines."
+msgstr "Allows you to use only product description on the picking order lines."
+
+#. module: picking_line_description
+#: model:res.groups,name:picking_line_description.group_use_product_description_per_picking_line
+msgid "Use only product description on picking lines"
+msgstr "Usa solo la descrizione del prodotto sulle righe del picking"
+
+#. module: picking_line_description
+#: model:ir.model,name:picking_line_description.model_stock_config_settings
+msgid "stock.config.settings"
+msgstr "stock.config.settings"
+
+#. module: picking_line_description
+#: field:stock.config.settings,group_use_product_description_per_picking_line:0
+msgid "Allow using only the product description on the picking order lines"
+msgstr "Usa solo la descrizione del prodotto sulle righe del picking"
+
+#. module: picking_line_description
+#: model:ir.model,name:picking_line_description.model_stock_move
+msgid "Stock Move"
+msgstr "Movimento di magazzino"

=== 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-16 09:05:37 +0000
@@ -0,0 +1,42 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* picking_line_description
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-05-13 16:12+0000\n"
+"PO-Revision-Date: 2014-05-13 16:12+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: picking_line_description
+#: help:stock.config.settings,group_use_product_description_per_picking_line:0
+msgid "Allows you to use only product description on the picking order lines."
+msgstr ""
+
+#. module: picking_line_description
+#: model:res.groups,name:picking_line_description.group_use_product_description_per_picking_line
+msgid "Use only product description on picking lines"
+msgstr ""
+
+#. module: picking_line_description
+#: model:ir.model,name:picking_line_description.model_stock_config_settings
+msgid "stock.config.settings"
+msgstr ""
+
+#. module: picking_line_description
+#: field:stock.config.settings,group_use_product_description_per_picking_line:0
+msgid "Allow using only the product description on the picking order lines"
+msgstr ""
+
+#. module: picking_line_description
+#: model:ir.model,name:picking_line_description.model_stock_move
+msgid "Stock Move"
+msgstr ""
+

=== 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-16 09:05:37 +0000
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Alex Comba <alex.co...@agilebg.com>
+#    Copyright (C) 2014 Agile Business Group sagl
+#    (<http://www.agilebg.com>)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published
+#    by the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp.osv import fields, osv
+
+
+class account_config_settings(osv.TransientModel):
+    _inherit = 'stock.config.settings'
+
+    _columns = {
+        'group_use_product_description_per_picking_line': fields.boolean(
+            "Allow using only the product description on the "
+            "picking order lines",
+            implied_group="picking_line_description."
+            "group_use_product_description_per_picking_line",
+            help="Allows you to use only product description on the "
+            "picking order lines."
+        ),
+    }

=== 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-16 09:05:37 +0000
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="view_stock_config_settings" model="ir.ui.view">
+            <field name="name">stock settings</field>
+            <field name="model">stock.config.settings</field>
+            <field name="inherit_id" ref="stock.view_stock_config_settings"/>
+            <field name="arch" type="xml">
+                <xpath expr="//label[@for='group_uos']" position="after">
+                    <div>
+                        <field name="group_use_product_description_per_picking_line" class="oe_inline"/>
+                        <label for="group_use_product_description_per_picking_line"/>
+                    </div>
+                </xpath>
+            </field>
+        </record>
+
+    </data>
+</openerp>
\ No newline at end of file

=== 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-16 09:05:37 +0000
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+
+    <data noupdate="0">
+
+        <record id="group_use_product_description_per_picking_line" model="res.groups">
+            <field name="name">Use only product description on picking lines</field>
+            <field name="category_id" ref="base.module_category_hidden"/>
+        </record>
+
+    </data>
+
+</openerp>

=== 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-16 09:05:37 +0000
@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Alex Comba <alex.co...@agilebg.com>
+#    Copyright (C) 2014 Agile Business Group sagl
+#    (<http://www.agilebg.com>)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as published
+#    by the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp.osv import orm, fields
+
+
+class stock_move(orm.Model):
+    _inherit = "stock.move"
+
+    _columns = {
+        'name': fields.text('Description'),
+    }
+
+    def onchange_product_id(
+            self, cr, uid, ids, prod_id=False, loc_id=False,
+            loc_dest_id=False, partner_id=False
+    ):
+        res = super(stock_move, self).onchange_product_id(
+            cr, uid, ids,  prod_id=prod_id, loc_id=loc_id,
+            loc_dest_id=loc_dest_id, partner_id=partner_id
+        )
+        if prod_id:
+            user = self.pool.get('res.users').browse(cr, uid, uid)
+            user_groups = [g.id for g in user.groups_id]
+            ref = self.pool.get('ir.model.data').get_object_reference(
+                cr, uid, 'picking_line_description',
+                'group_use_product_description_per_picking_line'
+            )
+            if ref and len(ref) > 1 and ref[1]:
+                group_id = ref[1]
+                if group_id in user_groups:
+                    product_obj = self.pool.get('product.product')
+                    product = product_obj.browse(cr, uid, prod_id)
+                    if (
+                        product
+                        and product.description
+                        and 'value' in res
+                    ):
+                        res['value']['name'] = product.description
+        return res

=== 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-16 09:05:37 +0000
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="view_move_picking_tree" model="ir.ui.view">
+            <field name="name">stock.move.tree</field>
+            <field name="model">stock.move</field>
+            <field name="inherit_id" ref="stock.view_move_picking_tree" />
+            <field name="arch" type="xml">
+                <xpath expr="//field[@name='product_id']" position="after">
+                      <field name="name"/>
+                </xpath>
+            </field>
+        </record>
+
+    </data>
+</openerp>
\ No newline at end of file

=== 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-16 09:05:37 +0000
@@ -0,0 +1,26 @@
+-
+    In order to test picking_line_description,
+    I assign group_use_product_description_per_picking_line group to the admin user
+-
+    !record {model: res.users, id: base.user_root}:
+        groups_id:
+        - picking_line_description.group_use_product_description_per_picking_line
+-
+    I set the description field on the product 'USB Adapter'
+-
+    !record {model: product.product, id: product.product_product_48}:
+        description: 'Wi-Fi Adapter'
+-
+    Now i create an outgoing picking order that uses my product
+-
+    !record {model: stock.picking, id: stock_picking_out0}:
+        partner_id: base.res_partner_2
+        move_lines:
+            - product_id: product.product_product_48
+              product_qty: 10
+-
+    I verify that the onchange of product on move line was correctly triggered
+-
+    !assert {model: stock.picking, id: stock_picking_out0, string: The onchange function of product was not correctly triggered}:
+        - move_lines[0].name == move_lines[0].product_id.description
+        - move_lines[0].name == u'Wi-Fi Adapter'

-- 
Mailing list: https://launchpad.net/~openerp-community-reviewer
Post to     : openerp-community-reviewer@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-community-reviewer
More help   : https://help.launchpad.net/ListHelp

Reply via email to