[FIX] project_issue: correctly update alias

When choosing use tasks / use issues, correctly update the project alias. Indeed
only the use issues checkbox had an onchange. This revision adds the onchange
on use tasks so that the method correctly computes the new alias destination model.

Also updated the _get_alias_models method to be more modular instead of hardcoding
values. Call super.
This commit is contained in:
Thibault Delavallée 2015-11-18 14:17:24 +01:00
parent 2831d94c20
commit f57e580f2d
2 changed files with 6 additions and 1 deletions

View File

@ -464,7 +464,9 @@ class project(osv.Model):
_inherit = "project.project"
def _get_alias_models(self, cr, uid, context=None):
return [('project.task', "Tasks"), ("project.issue", "Issues")]
res = super(project, self)._get_alias_models(cr, uid, context=context)
res.append(("project.issue", "Issues"))
return res
def _issue_count(self, cr, uid, ids, field_name, arg, context=None):
Issue = self.pool['project.issue']

View File

@ -294,6 +294,9 @@
<field name="model">project.project</field>
<field name="inherit_id" ref="project.edit_project"/>
<field name="arch" type="xml">
<xpath expr='//field[@name="use_tasks"]' position='attributes'>
<attribute name="on_change">on_change_use_tasks_or_issues(use_tasks, use_issues)</attribute>
</xpath>
<xpath expr='//div[@name="options_active"]' position='inside'>
<field name="use_issues" class="oe_inline"
on_change="on_change_use_tasks_or_issues(use_tasks, use_issues)"/>