Create field departament, relationed with company_department

This commit is contained in:
Danny Barajas 2022-03-05 11:45:15 -05:00
parent be77546037
commit aa3880bbd6
8 changed files with 38 additions and 4 deletions

View File

@ -11,7 +11,7 @@ from . import activity
from . import opportunity
from . import party_validation
from . import exceptions
# from . import contract
from . import contract
def register():
@ -44,7 +44,7 @@ def register():
party_validation.ValidationTemplate,
party_validation.ValidationTemplateAsk,
party_validation.ValidationAsk,
# contract.Contract,
contract.Contract,
# opportunity.OpportunityEmployee,
# opportunity.OpportunityEmployeeContext,
# opportunity.OpportunityMonthly,

View File

@ -1,9 +1,12 @@
from trytond.pool import PoolMeta
from trytond.model import fields
class Contract(metaclass=PoolMeta):
__name__ = 'sale.contract'
department = fields.Many2One('company.department','Department',states={'required':True})
@classmethod
def _get_origin(cls):
'Return list of Model names for origin Reference'
return super(Contract,cls)._get_origin() + ['crm.oppportunity']
return super(Contract,cls)._get_origin() + ['crm.opportunity']

16
contract.xml Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!-- This file is part of the sale_weight module for Tryton.
The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
<tryton>
<data>
<record model="ir.ui.view" id="contract_view_form">
<field name="model">sale.contract</field>
<field name="inherit" ref="sale_contract.contract_view_form"/>
<field name="name">contract_form</field>
</record>
</data>
</tryton>

View File

@ -846,6 +846,8 @@ class CrmOpportunityLine(sequence_ordered(), ModelSQL, ModelView):
description = fields.Function(fields.Text('Description'),
'on_change_with_description')
unit_price = fields.Numeric('Unit Price', digits=(16, 2))
del _states, _depends
@classmethod

View File

@ -3,10 +3,12 @@ version=6.0.1
depends:
party
sale
sale_contract
company_department
xml:
crm.xml
configuration.xml
contract.xml
case.xml
customer_service.xml
survey.xml

9
view/contract_form.xml Normal file
View File

@ -0,0 +1,9 @@
<?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. -->
<data>
<xpath expr="/form/group[@id='contract']/field[@name='reference']" position="after">
<label name="department"/>
<field name="department"/>
</xpath>
</data>

View File

@ -60,7 +60,7 @@ this repository contains the full copyright notices and license terms. -->
</page>
<page string="Party Validation" name="party_validations">
<field name="party_validations" view_ids="crm.opportunity_validation_view_tree,crm.opportunity_validation_view_form" colspan="4"/>
</page>
</page>
<page string="Contracts" name="contracts">
<field name="contracts" colspan="4"/>
</page>

View File

@ -12,6 +12,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="quantity"/>
<label name="unit"/>
<field name="unit"/>
<label name="unit_price"/>
<field name="unit_price"/>
<newline />
<label name="description"/>
<field name="description"/>