diff --git a/CHANGELOG b/CHANGELOG index 4cf0e29cd6..73893f1fd5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Add summary to sale line list * Add TaxableMixin to sale line Version 5.8.0 - 2020-11-02 diff --git a/sale.py b/sale.py index b775a8e507..d6a1d39645 100644 --- a/sale.py +++ b/sale.py @@ -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): diff --git a/view/sale_line_tree.xml b/view/sale_line_tree.xml index bc971c0001..876c1a6eab 100644 --- a/view/sale_line_tree.xml +++ b/view/sale_line_tree.xml @@ -5,6 +5,7 @@ this repository contains the full copyright notices and license terms. --> + diff --git a/view/sale_line_tree_sequence.xml b/view/sale_line_tree_sequence.xml index 08eef56d7e..5b6d135895 100644 --- a/view/sale_line_tree_sequence.xml +++ b/view/sale_line_tree_sequence.xml @@ -5,6 +5,7 @@ this repository contains the full copyright notices and license terms. --> +