[IMP] contract management: improved usability, mostly in account.analytic.account form view

bzr revid: qdp-launchpad@openerp.com-20120619122128-axj9zn61ahalgg98
This commit is contained in:
Quentin (OpenERP) 2012-06-19 14:21:28 +02:00
parent 9d705e8081
commit 015f03776e
6 changed files with 32 additions and 35 deletions

View File

@ -455,14 +455,14 @@ class account_analytic_account(osv.osv):
'invoice_on_timesheets' : fields.boolean("Invoice On Timesheets"),
'month_ids': fields.function(_analysis_all, multi='analytic_analysis', type='many2many', relation='account_analytic_analysis.summary.month', string='Month'),
'user_ids': fields.function(_analysis_all, multi='analytic_analysis', type="many2many", relation='account_analytic_analysis.summary.user', string='User'),
'template_id':fields.many2one('account.analytic.account', 'Template of Contract'),
'template_id': fields.many2one('account.analytic.account', 'Template of Contract'),
'hours_qtt_est': fields.float('Estimation of Hours to Invoice'),
'est_total' : fields.function(_sum_of_fields, type="float",multi="sum_of_all"),
'invoiced_total' : fields.function(_sum_of_fields, type="float",multi="sum_of_all"),
'remaining_total' : fields.function(_sum_of_fields, type="float",multi="sum_of_all"),
'toinvoice_total' : fields.function(_sum_of_fields, type="float",multi="sum_of_all"),
'est_total' : fields.function(_sum_of_fields, type="float",multi="sum_of_all", string="Total Estimation"),
'invoiced_total' : fields.function(_sum_of_fields, type="float",multi="sum_of_all", string="Total Invoiced"),
'remaining_total' : fields.function(_sum_of_fields, type="float",multi="sum_of_all", string="Total Remaining", help="Expectation of remaining income for this contract. Computed as the sum of remaining subtotals which, in turn, are computed as the maximum between '(Estimation - Invoiced)' and 'To Invoice' amounts"),
'toinvoice_total' : fields.function(_sum_of_fields, type="float",multi="sum_of_all", string="Total to Invoice", help=" Sum of everything that could be invoiced for this contract."),
}
def open_sale_order_lines(self,cr,uid,ids,context=None):
if context is None:
context = {}

View File

@ -30,12 +30,12 @@
<field name="remaining_hours" class="oe_form_inline"/>
</div>
</xpath>
<xpath expr='//field[@name="pricelist_id"]' position='replace'>
<field name="pricelist_id" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
</xpath>
<xpath expr='//field[@name="to_invoice"]' position='replace'>
<field name="to_invoice" widget="selection" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}"/>
</xpath>
<xpath expr='//group[@name="invoice_on_timesheets"]' position="replace">
<group name='invoice_on_timesheets' string="Invoice on Timesheets Options" attrs="{'invisible': [('invoice_on_timesheets','=',False)]}" col="4">
<field name="pricelist_id" attrs="{'required': [('invoice_on_timesheets', '=', True)]}"/>
<field name="to_invoice" widget="selection" attrs="{'required': [('invoice_on_timesheets', '=', True)]}"/>
</group>
</xpath>
<xpath expr='//group[@name="master"]' position='after'>
<separator name="toinvoice" string="Invoicing"/>
<table width="100%%">
@ -100,22 +100,6 @@
</field>
</record>
<!-- Add information on Account analytic list for the project management -->
<record id="view_account_analytic_account_tree_c2c_2" model="ir.ui.view">
<field name="name">account.analytic.account.tree</field>
<field name="model">account.analytic.account</field>
<field name="inherit_id" ref="account.view_account_analytic_account_list"/>
<field name="type">tree</field>
<field name="arch" type="xml">
<field name="quantity" position="replace">
<field name="hours_quantity"/>
<field name="hours_qtt_non_invoiced"/>
<field name="remaining_hours"/>
<field name="quantity_max"/>
</field>
</field>
</record>
<record id="view_account_analytic_account_tree_c2c_3" model="ir.ui.view">
<field name="name">account.analytic.account.tree</field>
<field name="model">account.analytic.account</field>
@ -124,11 +108,11 @@
<field name="arch" type="xml">
<field name="date" position="before">
<field name="last_invoice_date"/>
<field name="ca_to_invoice"/>
<field name="toinvoice_total"/>
</field>
</field>
</record>
<record id="template_of_contract_action" model="ir.actions.act_window">
<field name="name">Template of Contract</field>
<field name="type">ir.actions.act_window</field>

View File

@ -156,7 +156,7 @@ class account_analytic_account(osv.osv):
'name': fields.char('Account Name', size=128, required=True),
'complete_name': fields.function(_complete_name_calc, type='char', string='Full Account Name'),
'code': fields.char('Code/Reference', size=24, select=True),
'type': fields.selection([('view','Analytic View'), ('normal','Analytic Account'),('contract','Contract or Project'),('template','Template of Project')], 'Type of Account', help='If you select the View Type, it means you won\'t allow to create journal entries using that account.'),
'type': fields.selection([('view','Analytic View'), ('normal','Analytic Account'),('contract','Contract or Project'),('template','Template of Project')], 'Type of Account', required=True, help='If you select the View Type, it means you won\'t allow to create journal entries using that account.'),
'description': fields.text('Description'),
'parent_id': fields.many2one('account.analytic.account', 'Parent Analytic Account', select=2),
'child_ids': fields.one2many('account.analytic.account', 'parent_id', 'Child Accounts'),

View File

@ -15,18 +15,18 @@
</h1>
<group>
<group>
<field name="code"/>
<field name="partner_id" on_change="on_change_partner_id(partner_id, name)" attrs="{'required':[('type','=','contract')]}"/>
<field name="parent_id" on_change="on_change_parent(parent_id)" attrs="{'invisible': [('type','in',['contract','template'])]}"/>
<field name="type"/>
</group>
<group>
<field name="partner_id" on_change="on_change_partner_id(partner_id, name)" attrs="{'required':[('type','!=','template')]}"/>
<field name="code"/>
<field name="manager_id"/>
<field name="company_id" on_change="on_change_company(company_id)" widget="selection" groups="base.group_multi_company" attrs="{'required': [('type','&lt;&gt;','view')]}"/>
</group>
</group>
<notebook>
<page string="Contract Information" name="contract_page" attrs="{'invisible':[('type','=','view')]}">
<page string="Contract Information" name="contract_page" attrs="{'invisible':[('type','not in',['contract', 'template'])]}">
<group name="master">
<group string="Validity" name="contract">
<field name="date_start"/>

View File

@ -109,5 +109,18 @@
</xpath>
</field>
</record>
<record id="contract_inherited_form" model="ir.ui.view">
<field name="name">Inherit contract form : adding UoM</field>
<field name="model">account.analytic.account</field>
<field name="type">form</field>
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
<field name="priority">50</field>
<field name="arch" type="xml">
<xpath expr='//field[@name="remaining_hours"]' position='after'>
<field name="company_uom_id" readonly="1" class="oe_form_inline"/>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -9,7 +9,7 @@
<field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
<field name="arch" type="xml">
<xpath expr='//separator[@name="description"]' position='before'>
<group col="4">
<group string="Invoice on Timesheets Options" name="invoice_on_timesheets" col="4">
<field name="pricelist_id" />
<field name="to_invoice" widget="selection"/>
</group>