[REF] Refectored the fields_view_get hack
bzr revid: jam@tinyerp.com-20120705101331-rjbxvjrbpme9wqrq
This commit is contained in:
parent
dbe2cdd6ee
commit
2bf0978994
|
@ -160,18 +160,6 @@ class crm_case_section(osv.osv):
|
|||
name = record['parent_id'][1] + ' / ' + name
|
||||
res.append((record['id'], name))
|
||||
return res
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
res = super(crm_case_section,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
|
||||
if view_type == 'form':
|
||||
domain = self.pool.get("ir.config_parameter").get_param(cr, uid, "mail.catchall.domain", context=context)
|
||||
if not domain:
|
||||
doc = etree.XML(res['arch'])
|
||||
alias_node = doc.xpath("//div[@name='alias_box']")[0]
|
||||
parent = alias_node.getparent()
|
||||
parent.remove(alias_node)
|
||||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
alias_pool = self.pool.get('mail.alias')
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
<field name="change_responsible"/>
|
||||
<field name="member_ids"/>
|
||||
</group>
|
||||
<group>
|
||||
<group attrs="{'invisible': [('alias_domain', '=', False)]}">
|
||||
<div name="alias_box">
|
||||
<label for="alias_name"/>
|
||||
<field name="alias_name" class="oe_inline" required="0"/>@<field name="alias_domain" class="oe_inline"/>
|
||||
|
|
|
@ -557,18 +557,6 @@ class hr_job(osv.osv):
|
|||
"This Alias MailBox also create and Manage the new Email applicant for this job and also manage the existing applicant email communication."),
|
||||
}
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
res = super(hr_job,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
|
||||
if view_type == 'form':
|
||||
domain = self.pool.get("ir.config_parameter").get_param(cr, uid, "mail.catchall.domain", context=context)
|
||||
if not domain:
|
||||
doc = etree.XML(res['arch'])
|
||||
alias_node = doc.xpath("//div[@name='alias_box']")[0]
|
||||
parent = alias_node.getparent()
|
||||
parent.remove(alias_node)
|
||||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
alias_pool = self.pool.get('mail.alias')
|
||||
if not vals.get('alias_id'):
|
||||
|
|
|
@ -349,7 +349,7 @@
|
|||
</div>
|
||||
</field>
|
||||
<field name="company_id" version="7.0" position="after">
|
||||
<group colspan="4">
|
||||
<group colspan="4" attrs="{'invisible': [('alias_domain', '=', False)]}">
|
||||
<div name="alias_box">
|
||||
<label for="alias_name"/>
|
||||
<field name="alias_name" required="0" class="oe_inline"/>@
|
||||
|
|
|
@ -141,18 +141,6 @@ class mail_group(osv.osv):
|
|||
'photo': _get_default_photo,
|
||||
}
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
res = super(mail_group,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
|
||||
if view_type == 'form':
|
||||
domain = self.pool.get("ir.config_parameter").get_param(cr, uid, "mail.catchall.domain", context=context)
|
||||
if not domain:
|
||||
doc = etree.XML(res['arch'])
|
||||
alias_node = doc.xpath("//div[@name='alias_box']")[0]
|
||||
parent = alias_node.getparent()
|
||||
parent.remove(alias_node)
|
||||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
alias_pool = self.pool.get('mail.alias')
|
||||
if not vals.get('alias_id'):
|
||||
|
|
|
@ -68,11 +68,13 @@
|
|||
<label for="public"/>
|
||||
<field name="public" class="oe_inline"/>
|
||||
</div>
|
||||
<group colspan="4" attrs="{'invisible': [('alias_domain', '=', False)]}">
|
||||
<div name="alias_box">
|
||||
<label for="alias_name"/>
|
||||
<field name="alias_name" required="0" class="oe_inline"/>@<field name="alias_domain" class="oe_inline"/>
|
||||
</div>
|
||||
</group>
|
||||
<field name="description" colspan="4" nolabel="1"/>
|
||||
<div name="alias_box">
|
||||
<label for="alias_name"/>
|
||||
<field name="alias_name" required="0" class="oe_inline"/>@<field name="alias_domain" class="oe_inline"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
|
|
|
@ -60,18 +60,6 @@ class res_users(osv.osv):
|
|||
self.SELF_WRITEABLE_FIELDS.append('notification_email_pref')
|
||||
return init_res
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
res = super(res_users,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
|
||||
if view_type == 'form':
|
||||
domain = self.pool.get("ir.config_parameter").get_param(cr, uid, "mail.catchall.domain", context=context)
|
||||
if not domain:
|
||||
doc = etree.XML(res['arch'])
|
||||
alias_node = doc.xpath("//div[@name='alias_box']")[0]
|
||||
parent = alias_node.getparent()
|
||||
parent.remove(alias_node)
|
||||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
|
||||
def create(self, cr, uid, data, context=None):
|
||||
# create default alias same as the login
|
||||
alias_pool = self.pool.get('mail.alias')
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
</div>
|
||||
</xpath>
|
||||
<field name="active" position="after">
|
||||
<group colspan="2">
|
||||
<group colspan="2" attrs="{'invisible': [('alias_domain', '=', False)]}">
|
||||
<div name="alias_box">
|
||||
<label for="alias_name"/>
|
||||
<field name="alias_name" readonly="1" required="0" class="oe_inline"/>@<field name="alias_domain" class="oe_inline"/>
|
||||
|
|
|
@ -257,23 +257,6 @@ class project(osv.osv):
|
|||
(_check_dates, 'Error! project start-date must be lower then project end-date.', ['date_start', 'date'])
|
||||
]
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
res = super(project,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu)
|
||||
if view_type == 'form' or view_type == 'kanban':
|
||||
domain = self.pool.get("ir.config_parameter").get_param(cr, uid, "mail.catchall.domain", context=context)
|
||||
if not domain:
|
||||
doc = etree.XML(res['arch'])
|
||||
if view_type == "form":
|
||||
model_node = doc.xpath("//group[@string='Mailbox Alias']")[0]
|
||||
parent = model_node.getparent()
|
||||
parent.remove(model_node)
|
||||
else:
|
||||
model_node = doc.xpath("//div[@name='alias_box']")[0]
|
||||
parent = model_node.getparent()
|
||||
parent.remove(model_node)
|
||||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
|
||||
def set_template(self, cr, uid, ids, context=None):
|
||||
res = self.setActive(cr, uid, ids, value=False, context=context)
|
||||
return res
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
<field name="active" attrs="{'invisible':[('state','in',['open', 'pending', 'template'])]}"/>
|
||||
<field name="currency_id" select="1" groups="base.group_multi_company" required="1"/>
|
||||
</group>
|
||||
<group string="Mailbox Alias" colspan="4">
|
||||
<group string="Mailbox Alias" colspan="4" attrs="{'invisible': [('alias_domain', '=', False)]}">
|
||||
<div>
|
||||
<label for="alias_name"/>
|
||||
<field name="alias_name" required="0" class="oe_inline"/>@
|
||||
|
@ -201,6 +201,7 @@
|
|||
<field name="color"/>
|
||||
<field name="task_count"/>
|
||||
<field name="alias_id"/>
|
||||
<field name="alias_domain"/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<div t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_project oe_kanban_auto_height oe_kanban_global_click">
|
||||
|
@ -229,7 +230,7 @@
|
|||
<div>Progress</div>
|
||||
<div><t t-esc="Math.round(record.effective_hours.raw_value)"/> / <t t-esc="Math.round(record.planned_hours.raw_value)"/> <field name="company_uom_id"/></div>
|
||||
</div>
|
||||
<div name="alias_box" t-if="record.alias_id.raw_value" class="oe_kanban_ellipsis">
|
||||
<div name="alias_box" t-if="record.alias_domain.raw_value" class="oe_kanban_ellipsis">
|
||||
Mailbox Alias :
|
||||
<a t-attf-href="mailto:#{record.alias_id.raw_value}"><field name="alias_id"/></a>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue