Add description and note to opportunity line
This commit is contained in:
1 parent
f0050a6635
commit
4e3027c7a9
4 files changed
+31
-8
No files matched your search
@@ -1,3 +1,4 @@
|
||||
* Add description and note to opportunity line
|
||||
* Make product optional on opportunity line
|
||||
* Restrict convert button to sale group
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ from trytond.modules.company.model import employee_field, set_employee
|
||||
from trytond.modules.currency.fields import Monetary
|
||||
from trytond.pool import Pool
|
||||
from trytond.pyson import Bool, Eval, Get, If, In
|
||||
from trytond.tools import firstline
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
|
||||
@@ -569,6 +570,9 @@ class SaleOpportunityLine(sequence_ordered(), ModelSQL, ModelView):
|
||||
'required': Bool(Eval('product')),
|
||||
'readonly': _states['readonly'],
|
||||
})
|
||||
description = fields.Text("Description", states=_states)
|
||||
summary = fields.Function(fields.Char("Summary"), 'on_change_with_summary')
|
||||
note = fields.Text("Note")
|
||||
|
||||
del _states
|
||||
|
||||
@@ -609,6 +613,10 @@ class SaleOpportunityLine(sequence_ordered(), ModelSQL, ModelView):
|
||||
def on_change_with_product_uom_category(self, name=None):
|
||||
return self.product.default_uom_category if self.product else None
|
||||
|
||||
@fields.depends('description')
|
||||
def on_change_with_summary(self, name=None):
|
||||
return firstline(self.description or '')
|
||||
|
||||
def get_sale_line(self, sale):
|
||||
'''
|
||||
Return sale line for opportunity line
|
||||
@@ -618,7 +626,7 @@ class SaleOpportunityLine(sequence_ordered(), ModelSQL, ModelView):
|
||||
type='line',
|
||||
product=self.product,
|
||||
sale=sale,
|
||||
description=None,
|
||||
description=self.description,
|
||||
)
|
||||
sale_line.on_change_product()
|
||||
self._set_sale_line_quantity(sale_line)
|
||||
|
||||
@@ -3,13 +3,26 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form>
|
||||
<label name="opportunity"/>
|
||||
<field name="opportunity" colspan="3"/>
|
||||
<label name="product"/>
|
||||
<field name="product"/>
|
||||
<field name="opportunity"/>
|
||||
<label name="sequence"/>
|
||||
<field name="sequence"/>
|
||||
<label name="quantity"/>
|
||||
<field name="quantity"/>
|
||||
<label name="unit"/>
|
||||
<field name="unit"/>
|
||||
<notebook colspan="4">
|
||||
<page string="General" id="general">
|
||||
<label name="product"/>
|
||||
<field name="product"/>
|
||||
<newline/>
|
||||
|
||||
<label name="quantity"/>
|
||||
<field name="quantity"/>
|
||||
<label name="unit"/>
|
||||
<field name="unit"/>
|
||||
|
||||
<separator name="description" colspan="4"/>
|
||||
<field name="description" colspan="4"/>
|
||||
</page>
|
||||
<page string="Notes" id="notes">
|
||||
<separator name="note" colspan="4"/>
|
||||
<field name="note" colspan="4"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
@@ -4,5 +4,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<tree sequence="sequence">
|
||||
<field name="opportunity" expand="1"/>
|
||||
<field name="product" expand="1" optional="0"/>
|
||||
<field name="summary" expand="1" optional="1"/>
|
||||
<field name="quantity" symbol="unit"/>
|
||||
</tree>
|
||||
Reference in new issue
Block a user