Commit 7832ca19 authored by Luca Cristaldi's avatar Luca Cristaldi

first implementation draft

parent 39cdaf59
from trytond.pool import Pool
from . import subscription
__all__ = ['register']
def register():
Pool.register(
subscription.Subscription,
module='subscription_include', type_='model')
Pool.register(
module='subscription_include', type_='wizard')
......
from trytond.model import ModelView, fields
from trytond.pool import PoolMeta
from trytond.pyson import Eval
__all__ = ['Subscription']
class Subscription(metaclass=PoolMeta):
"Subscription"
__name__ = 'sale.subscription'
include = fields.Boolean("Include", states={'readonly': Eval('state') != 'draft'})
def compute_next_invoice_date(self):
date = super(Subscription, self).compute_next_invoice_date()
if(self.include and not self.next_invoice_date):
return self.invoice_start_date or self.start_date
else:
return date
\ No newline at end of file
<?xml version="1.0"?>
<tryton>
<data>
<record model="ir.ui.view" id="subscription_view_form">
<field name="model">sale.subscription</field>
<field name="inherit" ref="sale_subscription.subscription_view_form"/>
<field name="name">subscription_form</field>
</record>
</data>
</tryton>
\ No newline at end of file
[tryton]
version=4.8
version=4.8.0
depends:
account
account_invoice
company
currency
ir
product
res
sale
sale_subscription
xml:
subscription.xml
<?xml version="1.0"?>
<data>
<xpath expr="/form/notebook/page[@id='subscription']/field[@name='start_date']" position="after">
<label name="include"/>
<field name="include" xexpand="0" width="25"/>
</xpath>
</data>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment