← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~agilebg/sale-wkfl/adding_sale_line_description_7 into lp:sale-wkfl

 

Alex Comba - Agile BG has proposed merging lp:~agilebg/sale-wkfl/adding_sale_line_description_7 into lp:sale-wkfl.

Commit message:
[ADD] module sale_line_description

Requested reviews:
  Sale Core Editors (sale-core-editors)

For more details, see:
https://code.launchpad.net/~agilebg/sale-wkfl/adding_sale_line_description_7/+merge/190600

This module allows to use only the product description on the sale order lines.
To do so, the user has to belong to group_use_product_description_per_so_line.
This is possible by selecting the related option in the following menu:

Settings --> Configuration --> Sale --> Sale Features
-- 
https://code.launchpad.net/~agilebg/sale-wkfl/adding_sale_line_description_7/+merge/190600
Your team Sale Core Editors is requested to review the proposed merge of lp:~agilebg/sale-wkfl/adding_sale_line_description_7 into lp:sale-wkfl.
=== added directory 'sale_line_description'
=== added file 'sale_line_description/__init__.py'
--- sale_line_description/__init__.py	1970-01-01 00:00:00 +0000
+++ sale_line_description/__init__.py	2013-10-11 10:42:09 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2013 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/>.
+#
+##############################################################################
+import res_config
+import sale

=== added file 'sale_line_description/__openerp__.py'
--- sale_line_description/__openerp__.py	1970-01-01 00:00:00 +0000
+++ sale_line_description/__openerp__.py	2013-10-11 10:42:09 +0000
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2013 Agile Business Group sagl
+#    (<http://www.agilebg.com>)
+#    @author Alex Comba <alex.comba@xxxxxxxxxxx>
+#
+#    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': "Sale line description",
+    'version': '0.1',
+    'category': 'Sales Management',
+    'description': """
+This module allows to use only the product description on the sale order lines.
+To do so, the user has to belong to group_use_product_description_per_so_line.
+This is possible by selecting the related option in the following menu:
+
+Settings --> Configuration --> Sale --> Sale Features
+    """,
+    'author': 'Agile Business Group',
+    'website': 'http://www.agilebg.com',
+    'license': 'AGPL-3',
+    "depends": [
+        'sale',
+    ],
+    "data": [
+        'security/sale_security.xml',
+        'res_config_view.xml',
+    ],
+    "active": False,
+    "installable": True
+}

=== added directory 'sale_line_description/i18n'
=== added file 'sale_line_description/i18n/it.po'
--- sale_line_description/i18n/it.po	1970-01-01 00:00:00 +0000
+++ sale_line_description/i18n/it.po	2013-10-11 10:42:09 +0000
@@ -0,0 +1,51 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# 	* sale_line_description
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-10-11 10:02+0000\n"
+"PO-Revision-Date: 2013-10-11 12:04+0100\n"
+"Last-Translator: Lorenzo Battistini <lorenzo.battistini@xxxxxxxxxxx>\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: sale_line_description
+#: model:ir.model,name:sale_line_description.model_sale_config_settings
+msgid "sale.config.settings"
+msgstr "sale.config.settings"
+
+#. module: sale_line_description
+#: model:res.groups,name:sale_line_description.group_use_product_description_per_so_line
+msgid "Use only product sale description on order lines"
+msgstr ""
+"Usa solo la descrizione del prodotto sulle righe dell'ordine di vendita"
+
+#. module: sale_line_description
+#: field:sale.config.settings,group_use_product_description_per_so_line:0
+msgid ""
+"Allow using only the product sale description\n"
+"            on the sales order lines"
+msgstr ""
+"Permette di usare solamente la descrizione di vendita del prodotto\n"
+"nelle righe dell'ordine di vendita"
+
+#. module: sale_line_description
+#: model:ir.model,name:sale_line_description.model_sale_order_line
+msgid "Sales Order Line"
+msgstr "Linea d'ordine di vendita"
+
+#. module: sale_line_description
+#: help:sale.config.settings,group_use_product_description_per_so_line:0
+msgid ""
+"Allows you to use only product sale description on the\n"
+"            sales order line."
+msgstr ""
+"Permette di usare solamente la descrizione di vendita del prodotto\n"
+"nelle righe dell'ordine di vendita"

