add wizard for contract management and creation of model contracts maangement
This commit is contained in:
parent
0c88126ae8
commit
9b09080ae8
12
__init__.py
12
__init__.py
@ -11,9 +11,6 @@ def register():
|
||||
product.Product,
|
||||
purchase.Purchase,
|
||||
purchase.Line,
|
||||
sale.Sale,
|
||||
#sale.SaleLine,
|
||||
sale.CreateSubscriptionStart,
|
||||
equipment.OpticalEquipment,
|
||||
equipment.EquipmentMaintenance,
|
||||
configuration_equipment.Configuration,
|
||||
@ -22,10 +19,15 @@ def register():
|
||||
maintenance.MaintenanceLine,
|
||||
move.Move,
|
||||
move.ShipmentOut,
|
||||
subscription.Contract,
|
||||
subscription.Subscription,
|
||||
subscription.CreateInitialContract,
|
||||
subscription.CreateNextProrogue,
|
||||
subscription.ContractSupscription,
|
||||
subscription.SubscriptionEquipment,
|
||||
module='optical_equipment', type_='model')
|
||||
Pool.register(
|
||||
sale.CreateSubscription,
|
||||
subscription.CreateSubscriptionInvoice,
|
||||
subscription.CreateContract,
|
||||
subscription.CreateProrogue,
|
||||
subscription.CreateSubscriptionInvoice,
|
||||
module='optical_equipment', type_='wizard')
|
||||
|
15
contract_form1.xml
Normal file
15
contract_form1.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form col="6">
|
||||
<label name="party"/>
|
||||
<field name="party"/>
|
||||
<label name="contact"/>
|
||||
<field name="contact"/>
|
||||
<label name="number"/>
|
||||
<field name="number"/>
|
||||
<label name="description"/>
|
||||
<field name="description" colspan="3"/>
|
||||
<label name="reference"/>
|
||||
<field name="reference"/>
|
||||
</form>
|
8
contract_list1.xml
Normal file
8
contract_list1.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tree>
|
||||
<field name="number"/>
|
||||
<field name="party"/>
|
||||
<field name="reference"/>
|
||||
</tree>
|
25
create_prorogue_form.xml
Normal file
25
create_prorogue_form.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form>
|
||||
<group id="create_subscription">
|
||||
<label name="initial_contract" />
|
||||
<field name="initial_contract" colspan="3"/>
|
||||
<label name="party"/>
|
||||
<field name="party"/>
|
||||
<label name="contact"/>
|
||||
<field name="contact"/>
|
||||
<label name="invoice_recurrence"/>
|
||||
<field name="invoice_recurrence"/>
|
||||
<label name="start_date"/>
|
||||
<field name="start_date"/>
|
||||
<label name="end_date"/>
|
||||
<field name="end_date"/>
|
||||
<label name="invoice_start_date"/>
|
||||
<field name="invoice_start_date"/>
|
||||
<label name="unit_price"/>
|
||||
<field name="unit_price"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<field name="equipments"/>
|
||||
</form>
|
10
equipment.py
10
equipment.py
@ -269,14 +269,6 @@ class OpticalEquipment(DeactivableMixin, Workflow, ModelSQL, ModelView):
|
||||
self.health_register=None
|
||||
self.software_version=None
|
||||
|
||||
# @classmethod
|
||||
# @ModelView.button
|
||||
# @Workflow.transition('draft')
|
||||
# def draft(cls, equipments):
|
||||
# pass
|
||||
|
||||
|
||||
|
||||
@classmethod
|
||||
def delete(cls, equipments):
|
||||
for equipment in equipments:
|
||||
@ -298,8 +290,6 @@ class OpticalEquipment(DeactivableMixin, Workflow, ModelSQL, ModelView):
|
||||
else:
|
||||
cls.set_code(equipments)
|
||||
|
||||
|
||||
|
||||
class EquipmentMaintenance(ModelSQL, ModelView):
|
||||
'Optical Equipment - Equipment - Maintenance'
|
||||
__name__='optical_equipment.maintenance-optical_equipment.equipment'
|
||||
|
@ -125,10 +125,11 @@
|
||||
<field name="count" eval="True"/>
|
||||
<field name="act_window" ref="act_optical_equipment_form1"/>
|
||||
</record>
|
||||
<menuitem parent="menu_equipment"
|
||||
action="act_optical_equipment_form1"
|
||||
sequence="30"
|
||||
id="menu_optical_equipment_serial_form"/>
|
||||
<menuitem
|
||||
parent="menu_equipment"
|
||||
action="act_optical_equipment_form1"
|
||||
sequence="30"
|
||||
id="menu_optical_equipment_serial_form"/>
|
||||
|
||||
<record model="ir.ui.menu-res.group"
|
||||
id="menu_party_group_equipment_admin">
|
||||
|
@ -370,10 +370,6 @@ msgctxt "field:sale.line,equipment:"
|
||||
msgid "Equipment"
|
||||
msgstr "Equipo"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:sale_subscription.menu_subscription_form"
|
||||
msgid "Subscriptions"
|
||||
msgstr "Contratos"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:sale_subscription.menu_service_form"
|
||||
msgid "Subscription Services"
|
||||
msgstr "Servicios de Contrato"
|
||||
@ -382,6 +378,7 @@ msgctxt "model:ir.ui.menu,name:sale_subscription.menu_configuration"
|
||||
msgid "Subscription"
|
||||
msgstr "Contratos"
|
||||
|
||||
|
||||
msgctxt "field:sale.configuration,subscription_sequence:"
|
||||
msgid "Subscription Sequence"
|
||||
msgstr "Sequencia de contrato"
|
||||
|
7
sale.py
7
sale.py
@ -48,9 +48,9 @@ class Sale(metaclass=PoolMeta):
|
||||
queue_name='sale',
|
||||
queue_scheduled_at=config.sale_process_after):
|
||||
cls.__queue__.process(sales)
|
||||
"""
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class SaleLine(metaclass=PoolMeta):
|
||||
'SaleLine'
|
||||
__name__ = 'sale.line'
|
||||
@ -240,7 +240,7 @@ class SaleLine(metaclass=PoolMeta):
|
||||
'invisible': ~Eval('product_equipment', True),
|
||||
})]
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class CreateSubscriptionStart(ModelView):
|
||||
'Create Subscription Start'
|
||||
@ -338,3 +338,4 @@ class CreateSubscription(Wizard):
|
||||
equipments=equipments_to_subscription,
|
||||
)
|
||||
subscription.save()
|
||||
"""
|
||||
|
5
sale.xml
5
sale.xml
@ -17,7 +17,7 @@
|
||||
<field name="inherit" ref="sale.sale_line_view_tree_sequence"/>
|
||||
<field name="name">sale_line_tree_sequence</field>
|
||||
</record>
|
||||
-->
|
||||
|
||||
<record model="ir.ui.view" id="create_subscription_view_form">
|
||||
<field name="model">sale.create.subscription.start</field>
|
||||
<field name="type">form</field>
|
||||
@ -32,5 +32,6 @@
|
||||
<field name="keyword">form_action</field>
|
||||
<field name="model">sale.sale,-1</field>
|
||||
<field name="action" ref="create_subscription"/>
|
||||
</record>
|
||||
</record>
|
||||
-->
|
||||
</tryton>
|
||||
|
348
subscription.py
348
subscription.py
@ -1,18 +1,345 @@
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.model import (
|
||||
ModelSQL, ModelView, Workflow, fields)
|
||||
from trytond.pyson import Eval
|
||||
from trytond.pyson import Eval, If, Bool
|
||||
from trytond.modules.company.model import set_employee
|
||||
from trytond.exceptions import UserError
|
||||
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.wizard import (
|
||||
Button, StateAction, StateTransition, StateView, Wizard)
|
||||
|
||||
from trytond.modules.currency.fields import Monetary
|
||||
from trytond.modules.product import price_digits
|
||||
|
||||
import datetime
|
||||
|
||||
|
||||
class Contract(ModelSQL, ModelView):
|
||||
'Contracts'
|
||||
__name__ = 'sale.subscription.contract'
|
||||
|
||||
company = fields.Many2One(
|
||||
'company.company', "Company", required=True, select=True,
|
||||
states={
|
||||
'readonly': (Eval('state') != 'draft') | Eval('party', True),
|
||||
},help="Make the subscription belong to the company.")
|
||||
number = fields.Char(
|
||||
"Number", readonly=True, select=True,
|
||||
help="The main identification of the subscription.")
|
||||
reference = fields.Char(
|
||||
"Reference", select=True,
|
||||
help="The identification of an external origin.")
|
||||
description = fields.Char("Description",
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
})
|
||||
party = fields.Many2One(
|
||||
'party.party', "Party", required=True,
|
||||
help="The party who subscribes.")
|
||||
contact = fields.Many2One(
|
||||
'party.contact_mechanism', "Contact")
|
||||
invoice_address = fields.Many2One('party.address', 'Invoice Address',
|
||||
required=True, domain=[('party', '=', Eval('party'))])
|
||||
invoice_recurrence = fields.Many2One(
|
||||
'sale.subscription.recurrence.rule.set', "Invoice Recurrence",
|
||||
required=True)
|
||||
start_date = fields.Date(
|
||||
"Start Date", required=False,)
|
||||
end_date = fields.Date(
|
||||
"End Date",
|
||||
domain=['OR',
|
||||
('end_date', '>=', If(
|
||||
Bool(Eval('start_date')),
|
||||
Eval('start_date', datetime.date.min),
|
||||
datetime.date.min)),
|
||||
('end_date', '=', None),
|
||||
],
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
}
|
||||
)
|
||||
state = fields.Selection([
|
||||
('draft', "Draft"),
|
||||
('quotation', "Quotation"),
|
||||
('running', "Running"),
|
||||
('closed', "Closed"),
|
||||
('cancelled', "Cancelled"),
|
||||
], "State", readonly=False, required=False, sort=False,
|
||||
help="The current state of the subscription.")
|
||||
contract = fields.Many2One('sale.subscription', "Contract")
|
||||
prorogues = fields.Many2Many('sale.subscription-sale.subscription.contract',
|
||||
'contract', 'subscription', 'Prorrogation')
|
||||
|
||||
equipments = fields.Many2Many('sale.subscription-optical_equipment.equipment', 'subscription',
|
||||
'equipment', "Equipments")
|
||||
@staticmethod
|
||||
def default_company():
|
||||
return Transaction().context.get('company')
|
||||
|
||||
class CreateNextProrogue(ModelView):
|
||||
'Create Next Prorogue'
|
||||
__name__ = 'sale.create.prorogue.next'
|
||||
|
||||
initial_contract = fields.Many2One('sale.subscription.contract', "Initial Contract")
|
||||
party = fields.Many2One('party.party', "Party", required=True,
|
||||
help="The party who subscribes.")
|
||||
contact = fields.Many2One(
|
||||
'party.contact_mechanism', "Contact")
|
||||
invoice_address = fields.Many2One('party.address', 'Invoice Address',
|
||||
required=True, domain=[('party', '=', Eval('party'))])
|
||||
invoice_recurrence = fields.Many2One(
|
||||
'sale.subscription.recurrence.rule.set', "Invoice Recurrence",
|
||||
required=True)
|
||||
start_date = fields.Date("Start Date", required=True,)
|
||||
end_date = fields.Date("End Date", required=True,
|
||||
domain=['OR',
|
||||
('end_date', '>=', If(
|
||||
Bool(Eval('start_date')),
|
||||
Eval('start_date', datetime.date.min),
|
||||
datetime.date.min)),
|
||||
('end_date', '=', None),
|
||||
])
|
||||
invoice_start_date = fields.Date("Invoice Start Date", required=True,
|
||||
help='Billing start date')
|
||||
equipments = fields.Many2Many('sale.subscription-optical_equipment.equipment', 'subscription',
|
||||
'equipment', "Equipments", required=True,
|
||||
domain=[['OR',
|
||||
('state', '=', 'registred'),
|
||||
('state', '=', 'uncontrated')]
|
||||
])
|
||||
@fields.depends('initial_contract', 'party', 'contact', 'invoice_address',
|
||||
'invoice_recurrence', 'start_date', 'end_date',
|
||||
'equipments')
|
||||
def on_change_initial_contract(self):
|
||||
if self.initial_contract:
|
||||
contract = self.initial_contract
|
||||
self.party = contract.party.id
|
||||
self.contact = contract.contact.id
|
||||
self.invoice_address = contract.invoice_address.id
|
||||
self.invoice_recurrence = contract.invoice_recurrence.id
|
||||
self.start_date = contract.end_date
|
||||
self.equipments = contract.equipments
|
||||
else:
|
||||
self.party = None
|
||||
self.contact = None
|
||||
self.invoice_address = None
|
||||
self.invoice_recurrence = None
|
||||
self.start_date = None
|
||||
self.equipments = []
|
||||
|
||||
class CreateProrogue(Wizard):
|
||||
'Create Prorogue'
|
||||
__name__ = 'sale.create.prorogue'
|
||||
|
||||
start = StateView('sale.create.prorogue.next',
|
||||
'optical_equipment.create_prorogue_view_form',
|
||||
[Button('Cancel', 'end', 'tryton-cancel'),
|
||||
Button('Create', 'create_prorogue', 'tryton-ok', default=True),
|
||||
])
|
||||
|
||||
create_prorogue = StateAction('sale_subscription.act_subscription_form')
|
||||
|
||||
done_ = StateView('sale.create.prorogue.next',
|
||||
'optical_equipment.create_prorogue_view_form',[
|
||||
Button('Done', 'end', 'tryton-cancel'),
|
||||
])
|
||||
|
||||
@property
|
||||
def _subscription_start(self):
|
||||
return dict(
|
||||
party=self.start.party,
|
||||
contact=self.start.contact,
|
||||
start_date=self.start.start_date,
|
||||
end_date=self.start.end_date,
|
||||
payment_term=self.start.payment_term,
|
||||
invoice_address=self.start.invoice_address,
|
||||
invoice_recurrence=self.start.invoice_recurrence,
|
||||
invoice_start_date=self.start.invoice_start_date,
|
||||
service=self.start.service,
|
||||
quantity=self.start.quantity,
|
||||
unit_price=self.start.unit_price,
|
||||
equipments=self.start.equipments)
|
||||
|
||||
def do_create_prorogue(self, action):
|
||||
pool = Pool()
|
||||
Subscription = pool.get('sale.subscription')
|
||||
SubscriptionLine = pool.get('sale.subscription.line')
|
||||
|
||||
a = self._subscription_start
|
||||
|
||||
equipments_to_subscription=self.start.equipments subscription_lines = [SubscriptionLine(
|
||||
start_date=a['start_date'],
|
||||
end_date=a['end_date'],
|
||||
consumption_recurrence=a['invoice_recurrence'],
|
||||
service=a['service'],
|
||||
unit=a['service'].product.default_uom,
|
||||
quantity=a['quantity'],
|
||||
unit_price=a['unit_price']
|
||||
)]
|
||||
|
||||
subscription = Subscription(
|
||||
state='draft',
|
||||
type='contract',
|
||||
party=a['party'],
|
||||
invoice_address=a['invoice_address'],
|
||||
payment_term=a['payment_term'],
|
||||
start_date=a['start_date'],
|
||||
end_date=a['end_date'],
|
||||
invoice_recurrence=a['invoice_recurrence'],
|
||||
invoice_start_date=a['invoice_start_date'],
|
||||
contact=a['contact'],
|
||||
invoice_party=a['party'],
|
||||
lines=subscription_lines,
|
||||
equipments=equipments_to_subscription,
|
||||
)
|
||||
subscription.save()
|
||||
self.initial_contract.prorogues.append(subscription.id)
|
||||
self.initial_contract.save()
|
||||
|
||||
class CreateInitialContract(ModelView):
|
||||
'Create Initial Contract'
|
||||
__name__ = 'sale.create.contract.initial'
|
||||
|
||||
party = fields.Many2One(
|
||||
'party.party', "Party", required=True,
|
||||
help="The party who subscribes.")
|
||||
invoice_address = fields.Many2One('party.address', 'Invoice Address',
|
||||
required=True, domain=[('party', '=', Eval('party'))])
|
||||
payment_term = fields.Many2One('account.invoice.payment_term',
|
||||
'Payment Term')
|
||||
contact = fields.Many2One(
|
||||
'party.contact_mechanism', "Contact", required=True)
|
||||
start_date = fields.Date("Start Date", required=True)
|
||||
end_date = fields.Date("End Date", required=True)
|
||||
invoice_recurrence = fields.Many2One('sale.subscription.recurrence.rule.set',
|
||||
"Invoice Recurrence",required=True)
|
||||
invoice_start_date = fields.Date("Invoice Start Date", required=True,
|
||||
help='Billing start date')
|
||||
service = fields.Many2One('sale.subscription.service', "Service", required=True)
|
||||
quantity = fields.Float("Quantity", digits='unit', required=True)
|
||||
unit_price = Monetary("Unit Price", currency='currency',
|
||||
digits=price_digits,required=True
|
||||
)
|
||||
equipments = fields.Many2Many('sale.subscription-optical_equipment.equipment', 'subscription',
|
||||
'equipment', "Equipments", required=True,
|
||||
domain=[['OR',
|
||||
('state', '=', 'registred'),
|
||||
('state', '=', 'uncontrated')]
|
||||
])
|
||||
|
||||
@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 CreateContract(Wizard):
|
||||
'Create Contract'
|
||||
__name__ = 'sale.create.contract'
|
||||
|
||||
start = StateView('sale.create.contract.initial',
|
||||
'optical_equipment.create_contract_view_form',[
|
||||
Button('Cancel', 'end', 'tryton-cancel'),
|
||||
Button('Create', 'create_contract', 'tryton-ok', default=True),
|
||||
])
|
||||
create_contract = StateAction('sale_subscription.act_subscription_form')
|
||||
|
||||
done_ = StateView('sale.create.contract.initial',
|
||||
'optical_equipment.create_contract_view_form',[
|
||||
Button('Done', 'end', 'tryton-cancel'),
|
||||
])
|
||||
|
||||
@property
|
||||
def _subscription_start(self):
|
||||
return dict(
|
||||
party=self.start.party,
|
||||
contact=self.start.contact,
|
||||
start_date=self.start.start_date,
|
||||
end_date=self.start.end_date,
|
||||
payment_term=self.start.payment_term,
|
||||
invoice_address=self.start.invoice_address,
|
||||
invoice_recurrence=self.start.invoice_recurrence,
|
||||
invoice_start_date=self.start.invoice_start_date,
|
||||
service=self.start.service,
|
||||
quantity=self.start.quantity,
|
||||
unit_price=self.start.unit_price,
|
||||
equipments=self.start.equipments)
|
||||
|
||||
def _create_contract_base(self,dates, subscription):
|
||||
pool = Pool()
|
||||
ContractBase = pool.get('sale.subscription.contract')
|
||||
|
||||
a = self._subscription_start
|
||||
|
||||
contractBase = ContractBase(
|
||||
state='draft',
|
||||
party=a['party'],
|
||||
invoice_address=a['invoice_address'],
|
||||
start_date=a['start_date'],
|
||||
end_date=a['end_date'],
|
||||
invoice_recurrence=a['invoice_recurrence'],
|
||||
contact=a['contact'],
|
||||
contract=subscription,
|
||||
equipments=a['equipments']
|
||||
)
|
||||
contractBase.save()
|
||||
|
||||
def do_create_contract(self, action):
|
||||
pool = Pool()
|
||||
Subscription = pool.get('sale.subscription')
|
||||
SubscriptionLine = pool.get('sale.subscription.line')
|
||||
|
||||
a = self._subscription_start
|
||||
|
||||
equipments_to_subscription=self.start.equipments
|
||||
subscription_lines = [SubscriptionLine(
|
||||
start_date=a['start_date'],
|
||||
end_date=a['end_date'],
|
||||
consumption_recurrence=a['invoice_recurrence'],
|
||||
service=a['service'],
|
||||
unit=a['service'].product.default_uom,
|
||||
quantity=a['quantity'],
|
||||
unit_price=a['unit_price']
|
||||
)]
|
||||
|
||||
subscription = Subscription(
|
||||
state='draft',
|
||||
type='contract',
|
||||
party=a['party'],
|
||||
invoice_address=a['invoice_address'],
|
||||
payment_term=a['payment_term'],
|
||||
start_date=a['start_date'],
|
||||
end_date=a['end_date'],
|
||||
invoice_recurrence=a['invoice_recurrence'],
|
||||
invoice_start_date=a['invoice_start_date'],
|
||||
contact=a['contact'],
|
||||
invoice_party=a['party'],
|
||||
lines=subscription_lines,
|
||||
equipments=equipments_to_subscription,
|
||||
)
|
||||
subscription.save()
|
||||
|
||||
self._create_contract_base(a, subscription.id)
|
||||
|
||||
class Subscription(metaclass=PoolMeta):
|
||||
__name__ = 'sale.subscription'
|
||||
|
||||
type = fields.Selection([
|
||||
('contract', "Main"),
|
||||
('prorrogation', "Extension"),
|
||||
], "Type", select=True, required=True,
|
||||
states={
|
||||
'readonly': ((Eval('state') != 'draft')
|
||||
| Eval('context', {}).get('type')
|
||||
),
|
||||
})
|
||||
|
||||
equipments = fields.Many2Many('sale.subscription-optical_equipment.equipment', 'subscription',
|
||||
'equipment', "Equipments",
|
||||
domain=[['OR',
|
||||
@ -20,7 +347,6 @@ class Subscription(metaclass=PoolMeta):
|
||||
('state', '=', 'uncontrated')]
|
||||
])
|
||||
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('running')
|
||||
@ -49,8 +375,6 @@ class Subscription(metaclass=PoolMeta):
|
||||
Line.save(lines)
|
||||
cls.save(subscriptions)
|
||||
|
||||
|
||||
|
||||
class CreateSubscriptionInvoice(Wizard):
|
||||
"Create Subscription Invoice"
|
||||
__name__ = 'sale.subscription.create_invoice'
|
||||
@ -72,7 +396,6 @@ class CreateSubscriptionInvoice(Wizard):
|
||||
Journals = pool.get('account.journal')
|
||||
Invoice = pool.get('account.invoice')
|
||||
InvoiceLine = pool.get('account.invoice.line')
|
||||
subscription = self.records[0]
|
||||
invoice_lines = []
|
||||
|
||||
if date is None:
|
||||
@ -101,8 +424,7 @@ class CreateSubscriptionInvoice(Wizard):
|
||||
lines=invoice_lines,
|
||||
)
|
||||
invoice.save()
|
||||
|
||||
|
||||
|
||||
def transition_create_(self):
|
||||
pool = Pool()
|
||||
Subscription = pool.get('sale.subscription')
|
||||
@ -110,10 +432,16 @@ class CreateSubscriptionInvoice(Wizard):
|
||||
|
||||
return 'end'
|
||||
|
||||
|
||||
class SubscriptionEquipment(ModelSQL):
|
||||
'Optical Equipment - Subscription'
|
||||
__name__ = 'sale.subscription-optical_equipment.equipment'
|
||||
|
||||
subscription = fields.Many2One('sale.subscription', 'Subscription', select=True)
|
||||
equipment = fields.Many2One('optical_equipment.equipment', 'Equipment', select=True)
|
||||
equipment = fields.Many2One('optical_equipment.equipment', 'Equipment', select=True)
|
||||
|
||||
class ContractSupscription(ModelSQL):
|
||||
'Prorrogation to the Contract'
|
||||
__name__='sale.subscription-sale.subscription.contract'
|
||||
|
||||
contract = fields.Many2One('sale.subscription.contract', 'Contract', select=True)
|
||||
subscription = fields.Many2One('sale.subscription', 'Subscription', select=True)
|
||||
|
@ -1,6 +1,63 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--This file file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<record model="ir.ui.view" id="contract_view_form">
|
||||
<field name="model">sale.subscription.contract</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">contract_form</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="contract_view_list">
|
||||
<field name="model">sale.subscription.contract</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">contract_list</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window" id="act_contract_form">
|
||||
<field name="name">Contracts</field>
|
||||
<field name="res_model">sale.subscription.contract</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_contract_form_view1">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="contract_view_list"/>
|
||||
<field name="act_window" ref="act_contract_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_contract_form_view2">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="contract_view_form"/>
|
||||
<field name="act_window" ref="act_contract_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain"
|
||||
id="act_contract_form_domain_draft">
|
||||
<field name="name">Draft</field>
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="domain" eval="[('state', '=', 'draft')]" pyson="1"/>
|
||||
<field name="count" eval="True"/>
|
||||
<field name="act_window" ref="act_contract_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain"
|
||||
id="act_contract_form_domain_quotation">
|
||||
<field name="name">Quotation</field>
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="domain" eval="[('state', '=', 'quotation')]"
|
||||
pyson="1"/>
|
||||
<field name="count" eval="True"/>
|
||||
<field name="act_window" ref="act_contract_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain"
|
||||
id="act_contract_form_domain_running">
|
||||
<field name="name">Running</field>
|
||||
<field name="sequence" eval="30"/>
|
||||
<field name="domain" eval="[('state', '=', 'running')]" pyson="1"/>
|
||||
<field name="act_window" ref="act_contract_form"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.domain"
|
||||
id="act_contract_form_domain_all">
|
||||
<field name="name">All</field>
|
||||
<field name="sequence" eval="9999"/>
|
||||
<field name="domain"></field>
|
||||
<field name="act_window" ref="act_contract_form"/>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="subscription_view_form">
|
||||
<field name="model">sale.subscription</field>
|
||||
<field name="inherit" ref="sale_subscription.subscription_view_form"/>
|
||||
@ -34,4 +91,46 @@
|
||||
<field name="model">sale.subscription,-1</field>
|
||||
<field name="action" ref="report_contract"/>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="create_contract_view_form">
|
||||
<field name="model">sale.create.contract.initial</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">create_subscription_form</field>
|
||||
</record>
|
||||
<record model="ir.action.wizard" id="act_create_contract">
|
||||
<field name="name">Initial Contract</field>
|
||||
<field name="wiz_name">sale.create.contract</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="create_prorogue_view_form">
|
||||
<field name="model">sale.create.prorogue.next</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">create_prorogue_form</field>
|
||||
</record>
|
||||
<record model="ir.action.wizard" id="act_create_prorogue">
|
||||
<field name="name">Prorogue to Contract</field>
|
||||
<field name="wiz_name">sale.create.prorogue</field>
|
||||
</record>
|
||||
<menuitem
|
||||
name="Contracts Management"
|
||||
sequence="50"
|
||||
id="menu_contracts"/>
|
||||
<menuitem
|
||||
parent="menu_contracts"
|
||||
action="act_create_contract"
|
||||
sequence="10"
|
||||
id="menu_create_contract_initial"/>
|
||||
<menuitem
|
||||
parent="menu_contracts"
|
||||
action="act_create_prorogue"
|
||||
sequence="20"
|
||||
id="menu_create_prorogue"/>
|
||||
<menuitem
|
||||
parent="menu_contracts"
|
||||
action="act_contract_form"
|
||||
sequence="30"
|
||||
id="menu_contract_form"/>
|
||||
<menuitem
|
||||
parent="menu_contracts"
|
||||
action="sale_subscription.act_subscription_form"
|
||||
sequence="40"
|
||||
id="sale_subscription.menu_subscription_form"/>
|
||||
</tryton>
|
||||
|
43
view/contract_form.xml
Normal file
43
view/contract_form.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form col="6">
|
||||
<label name="party"/>
|
||||
<field name="party"/>
|
||||
<label name="invoice_address"/>
|
||||
<field name="invoice_address"/>
|
||||
<label name="number"/>
|
||||
<field name="number"/>
|
||||
<label name="contact"/>
|
||||
<field name="contact"/>
|
||||
<label name="invoice_recurrence"/>
|
||||
<field name="invoice_recurrence"/>
|
||||
<newline/>
|
||||
<label name="description"/>
|
||||
<field name="description" colspan="3"/>
|
||||
<label name="reference"/>
|
||||
<field name="reference"/>
|
||||
<newline/>
|
||||
<separator id="validity" string="Validity" colspan="6"/>
|
||||
<label name="start_date"/>
|
||||
<field name="start_date"/>
|
||||
<label name="end_date"/>
|
||||
<field name="end_date"/>
|
||||
<notebook colspan="6">
|
||||
<page string="Contracts and Prorogues" id="contracts">
|
||||
<separator id="current_contract" string="Current Contract" colspan="6"/>
|
||||
<field name="contract"/>
|
||||
<newline/>
|
||||
<field name="prorogues"/>
|
||||
</page>
|
||||
<page string="Equipments" id="equipments">
|
||||
<field name="equipments"/>
|
||||
</page>
|
||||
<page string="Other Info" id="other">
|
||||
<label name="company"/>
|
||||
<field name="company"/>
|
||||
</page>
|
||||
</notebook>
|
||||
<label name="state"/>
|
||||
<field name="state"/>
|
||||
</form>
|
11
view/contract_list.xml
Normal file
11
view/contract_list.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tree>
|
||||
<field name="number"/>
|
||||
<field name="party"/>
|
||||
<field name="reference"/>
|
||||
<field name="description"/>
|
||||
<field name="start_date"/>
|
||||
<field name="end_date"/>
|
||||
</tree>
|
9
view/contract_tree.xml
Normal file
9
view/contract_tree.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--This file file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
|
||||
<tree>
|
||||
<field name="number"/>
|
||||
<field name="reference"/>
|
||||
<field name="party"/>
|
||||
<field name="start_date"/>
|
||||
<field name="end_date"/>
|
||||
</tree>
|
26
view/create_prorogue_form.xml
Normal file
26
view/create_prorogue_form.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form>
|
||||
<group id="create_prorogue">
|
||||
<label name="initial_contract"/>
|
||||
<field name="initial_contract" colspan="3"/>
|
||||
<label name="party"/>
|
||||
<field name="party"/>
|
||||
<label name="invoice_address"/>
|
||||
<field name="invoice_address"/>
|
||||
<label name="contact"/>
|
||||
<field name="contact"/>
|
||||
<newline/>
|
||||
<label name="start_date"/>
|
||||
<field name="start_date"/>
|
||||
<label name="end_date"/>
|
||||
<field name="end_date"/>
|
||||
<label name="invoice_start_date"/>
|
||||
<field name="invoice_start_date"/>>
|
||||
<label name="invoice_recurrence"/>
|
||||
<field name="invoice_recurrence"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<field name="equipments"/>
|
||||
</form>
|
@ -1,27 +1,25 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form col="2">
|
||||
<image name="tryton-warning" xexpand="0" xfill="0"/>
|
||||
<group col="4" id="create_subscription">
|
||||
<label
|
||||
string="Are you sure to create one subscription these/this sale(s)?"
|
||||
id="create_subscription" colspan="2"
|
||||
yalign="0.0" xalign="0.0" xexpand="1"/>
|
||||
<newline/>
|
||||
<form>
|
||||
<group id="create_subscription">
|
||||
<label name="initial_contract"/>
|
||||
<field name="initial_contract"/>
|
||||
<label name="party"/>
|
||||
<field name="party"/>
|
||||
<label name="contact"/>
|
||||
<field name="contact"/>
|
||||
<label name="invoice_address"/>
|
||||
<field name="invoice_address"/>
|
||||
<label name="invoice_recurrence"/>
|
||||
<field name="invoice_recurrence"/>
|
||||
<label name="start_date"/>
|
||||
<field name="start_date"/>
|
||||
<label name="end_date"/>
|
||||
<field name="end_date"/>
|
||||
<label name="invoice_recurrence"/>
|
||||
<field name="invoice_recurrence"/>
|
||||
<label name="invoice_start_date"/>
|
||||
<field name="invoice_start_date"/>
|
||||
<label name="service"/>
|
||||
<field name="service"/>
|
||||
<label name="quantity"/>
|
||||
<field name="quantity"/>
|
||||
<label name="unit_price"/>
|
||||
<field name="unit_price"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<field name="equipments"/>
|
||||
</form>
|
||||
|
@ -1,6 +1,10 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--This file file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
|
||||
<data>
|
||||
<!--
|
||||
<xpath expr="/form/group[@id='header']/field[@name='party']" position="before">
|
||||
<field name="type"/>
|
||||
</xpath> -->
|
||||
<xpath
|
||||
expr="/form/notebook/page[@id='subscription']" position="after">
|
||||
<page string="Equipments" id="equipments_subscription">
|
||||
|
Loading…
Reference in New Issue
Block a user