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 f65cb3b82d
commit 472891ecb9
3 changed files with 16 additions and 0 deletions
+1
View File
@@ -1,3 +1,4 @@
* Add employee on productions for some states
* Convert set_moves into dualmethod
* Add reference to production record name
* Add cron task to update production cost
+8
View File
@@ -10,6 +10,7 @@ from trytond.pyson import Eval, Bool, If, Id
from trytond.pool import Pool
from trytond.transaction import Transaction
from trytond.modules.company.model import employee_field, set_employee
from trytond.modules.product import price_digits
BOM_CHANGES = ['bom', 'product', 'quantity', 'uom', 'warehouse', 'location',
@@ -136,6 +137,10 @@ class Production(Workflow, ModelSQL, ModelView):
| ~Eval('warehouse') | ~Eval('location')),
},
depends=['warehouse', 'location', 'company'])
assigned_by = employee_field("Assigned By")
run_by = employee_field("Run By")
done_by = employee_field("Done By")
state = fields.Selection([
('request', 'Request'),
('draft', 'Draft'),
@@ -631,12 +636,14 @@ class Production(Workflow, ModelSQL, ModelView):
@classmethod
@Workflow.transition('assigned')
@set_employee('assigned_by')
def assign(cls, productions):
pass
@classmethod
@ModelView.button
@Workflow.transition('running')
@set_employee('run_by')
def run(cls, productions):
pool = Pool()
Move = pool.get('stock.move')
@@ -649,6 +656,7 @@ class Production(Workflow, ModelSQL, ModelView):
@classmethod
@ModelView.button
@Workflow.transition('done')
@set_employee('done_by')
def done(cls, productions):
pool = Pool()
Move = pool.get('stock.move')
+7
View File
@@ -37,6 +37,13 @@ this repository contains the full copyright notices and license terms. -->
<field name="effective_start_date"/>
<label name="cost"/>
<field name="cost"/>
<newline/>
<label name="assigned_by"/>
<field name="assigned_by"/>
<label name="run_by"/>
<field name="run_by"/>
<label name="done_by"/>
<field name="done_by"/>
</page>
</notebook>
<label name="state"/>