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 c779cee460
commit 0a05656bde
3 changed files with 15 additions and 0 deletions
+1
View File
@@ -1,3 +1,4 @@
* Add employee on subscriptions for some states
* Use greatest end date of lines for closed date
* Add contact and invoice party on subscription
* Allow invoices to be created in advance
+9
View File
@@ -18,6 +18,8 @@ from trytond.transaction import Transaction
from trytond.wizard import Wizard, StateView, StateAction, StateTransition, \
Button
from trytond.modules.company.model import (
employee_field, set_employee, reset_employee)
from trytond.modules.product import price_digits
from .exceptions import InvoiceError
@@ -141,6 +143,10 @@ class Subscription(Workflow, ModelSQL, ModelView):
},
depends=['state'])
quoted_by = employee_field(
"Quoted By", states=['quotation', 'running', 'closed', 'canceled'])
run_by = employee_field(
"Run By", states=['running', 'closed', 'canceled'])
state = fields.Selection([
('draft', "Draft"),
('quotation', "Quotation"),
@@ -273,18 +279,21 @@ class Subscription(Workflow, ModelSQL, ModelView):
@classmethod
@ModelView.button
@Workflow.transition('draft')
@reset_employee('quoted_by', 'run_by')
def draft(cls, subscriptions):
pass
@classmethod
@ModelView.button
@Workflow.transition('quotation')
@set_employee('quoted_by')
def quote(cls, subscriptions):
cls.set_number(subscriptions)
@classmethod
@ModelView.button
@Workflow.transition('running')
@set_employee('run_by')
def run(cls, subscriptions):
pool = Pool()
Line = pool.get('sale.subscription.line')
+5
View File
@@ -40,6 +40,11 @@ this repository contains the full copyright notices and license terms. -->
<page string="Other Info" id="other">
<label name="company"/>
<field name="company"/>
<newline/>
<label name="quoted_by"/>
<field name="quoted_by"/>
<label name="run_by"/>
<field name="run_by"/>
</page>
</notebook>
<label name="state"/>