diff --git a/CHANGELOG b/CHANGELOG index cd684bd896..1d29c5d13b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/purchase.py b/purchase.py index b514548e8c..71590c377c 100644 --- a/purchase.py +++ b/purchase.py @@ -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): diff --git a/view/purchase_line_tree.xml b/view/purchase_line_tree.xml index 2096601a2b..4b1f972dbe 100644 --- a/view/purchase_line_tree.xml +++ b/view/purchase_line_tree.xml @@ -6,6 +6,7 @@ this repository contains the full copyright notices and license terms. --> + diff --git a/view/purchase_line_tree_sequence.xml b/view/purchase_line_tree_sequence.xml index 3d57099e2f..3c45e844ba 100644 --- a/view/purchase_line_tree_sequence.xml +++ b/view/purchase_line_tree_sequence.xml @@ -6,6 +6,7 @@ this repository contains the full copyright notices and license terms. --> +