[IMP] contract management: misc code cleaning and improvements

bzr revid: qdp-launchpad@openerp.com-20120615131056-swbbcy7obbbjjo33
This commit is contained in:
Quentin (OpenERP) 2012-06-15 15:10:56 +02:00
parent bde7606b5b
commit 41f2eba9fb
8 changed files with 29 additions and 65 deletions

View File

@ -63,7 +63,7 @@
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,form,graph</field> <field name="view_mode">tree,form,graph</field>
<field name="context">{'search_default_user_id':uid, 'search_default_draft':1, 'search_default_pending':1, 'search_default_open':1, 'search_default_renew':1}</field> <field name="context">{'search_default_user_id':uid, 'search_default_draft':1, 'search_default_pending':1, 'search_default_open':1, 'search_default_renew':1}</field>
<field name="domain">[('type','=','normal'),('partner_id', '!=', False)]</field> <field name="domain">[('type','=','contract')]</field>
<field name="search_view_id" ref="view_account_analytic_account_overdue_search"/> <field name="search_view_id" ref="view_account_analytic_account_overdue_search"/>
<field name="help">You will find here the contracts to be renewed because the deadline is passed or the working hours are higher than the allocated hours. OpenERP automatically sets these analytic accounts to the pending state, in order to raise a warning during the timesheets recording. Salesmen should review all pending accounts and reopen or close the according to the negotiation with the customer.</field> <field name="help">You will find here the contracts to be renewed because the deadline is passed or the working hours are higher than the allocated hours. OpenERP automatically sets these analytic accounts to the pending state, in order to raise a warning during the timesheets recording. Salesmen should review all pending accounts and reopen or close the according to the negotiation with the customer.</field>
</record> </record>

View File

@ -138,6 +138,6 @@
<field name="domain">[('type','=','template')]</field> <field name="domain">[('type','=','template')]</field>
<field name="context">{'search_default_type':'template','default_type' : 'template'}</field> <field name="context">{'search_default_type':'template','default_type' : 'template'}</field>
</record> </record>
<menuitem action="template_of_contract_action" id="menu_template_of_contract_action" parent="base.menu_base_config" /> <menuitem action="template_of_contract_action" id="menu_template_of_contract_action" parent="base.menu_base_config"/>
</data> </data>
</openerp> </openerp>

View File

@ -20,7 +20,6 @@
############################################################################## ##############################################################################
import time import time
from lxml import etree
from osv import fields, osv from osv import fields, osv
from tools.translate import _ from tools.translate import _
@ -227,29 +226,6 @@ class account_analytic_account(osv.osv):
default['line_ids'] = [] default['line_ids'] = []
return super(account_analytic_account, self).copy(cr, uid, id, default, context=context) return super(account_analytic_account, self).copy(cr, uid, id, default, context=context)
def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
if context is None:context = {}
res = super(account_analytic_account, self).fields_view_get(cr, user, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
doc = etree.XML(res['arch'])
node = []
if view_type == 'form':node = doc.xpath("//field[@name='name']")
if view_type == 'tree':node = doc.xpath("//field[@name='complete_name']")
if node:
curr_node = node[0]
if context.get('default_type') == 'contract':
curr_node.set('string', 'Contract/Project Name')
curr_node.set('placeholder', 'Contract or Project Name')
elif context.get('default_type') == 'template':
curr_node.set('string', 'Template Name')
curr_node.set('placeholder', 'Template Name')
else:
curr_node.set('string', 'Account Name')
curr_node.set('placeholder', 'Account Name')
res['arch'] = etree.tostring(doc)
return res
def on_change_company(self, cr, uid, id, company_id): def on_change_company(self, cr, uid, id, company_id):
if not company_id: if not company_id:
return {} return {}

View File

@ -87,9 +87,10 @@ class account_analytic_account(osv.osv):
def on_change_partner_id(self, cr, uid, ids,partner_id, name, context=None): def on_change_partner_id(self, cr, uid, ids,partner_id, name, context=None):
res = super(account_analytic_account,self).on_change_partner_id(cr, uid, ids,partner_id, name, context=context) res = super(account_analytic_account,self).on_change_partner_id(cr, uid, ids,partner_id, name, context=context)
part = self.pool.get('res.partner').browse(cr, uid, partner_id,context=context) part = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False
if pricelist:res['value']['pricelist_id'] = pricelist if pricelist:
res['value']['pricelist_id'] = pricelist
return res return res
def set_close(self, cr, uid, ids, context=None): def set_close(self, cr, uid, ids, context=None):

View File

@ -102,8 +102,7 @@
<field name="type">tree</field> <field name="type">tree</field>
<field name="inherit_id" ref="account.view_account_analytic_line_tree"/> <field name="inherit_id" ref="account.view_account_analytic_line_tree"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="account_id" position="replace"> <field name="account_id" position="after">
<field name="account_id" context="{'search_default_use_timesheets': 1, 'default_use_timesheets': 1}"/>
<field name="to_invoice"/> <field name="to_invoice"/>
</field> </field>
</field> </field>

View File

@ -111,7 +111,7 @@
<field colspan="4" context="{'date':date_current,'user_id':user_id}" domain="[('name','=',date_current)]" name="timesheet_ids" nolabel="1"> <field colspan="4" context="{'date':date_current,'user_id':user_id}" domain="[('name','=',date_current)]" name="timesheet_ids" nolabel="1">
<tree editable="top" string="Timesheet Lines"> <tree editable="top" string="Timesheet Lines">
<field invisible="1" name="date"/> <field invisible="1" name="date"/>
<field domain="[('type','=','normal'), ('state', '&lt;&gt;', 'close'),('use_timesheets','=',1)]" name="account_id" on_change="on_change_account_id(account_id)" context="{'default_use_timesheets': 1}"/> <field domain="[('type','in',['normal', 'contract']), ('state', '&lt;&gt;', 'close'),('use_timesheets','=',1)]" name="account_id" on_change="on_change_account_id(account_id)" context="{'default_use_timesheets': 1}"/>
<field name="name"/> <field name="name"/>
<field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/> <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, False, product_uom_id,journal_id)" widget="float_time"/>
<field name="to_invoice" widget="selection"/> <field name="to_invoice" widget="selection"/>

