-
-
Notifications
You must be signed in to change notification settings - Fork 993
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 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,57 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
=================================== | ||
Sale order line variant description | ||
=================================== | ||
|
||
This module allows to specify different sale description values for each product | ||
variant and use them on the sale order lines as their names. | ||
|
||
Usage | ||
===== | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/167/8.0 | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/OCA/sale-workflow/issues>`_. In case of trouble, please | ||
check there if your issue has already been reported. If you spotted it first, | ||
help us smashing it by providing a detailed and welcomed `feedback | ||
<https://github.com/OCA/ | ||
sale-workflow/issues/new?body=module:%20 | ||
sale_order_line_variant_description%0Aversion:%20 | ||
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Credits | ||
======= | ||
|
||
Images | ||
------ | ||
|
||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. | ||
|
||
Contributors | ||
------------ | ||
|
||
* Alex Comba <alex.comba@agilebg.com> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
To contribute to this module, please visit https://odoo-community.org. |
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,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2015 Alex Comba - Agile Business Group | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import models |
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,19 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2015 Alex Comba - Agile Business Group | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
{ | ||
'name': "Sale order line variant description", | ||
'version': '8.0.1.0.0', | ||
'category': 'Sales Management', | ||
'author': "Agile Business Group, Odoo Community Association (OCA)", | ||
'website': 'http://www.agilebg.com', | ||
'license': 'AGPL-3', | ||
"depends": [ | ||
'sale', | ||
], | ||
"data": [ | ||
'views/product_view.xml', | ||
], | ||
"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,45 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * sale_order_line_variant_description | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 8.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2015-12-22 14:17+0000\n" | ||
"PO-Revision-Date: 2015-12-22 15:19+0100\n" | ||
"Last-Translator: Alex Comba <alex.comba@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" | ||
"Language: it\n" | ||
"X-Generator: Poedit 1.8.4\n" | ||
|
||
#. module: sale_order_line_variant_description | ||
#: help:product.product,field_name:0 | ||
#: help:product.product,variant_description_sale:0 | ||
msgid "A description of the product variant that you want to communicate to your customers.This description will be copied to every Sale Order" | ||
msgstr "Una descrizione della variante prodotto da mostrare ai clienti. La descrizione sarà inserita in ogni Ordine di Vendita" | ||
|
||
#. module: sale_order_line_variant_description | ||
#: model:ir.model,name:sale_order_line_variant_description.model_product_product | ||
msgid "Product" | ||
msgstr "Prodotto" | ||
|
||
#. module: sale_order_line_variant_description | ||
#: model:ir.model,name:sale_order_line_variant_description.model_sale_order_line | ||
msgid "Sales Order Line" | ||
msgstr "Linea d'ordine di vendita" | ||
|
||
#. module: sale_order_line_variant_description | ||
#: field:product.product,field_name:0 | ||
#: field:product.product,variant_description_sale:0 | ||
msgid "Variant Sale Description" | ||
msgstr "Descrizione Vendita Variante" | ||
|
||
#. module: sale_order_line_variant_description | ||
#: view:product.product:sale_order_line_variant_description.product_normal_form_view | ||
msgid "Variant description for quotations" | ||
msgstr "Descrizione variante prodotto per preventivi" |
44 changes: 44 additions & 0 deletions
44
sale_order_line_variant_description/i18n/sale_order_line_variant_description.pot
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 Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * sale_order_line_variant_description | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 8.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2015-12-22 14:16+0000\n" | ||
"PO-Revision-Date: 2015-12-22 14:16+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_order_line_variant_description | ||
#: help:product.product,field_name:0 | ||
#: help:product.product,variant_description_sale:0 | ||
msgid "A description of the product variant that you want to communicate to your customers.This description will be copied to every Sale Order" | ||
msgstr "" | ||
|
||
#. module: sale_order_line_variant_description | ||
#: model:ir.model,name:sale_order_line_variant_description.model_product_product | ||
msgid "Product" | ||
msgstr "" | ||
|
||
#. module: sale_order_line_variant_description | ||
#: model:ir.model,name:sale_order_line_variant_description.model_sale_order_line | ||
msgid "Sales Order Line" | ||
msgstr "" | ||
|
||
#. module: sale_order_line_variant_description | ||
#: field:product.product,field_name:0 | ||
#: field:product.product,variant_description_sale:0 | ||
msgid "Variant Sale Description" | ||
msgstr "" | ||
|
||
#. module: sale_order_line_variant_description | ||
#: view:product.product:sale_order_line_variant_description.product_normal_form_view | ||
msgid "Variant description for quotations" | ||
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,6 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2015 Alex Comba - Agile Business Group | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import product_product | ||
from . import sale_order_line |
18 changes: 18 additions & 0 deletions
18
sale_order_line_variant_description/models/product_product.py
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,18 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2015 Alex Comba - Agile Business Group | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
|
||
from openerp import models, fields | ||
|
||
|
||
class ProductProduct(models.Model): | ||
_inherit = 'product.product' | ||
|
||
variant_description_sale = fields.Text( | ||
string='Variant Sale Description', | ||
help='A description of the product variant that you want to ' | ||
'communicate to your customers.' | ||
'This description will be copied to every Sale Order', | ||
translate=True, | ||
) |
32 changes: 32 additions & 0 deletions
32
sale_order_line_variant_description/models/sale_order_line.py
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,32 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2015 Alex Comba - Agile Business Group | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from openerp import models, api | ||
|
||
|
||
class SaleOrderLine(models.Model): | ||
_inherit = "sale.order.line" | ||
|
||
@api.multi | ||
def product_id_change( | ||
self, pricelist, product, 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 | ||
): | ||
res = super(SaleOrderLine, self).product_id_change( | ||
pricelist=pricelist, product=product, qty=qty, uom=uom, | ||
qty_uos=qty_uos, uos=uos, name=name, | ||
partner_id=partner_id, lang=lang, update_tax=update_tax, | ||
date_order=date_order, packaging=packaging, | ||
fiscal_position=fiscal_position, flag=flag) | ||
if product: | ||
product_obj = self.env['product.product'] | ||
lang = self.env['res.partner'].browse(partner_id).lang | ||
product = product_obj.with_context(lang=lang).browse(product) | ||
if product.variant_description_sale: | ||
if 'value' not in res: | ||
res['value'] = {} | ||
res['value']['name'] = product.variant_description_sale | ||
return res |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2015 Alex Comba - Agile Business Group | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import test_sale_order_line_variant_description |
41 changes: 41 additions & 0 deletions
41
sale_order_line_variant_description/tests/test_sale_order_line_variant_description.py
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,41 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2015 Alex Comba - Agile Business Group | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
import openerp.tests.common as common | ||
|
||
|
||
class TestSaleOrderLineVariantDescription(common.TransactionCase): | ||
|
||
def setUp(self): | ||
super(TestSaleOrderLineVariantDescription, self).setUp() | ||
self.fiscal_position_model = self.env['account.fiscal.position'] | ||
self.tax_model = self.env['account.tax'] | ||
self.pricelist_model = self.env['product.pricelist'] | ||
self.res_partner_model = self.env['res.partner'] | ||
self.product_tmpl_model = self.env['product.template'] | ||
self.product_model = self.env['product.product'] | ||
self.so_line_model = self.env['sale.order.line'] | ||
self.partner = self.env.ref('base.res_partner_1') | ||
|
||
def test_product_id_change(self): | ||
pricelist = self.pricelist_model.search( | ||
[('name', '=', 'Public Pricelist')])[0] | ||
tax_include = self.tax_model.create(dict(name="Include tax", | ||
type='percent', | ||
amount='0.21', | ||
price_include=True)) | ||
product_tmpl = self.product_tmpl_model.create( | ||
dict( | ||
name="Product template", list_price='121', | ||
taxes_id=[(6, 0, [tax_include.id])])) | ||
product = self.product_model.create( | ||
dict(product_tmpl_id=product_tmpl.id, | ||
variant_description_sale="Product variant description")) | ||
fp = self.fiscal_position_model.create(dict(name="fiscal position", | ||
sequence=1)) | ||
res = self.so_line_model.product_id_change( | ||
pricelist.id, product.id, partner_id=self.partner.id, | ||
fiscal_position=fp.id) | ||
self.assertEqual( | ||
product.variant_description_sale, res['value']['name']) |
21 changes: 21 additions & 0 deletions
21
sale_order_line_variant_description/views/product_view.xml
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,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- © 2015 Alex Comba - Agile Business Group | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). --> | ||
|
||
<openerp> | ||
<data> | ||
|
||
<record id="product_normal_form_view" model="ir.ui.view"> | ||
<field name="name">product.product.form</field> | ||
<field name="model">product.product</field> | ||
<field name="inherit_id" ref="product.product_normal_form_view"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='description_sale']" position="after"> | ||
<separator string="Variant description for quotations"/> | ||
<field name="variant_description_sale"/> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
</data> | ||
</openerp> |