calibration
This commit is contained in:
parent
a1b4cc5616
commit
927e6c060d
95
contract.py
Normal file
95
contract.py
Normal file
@ -0,0 +1,95 @@
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.model import (
|
||||
ModelSQL, ModelView, Workflow, fields)
|
||||
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
|
||||
from datetime import timedelta
|
||||
|
||||
|
||||
class Contract(ModelSQL, ModelView):
|
||||
'Contracts'
|
||||
__name__ = 'optical_equipment.contract'
|
||||
|
||||
company = fields.Many2One(
|
||||
'company.company', "Company", readonly=True, 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", readonly=True, required=True,
|
||||
help="The party who subscribes.")
|
||||
contact = fields.Many2One('party.contact_mechanism', "Contact", readonly=True)
|
||||
invoice_address = fields.Many2One('party.address', 'Invoice Address', readonly=True,
|
||||
required=True, domain=[('party', '=', Eval('party'))])
|
||||
start_date = fields.Date("Start Date", readonly=True, required=False,)
|
||||
end_date = fields.Date(
|
||||
"End Date", readonly=True,
|
||||
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',
|
||||
}
|
||||
)
|
||||
maintenance_services = fields.Many2Many('optical_equipment_maintenance.service-equipment.contract',
|
||||
'contract', 'maintenance_services', "Prorogues")
|
||||
state = fields.Selection([
|
||||
('draft', "Draft"),
|
||||
('quotation', "Quotation"),
|
||||
('running', "Running"),
|
||||
('closed', "Closed"),
|
||||
('cancelled', "Cancelled"),
|
||||
], "State", readonly=True, required=False, sort=False,
|
||||
help="The current state of the subscription.")
|
||||
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(Contract, cls).__setup__()
|
||||
|
||||
@staticmethod
|
||||
def default_company():
|
||||
return Transaction().context.get('company')
|
||||
|
||||
@staticmethod
|
||||
def default_state():
|
||||
return 'draft'
|
||||
|
||||
|
||||
|
||||
class ContractMaintenanceServices(ModelSQL):
|
||||
'Contract - Maintenance Services'
|
||||
__name__ = 'optical_equipment_maintenance.service-equipment.contract'
|
||||
|
||||
maintenance_services = fields.Many2One('optical_equipment_maintenance.service', "Maintenance Service", select=True)
|
||||
contract = fields.Many2One('optical_equipment.contract', "Contract")
|
||||
|
||||
class ContractEquipment(ModelSQL):
|
||||
'Optical Equipment - Contract'
|
||||
__name__ = 'optical_equipment.contract-optical_equipment.equipment'
|
||||
|
||||
equipment = fields.Many2One('optical_equipment.equipment', 'Equipment', select=True)
|
||||
contract = fields.Many2One('optical_equipment.contract', 'Contract', select=True)
|
119
contract.xml
Normal file
119
contract.xml
Normal file
@ -0,0 +1,119 @@
|
||||
<?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">optical_equipment.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">optical_equipment.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">optical_equipment.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_closed">
|
||||
<field name="name">Closed</field>
|
||||
<field name="sequence" eval="40"/>
|
||||
<field name="domain" eval="[('state', '=', 'closed')]" 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="create_contract_view_form">
|
||||
<field name="model">optical_equipment_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">optical_equipment_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">optical_equipment.prorogue</field>
|
||||
</record>
|
||||
<record model="ir.model.button" id="run_prorrogation_button">
|
||||
<field name="name">run</field>
|
||||
<field name="model" search="[('model', '=', 'optical_equipment.contract')]"/>
|
||||
</record>
|
||||
<record model="ir.model.button" id="quotation_contract_button">
|
||||
<field name="name">quotation</field>
|
||||
<field name="string">Quotation</field>
|
||||
<field name="confirm">Are you sure you want to quote these subscription?</field>
|
||||
<field name="model" search="[('model', '=', 'optical_equipment.contract')]"/>
|
||||
</record> -->
|
||||
<menuitem
|
||||
parent="menu_equipment"
|
||||
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"/>
|
||||
</tryton>
|
11
maintenance_line_form.xml
Normal file
11
maintenance_line_form.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. -->
|
||||
<form>
|
||||
<label name="product"/>
|
||||
<field name="product"/>
|
||||
<label name="maintenance"/>
|
||||
<field name="maintenance"/>
|
||||
<label name="maintenance_activity"/>
|
||||
<field name="maintenance_activity"/>
|
||||
</form>
|
17
view/create_contract_form.xml
Normal file
17
view/create_contract_form.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?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_contract">
|
||||
<label name="party"/>
|
||||
<field name="party"/>
|
||||
<label name="contact"/>
|
||||
<field name="contact"/>
|
||||
<label name="invoice_address"/>
|
||||
<field name="invoice_address"/>
|
||||
<label name="start_date"/>
|
||||
<field name="start_date"/>
|
||||
<label name="end_date"/>
|
||||
<field name="end_date"/>
|
||||
</group>
|
||||
</form>
|
16
view/maintenance_sample_form.xml
Normal file
16
view/maintenance_sample_form.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?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>
|
||||
<label name="number_sample"/>
|
||||
<field name="number_sample"/>
|
||||
<newline/>
|
||||
<label name="value_patterns"/>
|
||||
<field name="value_patterns"/>
|
||||
<label name="value_equipment"/>
|
||||
<field name="value_equipment"/>
|
||||
<label name="mistake"/>
|
||||
<field name="mistake"/>
|
||||
<label name="mistake_rate"/>
|
||||
<field name="mistake_rate"/>
|
||||
</form>
|
7
view/pattern_form.xml
Normal file
7
view/pattern_form.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?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>
|
||||
<label name="pattern"/>
|
||||
<field name="pattern"/>
|
||||
</form>
|
6
view/pattern_tree.xml
Normal file
6
view/pattern_tree.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?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="pattern"/>
|
||||
</tree>
|
Loading…
Reference in New Issue
Block a user