=== added file 'sale_line_description/res_config.py'
--- sale_line_description/res_config.py	1970-01-01 00:00:00 +0000
+++ sale_line_description/res_config.py	2013-10-11 10:42:09 +0000
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2013 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 sale_configuration(osv.TransientModel):
+    _inherit = 'sale.config.settings'
+
+    _columns = {
+        'group_use_product_description_per_so_line': fields.boolean(
+            """Allow using only the product sale description
+            on the sales order lines""",
+            implied_group="sale_line_description."
+            "group_use_product_description_per_so_line",
+            help="""Allows you to use only product sale description on the
+            sales order line."""
+        ),
+    }

=== added file 'sale_line_description/res_config_view.xml'
--- sale_line_description/res_config_view.xml	1970-01-01 00:00:00 +0000
+++ sale_line_description/res_config_view.xml	2013-10-11 10:42:09 +0000
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="view_sales_config" model="ir.ui.view">
+            <field name="name">sale settings</field>
+            <field name="model">sale.config.settings</field>
+            <field name="inherit_id" ref="sale.view_sales_config"/>
+            <field name="arch" type="xml">
+                <xpath expr="//div[@name='module_sale_margin']" position="after">
+                    <div>
+                        <field name="group_use_product_description_per_so_line" class="oe_inline"/>
+                        <label for="group_use_product_description_per_so_line"/>
+                    </div>
+                </xpath>
+            </field>
+        </record>
+
+    </data>
+</openerp>
\ No newline at end of file

=== added file 'sale_line_description/sale.py'
--- sale_line_description/sale.py	1970-01-01 00:00:00 +0000
+++ sale_line_description/sale.py	2013-10-11 10:42:09 +0000
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2013 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
+
+
+class sale_order_line(orm.Model):
+    _inherit = "sale.order.line"
+
+    def product_id_change(
+        self, cr, uid, ids, pricelist, product_id, qty=0,
+        uom=False, qty_uos=0, uos=False, name='', partner_id=False,
+        lang=False, update_tax=True, date_order=False, packaging=False,
+        fiscal_position=False, flag=False, context=None
+    ):
+        res = super(sale_order_line, self).product_id_change(
+            cr, uid, ids, pricelist, product_id, qty=qty, uom=uom,
+            qty_uos=qty_uos, uos=uos, name='', partner_id=partner_id,
+            lang=lang, update_tax=update_tax, date_order=date_order,
+            packaging=packaging, fiscal_position=fiscal_position,
+            flag=flag, context=context
+        )
+        if product_id:
+            user = self.pool.get('res.users').browse(
+                cr, uid, uid, context=context)
+            user_groups = [g.id for g in user.groups_id]
+            ref = self.pool.get('ir.model.data').get_object_reference(
+                cr, uid, 'sale_line_description',
+                'group_use_product_description_per_so_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, product_id, context=context)
+                    if (
+                        product
+                        and product.description
+                        and res['value']
+                        and res['value'].get('name', False)
+                    ):
+                        res['value']['name'] = product.description
+        return res

=== added directory 'sale_line_description/security'
=== added file 'sale_line_description/security/sale_security.xml'
--- sale_line_description/security/sale_security.xml	1970-01-01 00:00:00 +0000
+++ sale_line_description/security/sale_security.xml	2013-10-11 10:42:09 +0000
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    
+    <data noupdate="0">
+
+        <record id="group_use_product_description_per_so_line" model="res.groups">
+            <field name="name">Use only product sale description on order lines</field>
+            <field name="category_id" ref="base.module_category_hidden"/>
+        </record>
+
+    </data>
+
+</openerp>


Follow ups