Add summary to line list
A function field summary is added which takes the first line of description field. This is useful to identify line without product (only with description) in the list. issue9695 review292431002
This commit is contained in:
1 parent
f3f9bec499
commit
73df989c3a
4 files changed
+9
-1
No files matched your search
@@ -1,3 +1,4 @@
|
||||
* Add summary to sale line list
|
||||
* Add TaxableMixin to sale line
|
||||
|
||||
Version 5.8.0 - 2020-11-02
|
||||
|
||||
@@ -14,7 +14,7 @@ from trytond.wizard import Wizard, StateAction, StateView, StateTransition, \
|
||||
Button
|
||||
from trytond.pyson import If, Eval, Bool, PYSONEncoder
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.tools import sortable_values
|
||||
from trytond.tools import sortable_values, firstline
|
||||
from trytond.pool import Pool
|
||||
|
||||
from trytond.ir.attachment import AttachmentCopyMixin
|
||||
@@ -1119,6 +1119,7 @@ class SaleLine(TaxableMixin, sequence_ordered(), ModelSQL, ModelView):
|
||||
'readonly': Eval('sale_state') != 'draft',
|
||||
},
|
||||
depends=['sale_state'])
|
||||
summary = fields.Function(fields.Char('Summary'), 'on_change_with_summary')
|
||||
note = fields.Text('Note')
|
||||
taxes = fields.Many2Many('sale.line-account.tax', 'line', 'tax', 'Taxes',
|
||||
order=[('tax.sequence', 'ASC'), ('tax.id', 'ASC')],
|
||||
@@ -1334,6 +1335,10 @@ class SaleLine(TaxableMixin, sequence_ordered(), ModelSQL, ModelView):
|
||||
def on_change_taxes(self):
|
||||
self.on_change_quantity()
|
||||
|
||||
@fields.depends('description')
|
||||
def on_change_with_summary(self, name=None):
|
||||
return firstline(self.description or '')
|
||||
|
||||
@fields.depends('type', 'quantity', 'unit_price', 'unit', 'sale',
|
||||
'_parent_sale.currency')
|
||||
def on_change_with_amount(self):
|
||||
|
||||
@@ -5,6 +5,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="sale" expand="1"/>
|
||||
<field name="type"/>
|
||||
<field name="product" expand="1"/>
|
||||
<field name="summary" expand="1"/>
|
||||
<field name="quantity" symbol="unit"/>
|
||||
<field name="unit_price" symbol="currency"/>
|
||||
<field name="taxes"/>
|
||||
|
||||
@@ -5,6 +5,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="sale" expand="1"/>
|
||||
<field name="type"/>
|
||||
<field name="product" expand="1"/>
|
||||
<field name="summary" expand="1"/>
|
||||
<field name="quantity" symbol="unit"/>
|
||||
<field name="unit_price" symbol="currency"/>
|
||||
<field name="taxes"/>
|
||||
|
||||
Reference in new issue
Block a user