Add employee on document for some states

issue8969
review276621002
This commit is contained in:
Cédric Krier
2020-04-10 18:53:44 +02:00
parent 5108a0e2e2
commit 5196ba7e26
3 changed files with 16 additions and 0 deletions
+1
View File
@@ -1,3 +1,4 @@
* Add employee on requisitions for some states
* Allow setting unit on line without product
* Add button to process requisition
+10
View File
@@ -14,6 +14,8 @@ from trytond.wizard import Wizard
from trytond.transaction import Transaction
from trytond.tools import grouped_slice
from trytond.modules.company.model import (
employee_field, set_employee, reset_employee)
from trytond.modules.product import price_digits
@@ -137,6 +139,11 @@ class PurchaseRequisition(Workflow, ModelSQL, ModelView):
lines = fields.One2Many(
'purchase.requisition.line', 'requisition', 'Lines',
states=_states, depends=_depends)
approved_by = employee_field(
"Approved By", states=['approved', 'processing', 'done', 'cancel'])
rejected_by = employee_field(
"Rejected By", states=['rejected', 'processing', 'done', 'cancel'])
state = fields.Selection([
('draft', "Draft"),
('waiting', "Waiting"),
@@ -349,6 +356,7 @@ class PurchaseRequisition(Workflow, ModelSQL, ModelView):
@classmethod
@ModelView.button
@Workflow.transition('draft')
@reset_employee('approved_by', 'rejected_by')
def draft(cls, requisitions):
pass
@@ -362,12 +370,14 @@ class PurchaseRequisition(Workflow, ModelSQL, ModelView):
@classmethod
@ModelView.button
@Workflow.transition('rejected')
@set_employee('rejected_by')
def reject(cls, requisitions):
pass
@classmethod
@ModelView.button
@Workflow.transition('approved')
@set_employee('approved_by')
def approve(cls, requisitions):
pool = Pool()
Configuration = pool.get('purchase.configuration')
+5
View File
@@ -28,6 +28,11 @@ this repository contains the full copyright notices and license terms. -->
<page string="Other Info" id="other_info">
<label name="company"/>
<field name="company"/>
<newline/>
<label name="approved_by"/>
<field name="approved_by"/>
<label name="rejected_by"/>
<field name="rejected_by"/>
</page>
</notebook>
<label name="state"/>