[IMP]analytic: Improve form view name lable
bzr revid: dbr@tinyerp.com-20120607101400-rlva9kihbbtucqmv
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from lxml import etree
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
@@ -223,6 +224,20 @@ class account_analytic_account(osv.osv):
|
||||
default['line_ids'] = []
|
||||
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):
|
||||
res = super(account_analytic_account, self).fields_view_get(cr, user, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
|
||||
if view_type == 'form':
|
||||
doc = etree.XML(res['arch'])
|
||||
nodes = doc.xpath("//field[@name='name']")
|
||||
if context.get('default_type') == 'contract':
|
||||
for node in nodes:
|
||||
node.set('string', 'Contract/Project Name')
|
||||
if context.get('default_type') == 'template':
|
||||
for node in nodes:
|
||||
node.set('string', 'Template/Project Name')
|
||||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
|
||||
def on_change_company(self, cr, uid, id, company_id):
|
||||
if not company_id:
|
||||
return {}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<form layout="manual">
|
||||
<sheet string="Analytic account" layout="auto">
|
||||
<group colspan="4" col="4" class="oe_form_group_label_border">
|
||||
<field name="name" string="Contract/Project Name"/>
|
||||
<field name="name"/>
|
||||
<field name="partner_id" on_change="on_change_partner_id(partner_id, name)" attrs="{'required':[('type','!=','template')]}"/>
|
||||
<field name="code"/>
|
||||
<field name="user_id"/>
|
||||
|
||||
Reference in New Issue
Block a user