[IMP] sale,purchase,website: Harmonize the product name/description in reports and views

- sale: Improvement in quotation/so line's description
Currently, quotation/so line's description shows product's name with description.
It should show only description of product if description is there else show name of the product in backend views.

- sale: show product with description in sale report
Due to change in description of quotation/SO line, sale report is affected. Fixed it.

- website_sale: show only description in cart lines
Due to previous commit, cart lines shown with product and it's description as a quotation/so line's name.
When we create order from frontend, quotation/so lines' name field takes product name and it's description.
It should only take description if description is there else product name. Fixed it.

- purchase: Improvement in RFQ/PO line's description
Currently, RFQ/PO line's description shows product's name with description.
It should show only description of product if description is there else show name of the product in backend views.

- purchase: show product with description in purchase report
Due to change in description of RFQ/PO line, purchase reports are affected. Fixed it.
This commit is contained in:
dut-odoo
2016-11-04 10:00:09 +01:00
committed by Yannick Tivisse
parent 69b641d6bc
commit cbc760acb8
9 changed files with 24 additions and 24 deletions
+1 -1
View File
@@ -85,7 +85,7 @@ class SaleOrder(models.Model):
# Create the sale order line
values = {
'order_id': self.id,
'name': carrier.name,
'name': carrier.description_sale or carrier.name,
'product_uom_qty': 1,
'product_uom': carrier.product_id.uom_id.id,
'product_id': carrier.product_id.id,
+1 -3
View File
@@ -701,9 +701,7 @@ class PurchaseOrderLine(models.Model):
'lang': self.partner_id.lang,
'partner_id': self.partner_id.id,
})
self.name = product_lang.display_name
if product_lang.description_purchase:
self.name += '\n' + product_lang.description_purchase
self.name = product_lang.description_purchase or product_lang.display_name
fpos = self.order_id.fiscal_position_id
if self.env.uid == SUPERUSER_ID:
@@ -58,7 +58,8 @@
<tbody>
<tr t-foreach="o.order_line" t-as="line">
<td>
<span t-field="line.name"/>
<span t-field="line.product_id"/><br/>
<span t-if="line.name != line.product_id.display_name" t-field="line.name"/>
</td>
<td>
<span t-esc="', '.join(map(lambda x: x.name, line.taxes_id))"/>
@@ -39,7 +39,8 @@
<tbody>
<tr t-foreach="o.order_line" t-as="order_line">
<td>
<span t-field="order_line.name"/>
<span t-field="order_line.product_id"/><br/>
<span t-if="order_line.name != order_line.product_id.display_name" t-field="order_line.name"/>
</td>
<td class="text-center">
<span t-field="order_line.date_planned"/>
+1 -4
View File
@@ -848,10 +848,7 @@ class SaleOrderLine(models.Model):
uom=self.product_uom.id
)
name = product.name_get()[0][1]
if product.description_sale:
name += '\n' + product.description_sale
vals['name'] = name
vals['name'] = product.description_sale or product.name
self._compute_tax_id()
+4 -1
View File
@@ -81,7 +81,10 @@
<!-- Lines associated -->
<t t-foreach="layout_category['lines']" t-as="l">
<tr>
<td><span t-field="l.name"/></td>
<td>
<span t-field="l.product_id"/><br/>
<span t-if="l.name != l.product_id.name" t-field="l.name"/>
</td>
<td class="text-right">
<span t-field="l.product_uom_qty"/>
<span t-field="l.product_uom" groups="product.group_uom"/>
@@ -41,7 +41,8 @@
<t t-foreach="layout_category['lines']" t-as="line">
<tr>
<td>
<span t-field="line.name"/>
<span t-field="line.product_id"/><br/>
<span t-if="line.name != line.product_id.name" t-field="line.name"/>
</td>
<td>
<div id="quote_qty">
+1 -4
View File
@@ -86,7 +86,7 @@ class SaleOrder(models.Model):
product_context.setdefault('lang', order.partner_id.lang)
product = self.env['product.product'].with_context(product_context).browse(product_id)
name = product.display_name
name = product.description_sale or product.display_name
# add untracked attributes in the name
untracked_attributes = []
@@ -98,9 +98,6 @@ class SaleOrder(models.Model):
if untracked_attributes:
name += '\n%s' % (', '.join(untracked_attributes))
if product.description_sale:
name += '\n%s' % (product.description_sale)
return name
@api.multi
+10 -8
View File
@@ -859,8 +859,8 @@
<strong t-esc="line.product_id.with_context(display_default_code=False).display_name" />
</a>
</div>
<div class="text-muted">
<t t-foreach="line.name.splitlines()[1:]" t-as="name_line">
<div t-if="line.name != line.product_id.name" t-attf-class="text-muted">
<t t-foreach="line.name.splitlines()" t-as="name_line">
<span><t t-esc="name_line"/></span><br/>
</t>
</div>
@@ -1314,8 +1314,8 @@
<div>
<strong t-field="line.product_id.with_context(display_default_code=False).display_name" />
</div>
<div class="text-muted">
<t t-foreach="line.name.splitlines()[1:]" t-as="name_line">
<div t-if="line.name != line.product_id.name" t-attf-class="text-muted">
<t t-foreach="line.name.splitlines()" t-as="name_line">
<span><t t-esc="name_line"/></span><br/>
</t>
</div>
@@ -1470,8 +1470,8 @@
<strong t-esc="line.product_id.with_context(display_default_code=False).display_name"/>
</a>
</div>
<div class="text-muted">
<t t-foreach="line.name.splitlines()[1:]" t-as="name_line">
<div t-if="line.name != line.product_id.name" t-attf-class="text-muted">
<t t-foreach="line.name.splitlines()" t-as="name_line">
<span><t t-esc="name_line"/></span><br/>
</t>
</div>
@@ -1756,10 +1756,12 @@
<template id="orders_followup_products_links" name="Orders Followup Products Links" inherit_id="website_portal_sale.orders_followup">
<xpath expr="//div[@id='product_name']/*" position="replace">
<a t-if="ol.product_id.website_published" t-att-href="ol.product_id.website_url">
<span t-esc="ol.name" />
<span t-field="ol.product_id"/>
<span t-if="ol.name != ol.product_id.name" t-esc="ol.name"/>
</a>
<t t-if="not ol.product_id.website_published">
<span t-esc="ol.name" />
<span t-field="ol.product_id"/>
<span t-if="ol.name != ol.product_id.name" t-esc="ol.name"/>
</t>
</xpath>
</template>