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 ed6d6e8dac
commit 7ca508bef1
4 changed files with 10 additions and 1 deletions
+2
View File
@@ -1,3 +1,5 @@
* Add summary to requisition line
Version 5.8.0 - 2020-11-02
* Bug fixes (see mercurial logs for details)
* Remove support for Python 3.5
+6 -1
View File
@@ -12,7 +12,7 @@ from trytond.model import Workflow, ModelView, fields, ModelSQL, \
from trytond.model.exceptions import RequiredValidationError, AccessError
from trytond.wizard import Wizard
from trytond.transaction import Transaction
from trytond.tools import grouped_slice
from trytond.tools import grouped_slice, firstline
from trytond.modules.company.model import (
employee_field, set_employee, reset_employee)
@@ -460,6 +460,7 @@ class PurchaseRequisitionLine(sequence_ordered(), ModelSQL, ModelView):
fields.Many2One('product.uom.category', "Product UOM Category"),
'on_change_with_product_uom_category')
description = fields.Text("Description", states=_states, depends=_depends)
summary = fields.Function(fields.Char('Summary'), 'on_change_with_summary')
quantity = fields.Float(
'Quantity', digits=(16, Eval('unit_digits', 2)), required=True,
states=_states, depends=['unit_digits'] + _depends)
@@ -535,6 +536,10 @@ class PurchaseRequisitionLine(sequence_ordered(), ModelSQL, ModelView):
self.unit = self.product.purchase_uom
self.unit_digits = self.product.purchase_uom.digits
@fields.depends('description')
def on_change_with_summary(self, name=None):
return firstline(self.description or '')
@fields.depends('quantity', 'unit_price', 'unit', 'requisition',
'_parent_requisition.currency')
def on_change_with_amount(self, name=None):
+1
View File
@@ -4,6 +4,7 @@ this repository contains the full copyright notices and license terms. -->
<tree>
<field name="requisition" expand="1"/>
<field name="product" expand="1"/>
<field name="summary" expand="1"/>
<field name="supplier" expand="1"/>
<field name="quantity" symbol="unit"/>
<field name="unit_price" symbol="currency"/>
@@ -4,6 +4,7 @@ this repository contains the full copyright notices and license terms. -->
<tree sequence="sequence">
<field name="requisition" expand="1"/>
<field name="product" expand="1"/>
<field name="summary" expand="1"/>
<field name="supplier" expand="1"/>
<field name="quantity" symbol="unit"/>
<field name="unit_price" symbol="currency"/>