diff --git a/modules/production_work/CHANGELOG b/modules/production_work/CHANGELOG index cd7469e52f..56c1378102 100644 --- a/modules/production_work/CHANGELOG +++ b/modules/production_work/CHANGELOG @@ -1,3 +1,4 @@ +* Add employee on cycles for running and done states * Display cost of works Version 6.8.0 - 2023-05-01 diff --git a/modules/production_work/tests/scenario_production_work.rst b/modules/production_work/tests/scenario_production_work.rst index e0c7c9043a..f5f184fca1 100644 --- a/modules/production_work/tests/scenario_production_work.rst +++ b/modules/production_work/tests/scenario_production_work.rst @@ -7,7 +7,7 @@ Imports:: >>> import datetime as dt >>> from decimal import Decimal >>> from proteus import Model, Wizard - >>> from trytond.tests.tools import activate_modules + >>> from trytond.tests.tools import activate_modules, set_user >>> from trytond.modules.company.tests.tools import create_company, \ ... get_company @@ -17,6 +17,11 @@ Activate modules:: >>> config = activate_modules('production_work') + >>> Employee = Model.get('company.employee') + >>> Group = Model.get('res.group') + >>> Party = Model.get('party.party') + >>> User = Model.get('res.user') + Create company:: >>> _ = create_company() @@ -145,6 +150,24 @@ Create an Inventory:: >>> inventory.state 'done' +Create production user:: + + >>> production_user = User() + >>> production_user.name = "Production" + >>> production_user.login = 'production' + >>> production_user.groups.extend(Group.find([ + ... ('name', '=', 'Production'), + ... ])) + >>> employee_party = Party(name="Employee") + >>> employee_party.save() + >>> employee = Employee(party=employee_party) + >>> employee.save() + >>> production_user.employees.append(employee) + >>> production_user.employee = employee + >>> production_user.save() + + >>> set_user(production_user) + Make a production:: >>> Production = Model.get('production') @@ -197,17 +220,23 @@ Run works:: >>> cycle1.click('run') >>> cycle1.state 'running' + >>> cycle1.run_by == employee + True >>> work1.reload() >>> work1.state 'running' >>> cycle1.click('do') >>> cycle1.state 'done' + >>> cycle1.done_by == employee + True >>> work1.reload() >>> work1.state 'finished' >>> cycle2 = work2.cycles.new() >>> cycle2.click('cancel') + >>> cycle2.cancelled_by == employee + True >>> cycle2.state 'cancelled' >>> work2.reload() diff --git a/modules/production_work/view/work_cycle_form.xml b/modules/production_work/view/work_cycle_form.xml index 5a573aab82..a78505c91e 100644 --- a/modules/production_work/view/work_cycle_form.xml +++ b/modules/production_work/view/work_cycle_form.xml @@ -7,6 +7,10 @@ this repository contains the full copyright notices and license terms. -->