_do_create_subscription wizard 'create_subscription'
This commit is contained in:
parent
d453653bfc
commit
425c7e225a
38
sale.py
38
sale.py
@ -2,7 +2,8 @@ from trytond.pool import Pool, PoolMeta
|
|||||||
from trytond.model import ModelView, ModelSQL, fields
|
from trytond.model import ModelView, ModelSQL, fields
|
||||||
from trytond.pyson import Eval, Bool, If
|
from trytond.pyson import Eval, Bool, If
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
|
from trytond.exceptions import UserError
|
||||||
|
|
||||||
from trytond.wizard import (
|
from trytond.wizard import (
|
||||||
Button, StateAction, StateTransition, StateView, Wizard)
|
Button, StateAction, StateTransition, StateView, Wizard)
|
||||||
|
|
||||||
@ -17,7 +18,22 @@ class CreateSubscriptionStart(ModelView):
|
|||||||
required=True)
|
required=True)
|
||||||
invoice_start_date = fields.Date("Invoice Start Date",
|
invoice_start_date = fields.Date("Invoice Start Date",
|
||||||
help='Billing start date')
|
help='Billing start date')
|
||||||
|
service = fields.Many2One('sale.subscription.service', "Service")
|
||||||
|
quantity = fields.Float("Quantity", digits='unit')
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def default_start_date(cls):
|
||||||
|
pool = Pool()
|
||||||
|
Date = pool.get('ir.date')
|
||||||
|
return Date.today()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
@fields.depends(methods=['default_start_date'])
|
||||||
|
def default_invoice_start_date(self):
|
||||||
|
invoice_start_date = self.default_start_date()
|
||||||
|
|
||||||
|
return invoice_start_date
|
||||||
|
|
||||||
class CreateSubscription(Wizard):
|
class CreateSubscription(Wizard):
|
||||||
'Create Subscription'
|
'Create Subscription'
|
||||||
__name__ = 'sale.create.subscription'
|
__name__ = 'sale.create.subscription'
|
||||||
@ -25,9 +41,27 @@ class CreateSubscription(Wizard):
|
|||||||
start = StateView('sale.create.subscription.start',
|
start = StateView('sale.create.subscription.start',
|
||||||
'optical_equipment.create_subscription_view_form',[
|
'optical_equipment.create_subscription_view_form',[
|
||||||
Button('Cancel', 'end', 'tryton-cancel'),
|
Button('Cancel', 'end', 'tryton-cancel'),
|
||||||
Button('Create', 'create', 'tryton-ok', default=True),
|
Button('Create', 'create_subscription', 'tryton-ok', default=True),
|
||||||
])
|
])
|
||||||
|
create_subscription = StateAction('sale_subscription.act_subscription_form')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def _subscription_start(self):
|
||||||
|
return dict(
|
||||||
|
start_date = self.start.start_date,
|
||||||
|
end_date = self.start.end_date,
|
||||||
|
invoice_recurrence = self.start.invoice_recurrence,
|
||||||
|
invoice_start_date = self.start.invoice_start_date,
|
||||||
|
service = self.start.service,
|
||||||
|
quantity = self.start.quantity)
|
||||||
|
|
||||||
|
def do_create_subscription(self, action):
|
||||||
|
pool = Pool()
|
||||||
|
Subscription = pool.get('sale.subscription')
|
||||||
|
|
||||||
|
#subscription = subscription()
|
||||||
|
self._subscription_start
|
||||||
|
|
||||||
class SaleLine(metaclass=PoolMeta):
|
class SaleLine(metaclass=PoolMeta):
|
||||||
'SaleLine'
|
'SaleLine'
|
||||||
__name__ = 'sale.line'
|
__name__ = 'sale.line'
|
||||||
|
@ -3,11 +3,12 @@
|
|||||||
this repository contains the full copyright notices and license terms. -->
|
this repository contains the full copyright notices and license terms. -->
|
||||||
<form col="2">
|
<form col="2">
|
||||||
<image name="tryton-warning" xexpand="0" xfill="0"/>
|
<image name="tryton-warning" xexpand="0" xfill="0"/>
|
||||||
<group col="2" id="create_subscription">
|
<group col="4" id="create_subscription">
|
||||||
<label
|
<label
|
||||||
string="Are you sure to create one subscription these/this sale(s)?"
|
string="Are you sure to create one subscription these/this sale(s)?"
|
||||||
id="create_subscription" colspan="2"
|
id="create_subscription" colspan="2"
|
||||||
yalign="0.0" xalign="0.0" xexpand="1"/>
|
yalign="0.0" xalign="0.0" xexpand="1"/>
|
||||||
|
<newline/>
|
||||||
<label name="start_date"/>
|
<label name="start_date"/>
|
||||||
<field name="start_date"/>
|
<field name="start_date"/>
|
||||||
<label name="end_date"/>
|
<label name="end_date"/>
|
||||||
@ -16,5 +17,9 @@ this repository contains the full copyright notices and license terms. -->
|
|||||||
<field name="invoice_recurrence"/>
|
<field name="invoice_recurrence"/>
|
||||||
<label name="invoice_start_date"/>
|
<label name="invoice_start_date"/>
|
||||||
<field name="invoice_start_date"/>
|
<field name="invoice_start_date"/>
|
||||||
|
<label name="service"/>
|
||||||
|
<field name="service"/>
|
||||||
|
<label name="quantity"/>
|
||||||
|
<field name="quantity"/>
|
||||||
</group>
|
</group>
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
Reference in New Issue
Block a user