changeset 007f5f7d9665 in modules/purchase_request:default
details:
https://hg.tryton.org/modules/purchase_request?cmd=changeset;node=007f5f7d9665
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 +
purchase_request.py | 7 ++++++-
view/purchase_request_tree.xml | 1 +
3 files changed, 8 insertions(+), 1 deletions(-)
diffs (50 lines):
diff -r ef09f81ad028 -r 007f5f7d9665 CHANGELOG
--- a/CHANGELOG Tue Dec 22 17:15:03 2020 +0100
+++ b/CHANGELOG Fri Dec 25 17:14:57 2020 +0100
@@ -1,3 +1,4 @@
+* Add summary to request line
* Add relate from request to purchase and from purchase to request
Version 5.8.0 - 2020-11-02
diff -r ef09f81ad028 -r 007f5f7d9665 purchase_request.py
--- a/purchase_request.py Tue Dec 22 17:15:03 2020 +0100
+++ b/purchase_request.py Fri Dec 25 17:14:57 2020 +0100
@@ -10,7 +10,7 @@
from trytond.model.exceptions import AccessError
from trytond.wizard import Wizard, StateView, StateTransition, Button
from trytond.pyson import If, In, Eval, Bool
-from trytond.tools import sortable_values
+from trytond.tools import sortable_values, firstline
from trytond.transaction import Transaction
from trytond.pool import Pool
@@ -32,6 +32,7 @@
select=True, readonly=True, domain=[('purchasable', '=', True)])
description = fields.Text('Description', readonly=True,
states=STATES, depends=DEPENDS)
+ summary = fields.Function(fields.Char('Summary'), 'on_change_with_summary')
party = fields.Many2One('party.party', 'Party', select=True, states=STATES,
depends=DEPENDS)
quantity = fields.Float('Quantity', required=True, states=STATES,
@@ -281,6 +282,10 @@
return self.product.default_uom.digits
return 2
+ @fields.depends('description')
+ def on_change_with_summary(self, name=None):
+ return firstline(self.description or '')
+
@classmethod
def _get_origin(cls):
'Return the set of Model names for origin Reference'
diff -r ef09f81ad028 -r 007f5f7d9665 view/purchase_request_tree.xml
--- a/view/purchase_request_tree.xml Tue Dec 22 17:15:03 2020 +0100
+++ b/view/purchase_request_tree.xml Fri Dec 25 17:14:57 2020 +0100
@@ -3,6 +3,7 @@
this repository contains the full copyright notices and license terms. -->
<tree>
<field name="product" expand="2"/>
+ <field name="summary" expand="1"/>
<field name="quantity" symbol="uom"/>
<field name="warehouse" expand="1"/>
<field name="party" expand="2"/>