View File

@ -38,34 +38,33 @@
<button name="set_cancel" string="Cancel" type="object" states="open,pending"/> <button name="set_cancel" string="Cancel" type="object" states="open,pending"/>
<field name="state" widget="statusbar" statusbar_visible="open,close" statusbar_colors='{"pending":"blue"}' readonly="1"/> <field name="state" widget="statusbar" statusbar_visible="open,close" statusbar_colors='{"pending":"blue"}' readonly="1"/>
</header> </header>
<sheet string="Project" layout="auto"> <sheet string="Project">
<group col="4" colspan="4"> <group>
<group col="2" colspan="2" class="oe_form_group_label_border"> <label for="name" class="oe_form_readonly_hidden"/>
<field name="name" string="Project Name" select="1"/> <h1>
<field name="name" string="Project Name"/>
</h1>
<group>
<field name="partner_id" on_change="onchange_partner_id(partner_id)" select="1"/> <field name="partner_id" on_change="onchange_partner_id(partner_id)" select="1"/>
<field name="user_id" string="Project Manager" select="1" attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"/> <field name="user_id" string="Project Manager" attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"/>
<field name="analytic_account_id" invisible="1" required="0"/> <field name="analytic_account_id" invisible="1" required="0"/>
<field name="parent_id" invisible="1" string="Parent" domain="[('id','!=',analytic_account_id)]" context="{'current_model': 'project.project'}"/> <field name="parent_id" invisible="1" string="Parent" domain="[('id','!=',analytic_account_id)]" context="{'current_model': 'project.project'}"/>
<field name="privacy_visibility"/> <field name="privacy_visibility"/>
</group> </group>
<group col="2" colspan="2" class="oe_form_group_label_border"> <group col="4">
<table border="0"> <group>
<tr name="use_tasks_row"> <label string=""/>
<th style="border-right:1px solid #DDD;" width="140px">Tasks Management</th> <field name="use_tasks"/>
<td><field name="use_tasks" nolabel="1"/></td> </group>
<td style="text-align:right;" width="110px"><button icon="terp-gtk-go-back-rtl" class="oe_btn_width" name="%(act_project_project_2_project_task_all)d" string="Tasks" type="action" attrs="{'invisible':[('use_tasks','=', 0)]}"/></td> <group>
</tr> <button icon="terp-gtk-go-back-rtl" class="oe_btn_width" name="%(base.action_attachment)d" string="Documents" type="action"/>
<tr name="use_attachment_row"> <button icon="terp-gtk-go-back-rtl" class="oe_btn_width" name="%(act_project_project_2_project_task_all)d" string="Tasks" type="action" attrs="{'invisible':[('use_tasks','=', 0)]}"/>
<th/> </group>
<td/>
<td style="text-align:right;" width="110px"><button icon="terp-gtk-go-back-rtl" class="oe_btn_width" name="%(base.action_attachment)d" string="Documents" type="action" /></td>
</tr>
</table>
</group> </group>
</group> </group>
<notebook colspan="4"> <notebook>
<page string="Team" attrs="{'invisible':[('use_tasks','=', 0)]}" name="team"> <page string="Team" attrs="{'invisible':[('use_tasks','=', 0)]}" name="team">
<field colspan="4" name="members" nolabel="1" widget="many2many_kanban"> <field colspan="4" name="members" widget="many2many_kanban">
<kanban quick_create="true" create="false"> <kanban quick_create="true" create="false">
<field name="name"/> <field name="name"/>
<templates> <templates>
@ -94,19 +93,8 @@
<field name="priority"/> <field name="priority"/>
<field name="active" attrs="{'invisible':[('state','in',['open', 'pending', 'template'])]}"/> <field name="active" attrs="{'invisible':[('state','in',['open', 'pending', 'template'])]}"/>
</group> </group>
</page> <group string="Billing" groups="account.group_account_invoice">
<page string="Billing" groups="account.group_account_invoice"> <field name="currency_id" select="1" groups="base.group_multi_company" required="1"/>
<field name="currency_id" select="1" groups="base.group_multi_company" required="1"/>
<group col="3">
<b>
<label string="Variables you can use for headers and footer." colspan="3"/>
</b>
<label string="Task: %%(name)s"/>
<label string="User: %%(user_id)s"/>
<label string="ID: %%(task_id)s"/>
<label string="Status: %%(state)s"/>
<label string="Date Start: %%(date_start)s"/>
<label string="Date Stop: %%(date)s"/>
</group> </group>
</page> </page>
<page string="Tasks Stages"> <page string="Tasks Stages">

View File

@ -387,7 +387,7 @@
<xpath expr='//separator[@name="project_sep"]' position='replace'> <xpath expr='//separator[@name="project_sep"]' position='replace'>
<separator name="project_sep" string="Project Management" colspan="4"/> <!-- removal of invisible attribute --> <separator name="project_sep" string="Project Management" colspan="4"/> <!-- removal of invisible attribute -->
</xpath> </xpath>
<xpath expr="//separator[@name='project_sep']" position="after"> <xpath expr='//separator[@name="project_sep"]' position='after'>
<field name="use_phases"/> <field name="use_phases"/>
</xpath> </xpath>
</field> </field>