[IMP]remove open_model method from project related module and add action as per required

bzr revid: sgo@tinyerp.com-20120508092143-ah3siaudwp7jixc8
This commit is contained in:
Sanjay Gohel (Open ERP) 2012-05-08 14:51:43 +05:30
parent 38fd7fa19d
commit a6a7276d89
14 changed files with 35 additions and 104 deletions

View File

@ -203,6 +203,9 @@ class project(osv.osv):
'color': fields.integer('Color Index'),
'company_uom_id': fields.related('company_id', 'project_time_mode_id', type='many2one', relation='product.uom'),
}
def dummy(self, cr, uid,ids,context):
return False
def _get_type_common(self, cr, uid, context):
ids = self.pool.get('project.task.type').search(cr, uid, [('project_default','=',1)], context=context)

View File

@ -16,7 +16,6 @@ openerp.project = function(openerp) {
});
});
// set sequence like Tasks,Issues,Timesheets and Phases
my_list = $("#list a")
my_list.sort(function (a, b) {
@ -26,8 +25,16 @@ openerp.project = function(openerp) {
});
$('#list').replaceWith(my_list);
//if task is true , then open the task when click on the anywhere in the box.
if(this.record.use_tasks.raw_value)$(this.$element).find('.click_button').attr('data-name',my_list[0].getAttribute('data-name'));
//it opens action in sequence which ever is first.
if (my_list.length!=0){
$(this.$element).find('.click_button').attr('data-name',my_list[0].getAttribute('data-name'));
}
else{
$(this.$element).find('.click_button').attr('data-name','dummy');
}
if(isNaN(parseInt($(this.$element).find('.click_button').attr('data-name')))){
$(this.$element).find('.click_button').attr('data-type',"object")
}
/* set background color.
we can do other way to implement new widget.

View File

@ -64,7 +64,6 @@ and decide on their status as they evolve.
'installable': True,
'auto_install': False,
'application': True,
'js': ['static/src/js/project_issue.js'],
'certificate' : '001236490750848623845',
}

View File

@ -536,28 +536,6 @@ class project(osv.osv):
'use_issues' : True,
}
def open_issues(self, cr, uid, ids, context=None):
#Open the View for the Tasks for the project
"""
This opens Issues views
@return :Dictionary value for issue view
"""
if context is None:
context = {}
if ids:
context = dict(context, search_default_project_id=ids[0])
return {
'name': _('Issue'),
'view_type': 'form',
'view_mode': 'kanban,tree,calendar,form',
'res_model': 'project.issue',
'view_id': False,
'domain':[('project_id','in',ids)],
'context': context,
'type': 'ir.actions.act_window',
'nodestroy': True
}
def _check_escalation(self, cr, uid, ids, context=None):
project_obj = self.browse(cr, uid, ids[0], context=context)
if project_obj.project_escalation_id:

View File

@ -45,16 +45,6 @@
<field name="act_window_id" ref="project_issue_categ_act0"/>
</record>
<act_window
context="{'search_default_project_id': [active_id], 'default_project_id': active_id}"
id="act_project_project_2_project_issue_all"
name="Issues"
res_model="project.issue"
src_model="project.project"
view_mode="tree,form,calendar,graph"
view_type="form"/>
<menuitem name="Issues" id="menu_project_issue_track" parent="project.menu_project_management"
action="project_issue_categ_act0" sequence="15"/>
</data>

View File

@ -334,6 +334,15 @@
</search>
</field>
</record>
<act_window
context="{'search_default_project_id': [active_id], 'default_project_id': active_id}"
id="act_project_project_2_project_issue_all"
name="Issues"
res_model="project.issue"
src_model="project.project"
view_mode="kanban,tree,form,calendar,graph"
view_type="form"/>
# ------------------------------------------------------
# Project
@ -367,7 +376,7 @@
</field>
<xpath expr="//div[@id='list']" position="inside">
<t t-if="record.use_issues.raw_value">
<a id="2" name="open_issues" class="oe_project_buttons" type="object"><t t-if="record.issue_count.value &lt;= 1">Issue</t><t t-if="record.issue_count.value > 1">Issues</t>(<t t-esc="record.issue_count.value"/>)</a>
<a id="2" name="%(act_project_project_2_project_issue_all)d" class="oe_project_buttons" type="action"><t t-if="record.issue_count.value &lt;= 1">Issue</t><t t-if="record.issue_count.value > 1">Issues</t>(<t t-esc="record.issue_count.value"/>)</a>
</t>
</xpath>
</field>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -1,13 +0,0 @@
openerp.project_issue = function(openerp) {
openerp.web_kanban.ProjectIssueKanban = openerp.web_kanban.KanbanRecord.include({
bind_events: function() {
self = this;
self._super();
if(this.view.dataset.model == 'project.project') {
if(this.record.use_tasks.raw_value && this.record.use_issues.raw_value)$(this.$element).find('.click_button').attr('data-name','open_tasks');
if(!this.record.use_tasks.raw_value && this.record.use_issues.raw_value)$(this.$element).find('.click_button').attr('data-name','open_issues');
};
}
});
}

View File

@ -234,28 +234,7 @@ class project(osv.osv):
_defaults = {
'use_phases' : True,
}
def open_phase(self, cr, uid, ids, context=None):
#Open the View for the Tasks for the project
"""
This opens Tasks views
@return :Dictionary value for task view
"""
if context is None:
context = {}
if ids:
context = dict(context, search_default_project_id=ids[0])
return {
'name': _('Phase'),
'view_type': 'form',
'view_mode': 'tree,calendar,form',
'res_model': 'project.phase',
'view_id': False,
'domain':[('project_id','in',ids)],
'context': context,
'type': 'ir.actions.act_window',
'nodestroy': True
}
def schedule_phases(self, cr, uid, ids, context=None):
context = context or {}
if type(ids) in (long, int,):

View File

@ -110,6 +110,16 @@
</field>
</record>
<act_window
context="{'search_default_project_id': active_id, 'default_project_id': active_id}"
id="act_project_phases"
name="Phases"
res_model="project.phase"
src_model="project.project"
view_mode="tree,form"
view_type="form"
/>
<record id="view_project_kanban_phase" model="ir.ui.view">
<field name="name">project.project.kanban.inherited</field>
<field name="model">project.project</field>
@ -122,7 +132,7 @@
</field>
<xpath expr="//div[@id='list']" position="inside">
<t t-if="record.use_phases.raw_value">
<a id="4" name="open_phase" class="oe_project_buttons" type="object"><t t-if="record.phase_count.value &lt;= 1">Phase</t><t t-if="record.phase_count.value > 1">Phases</t>(<t t-esc="record.phase_count.value"/>)</a>
<a id="4" name="%(act_project_phases)d" class="oe_project_buttons" type="action"><t t-if="record.phase_count.value &lt;= 1">Phase</t><t t-if="record.phase_count.value > 1">Phases</t>(<t t-esc="record.phase_count.value"/>)</a>
</t>
</xpath>
</field>
@ -357,16 +367,6 @@
view_mode="tree,form"
/>
<act_window
context="{'search_default_project_id': active_id, 'default_project_id': active_id}"
id="act_project_phases"
name="Phases"
res_model="project.phase"
src_model="project.project"
view_mode="tree,form"
view_type="form"
/>
# ------------------------------------------------------
# Menu Items
# ------------------------------------------------------

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@ -44,7 +44,6 @@ the Timesheet line entries for particular date and particular user with the eff
],
'installable': True,
'auto_install': False,
'js': ['static/src/js/project_timesheet.js'],
'certificate': '0075123647453',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -1,20 +0,0 @@
openerp.project_timesheet = function(openerp) {
openerp.web_kanban.ProjectTimeSheetKanban = openerp.web_kanban.KanbanRecord.include({
bind_events: function() {
self = this;
self._super();
if(this.view.dataset.model == 'project.project') {
function include(arr, obj) {
for(var i=0; i<arr.length; i++) {
if (arr[i] == obj) return true;
}
}
if(include(this.view.fields_keys,"issues"))
{
if(!this.record.use_tasks.raw_value && !this.record.use_issues.raw_value && this.record.use_timesheets.raw_value)$(this.$element).find('.click_button').attr('data-name','open_timesheets');
};
if(this.record.use_tasks.raw_value && this.record.use_timesheets.raw_value)$(this.$element).find('.click_button').attr('data-name','open_tasks');
};
}
});
}