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:
Maxime Richez
2020-12-25 17:14:57 +01:00
parent 5c72361525
commit 992834e4bd
4 changed files with 9 additions and 0 deletions
+1
View File
@@ -1,3 +1,4 @@
* Add summary to purchase line list
* Set payment term and invoice method from last party's purchases
Version 5.8.0 - 2020-11-02
+6
View File
@@ -19,6 +19,7 @@ from trytond import backend
from trytond.pyson import Eval, Bool, If, PYSONEncoder
from trytond.transaction import Transaction
from trytond.pool import Pool
from trytond.tools import firstline
from trytond.ir.attachment import AttachmentCopyMixin
from trytond.ir.note import NoteCopyMixin
@@ -1095,6 +1096,7 @@ class Line(sequence_ordered(), ModelSQL, ModelView):
'readonly': Eval('purchase_state') != 'draft',
},
depends=['purchase_state'])
summary = fields.Function(fields.Char('Summary'), 'on_change_with_summary')
note = fields.Text('Note')
taxes = fields.Many2Many('purchase.line-account.tax',
'line', 'tax', 'Taxes',
@@ -1355,6 +1357,10 @@ class Line(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', 'purchase',
'_parent_purchase.currency')
def on_change_with_amount(self):
+1
View File
@@ -6,6 +6,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="type"/>
<field name="product" expand="1"/>
<field name="product_supplier" expand="1"/>
<field name="summary" expand="1"/>
<field name="quantity" symbol="unit"/>
<field name="unit_price" symbol="currency"/>
<field name="taxes"/>
+1
View File
@@ -6,6 +6,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="type"/>
<field name="product" expand="1"/>
<field name="product_supplier" expand="1"/>
<field name="summary" expand="1"/>
<field name="quantity" symbol="unit"/>
<field name="unit_price" symbol="currency"/>
<field name="taxes"/>