changeset 95333fc2a683 in modules/account_invoice:default
details:
https://hg.tryton.org/modules/account_invoice?cmd=changeset;node=95333fc2a683
description:
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
diffstat:
CHANGELOG | 1 +
invoice.py | 7 ++++++-
view/invoice_line_tree.xml | 1 +
view/invoice_line_tree_sequence.xml | 1 +
4 files changed, 9 insertions(+), 1 deletions(-)
diffs (61 lines):
diff -r da277943635d -r 95333fc2a683 CHANGELOG
--- a/CHANGELOG Wed Dec 23 21:46:51 2020 +0100
+++ b/CHANGELOG Fri Dec 25 17:14:57 2020 +0100
@@ -1,3 +1,4 @@
+* Add summary to invoice line list
* Add default customer payment term configuration
Version 5.8.0 - 2020-11-02
diff -r da277943635d -r 95333fc2a683 invoice.py
--- a/invoice.py Wed Dec 23 21:46:51 2020 +0100
+++ b/invoice.py Fri Dec 25 17:14:57 2020 +0100
@@ -18,7 +18,7 @@
Button
from trytond import backend
from trytond.pyson import If, Eval, Bool
-from trytond.tools import reduce_ids, grouped_slice
+from trytond.tools import reduce_ids, grouped_slice, firstline
from trytond.transaction import Transaction
from trytond.pool import Pool
from trytond.rpc import RPC
@@ -1724,6 +1724,7 @@
depends=['type', 'currency_digits']), 'get_amount')
description = fields.Text('Description', size=None,
states=_states, depends=_depends)
+ summary = fields.Function(fields.Char('Summary'), 'on_change_with_summary')
note = fields.Text('Note')
taxes = fields.Many2Many('account.invoice.line-account.tax',
'line', 'tax', 'Taxes',
@@ -1892,6 +1893,10 @@
return party.lang.code
return Config.get_language()
+ @fields.depends('description')
+ def on_change_with_summary(self, name=None):
+ return firstline(self.description or '')
+
@fields.depends('unit')
def on_change_with_unit_digits(self, name=None):
if self.unit:
diff -r da277943635d -r 95333fc2a683 view/invoice_line_tree.xml
--- a/view/invoice_line_tree.xml Wed Dec 23 21:46:51 2020 +0100
+++ b/view/invoice_line_tree.xml Fri Dec 25 17:14:57 2020 +0100
@@ -5,6 +5,7 @@
<field name="invoice" expand="1"/>
<field name="type"/>
<field name="product" expand="1"/>
+ <field name="summary" expand="1"/>
<field name="account" expand="1"/>
<field name="quantity" symbol="unit"/>
<field name="unit_price" symbol="currency"/>
diff -r da277943635d -r 95333fc2a683 view/invoice_line_tree_sequence.xml
--- a/view/invoice_line_tree_sequence.xml Wed Dec 23 21:46:51 2020 +0100
+++ b/view/invoice_line_tree_sequence.xml Fri Dec 25 17:14:57 2020 +0100
@@ -5,6 +5,7 @@
<field name="invoice" expand="1"/>
<field name="type"/>
<field name="product" expand="1"/>
+ <field name="summary" expand="1"/>
<field name="account" expand="1"/>
<field name="quantity" symbol="unit"/>
<field name="unit_price" symbol="currency"/>