forked from OCA/sale-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MRG] [ADD] module sale_line_description
- Loading branch information
Showing
8 changed files
with
293 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# -*- coding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# Copyright (C) 2013 Agile Business Group sagl | ||
# (<http://www.agilebg.com>) | ||
# @author Alex Comba <[email protected]> | ||
# | ||
# 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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]>\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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# 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-14 15:56+0000\n" | ||
"PO-Revision-Date: 2013-10-14 15:56+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: sale_line_description | ||
#: model:ir.model,name:sale_line_description.model_sale_config_settings | ||
msgid "sale.config.settings" | ||
msgstr "" | ||
|
||
#. 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 "" | ||
|
||
#. 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 "" | ||
|
||
#. module: sale_line_description | ||
#: model:ir.model,name:sale_line_description.model_sale_order_line | ||
msgid "Sales Order Line" | ||
msgstr "" | ||
|
||
#. 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 "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.""" | ||
), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# -*- 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 'value' in res | ||
): | ||
res['value']['name'] = product.description | ||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |