Add employee on complaint for some states
issue11771 review431731004
This commit is contained in:
1 parent
71cc9d9cc0
commit
9ba044ecdc
3 files changed
+45
-5
No files matched your search
@@ -1,3 +1,4 @@
|
||||
* Add employee on complaint for some states
|
||||
* Remove address on complaint
|
||||
|
||||
Version 6.4.0 - 2022-05-02
|
||||
|
||||
+29
-1
@@ -10,6 +10,8 @@ from trytond.i18n import gettext
|
||||
from trytond.model import (
|
||||
DeactivableMixin, ModelSQL, ModelView, Workflow, fields)
|
||||
from trytond.model.exceptions import AccessError
|
||||
from trytond.modules.company.model import (
|
||||
employee_field, reset_employee, set_employee)
|
||||
from trytond.modules.currency.fields import Monetary
|
||||
from trytond.modules.product import price_digits
|
||||
from trytond.pool import Pool
|
||||
@@ -50,7 +52,6 @@ class Complaint(Workflow, ModelSQL, ModelView):
|
||||
states={
|
||||
'readonly': _states['readonly'] | Eval('origin'),
|
||||
})
|
||||
employee = fields.Many2One('company.employee', 'Employee', states=_states)
|
||||
type = fields.Many2One('sale.complaint.type', 'Type', required=True,
|
||||
states=_states)
|
||||
origin = fields.Reference('Origin', selection='get_origin',
|
||||
@@ -105,6 +106,18 @@ class Complaint(Workflow, ModelSQL, ModelView):
|
||||
| (If(~Eval('origin_id', 0), 0, Eval('origin_id', 0)) <= 0)),
|
||||
},
|
||||
depends={'origin_model'})
|
||||
submitted_by = employee_field(
|
||||
"Submitted By",
|
||||
states=['waiting', 'approved', 'rejected', 'done', 'cancelled'])
|
||||
approved_by = employee_field(
|
||||
"Approved By",
|
||||
states=['approved', 'rejected', 'done', 'cancelled'])
|
||||
rejected_by = employee_field(
|
||||
"Rejected By",
|
||||
states=['approved', 'rejected', 'done', 'cancelled'])
|
||||
cancelled_by = employee_field(
|
||||
"Cancelled By",
|
||||
states=['cancelled'])
|
||||
state = fields.Selection([
|
||||
('draft', 'Draft'),
|
||||
('waiting', 'Waiting'),
|
||||
@@ -177,6 +190,11 @@ class Complaint(Workflow, ModelSQL, ModelView):
|
||||
and not table_h.column_exist('number')):
|
||||
table_h.column_rename('reference', 'number')
|
||||
|
||||
# Migration from 6.4: rename employee into submitted_by
|
||||
if (table_h.column_exist('employee')
|
||||
and not table_h.column_exist('submitted_by')):
|
||||
table_h.column_rename('employee', 'submitted_by')
|
||||
|
||||
super(Complaint, cls).__register__(module_name)
|
||||
|
||||
@classmethod
|
||||
@@ -271,6 +289,10 @@ class Complaint(Workflow, ModelSQL, ModelView):
|
||||
else:
|
||||
default = default.copy()
|
||||
default.setdefault('number', None)
|
||||
default.setdefault('submitted_by')
|
||||
default.setdefault('approved_by')
|
||||
default.setdefault('rejected_by')
|
||||
default.setdefault('cancelled_by')
|
||||
return super(Complaint, cls).copy(complaints, default=default)
|
||||
|
||||
@classmethod
|
||||
@@ -285,24 +307,29 @@ class Complaint(Workflow, ModelSQL, ModelView):
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('cancelled')
|
||||
@set_employee('cancelled_by')
|
||||
def cancel(cls, complaints):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('draft')
|
||||
@reset_employee(
|
||||
'submitted_by', 'approved_by', 'rejected_by', 'cancelled_by')
|
||||
def draft(cls, complaints):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('waiting')
|
||||
@set_employee('submitted_by')
|
||||
def wait(cls, complaints):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('approved')
|
||||
@set_employee('approved_by')
|
||||
def approve(cls, complaints):
|
||||
pool = Pool()
|
||||
Configuration = pool.get('sale.configuration')
|
||||
@@ -317,6 +344,7 @@ class Complaint(Workflow, ModelSQL, ModelView):
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('rejected')
|
||||
@set_employee('rejected_by')
|
||||
def reject(cls, complaints):
|
||||
pass
|
||||
|
||||
|
||||
+15
-4
@@ -13,10 +13,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="date"/>
|
||||
<notebook>
|
||||
<page string="Complaint" id="complaint">
|
||||
<label name="company"/>
|
||||
<field name="company"/>
|
||||
<label name="employee"/>
|
||||
<field name="employee"/>
|
||||
<label name="type"/>
|
||||
<field name="type" widget="selection"/>
|
||||
<label name="origin"/>
|
||||
@@ -26,6 +22,21 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="description" colspan="2"/>
|
||||
<field name="actions" colspan="2"/>
|
||||
</page>
|
||||
<page string="Other Info" id="other">
|
||||
<label name="company"/>
|
||||
<field name="company"/>
|
||||
<newline/>
|
||||
|
||||
<label name="submitted_by"/>
|
||||
<field name="submitted_by"/>
|
||||
<label name="cancelled_by"/>
|
||||
<field name="cancelled_by"/>
|
||||
|
||||
<label name="approved_by"/>
|
||||
<field name="approved_by"/>
|
||||
<label name="rejected_by"/>
|
||||
<field name="rejected_by"/>
|
||||
</page>
|
||||
</notebook>
|
||||
<label name="state"/>
|
||||
<field name="state"/>
|
||||
|
||||
Reference in new issue
Block a user