diff options
| author | apa-tiny (apa@tinyerp.com) <> | 2012-05-07 14:45:23 +0530 |
|---|---|---|
| committer | apa-tiny (apa@tinyerp.com) <> | 2012-05-07 14:45:23 +0530 |
| commit | ceed601f3bd3d4dacbc0ea6134198c2be01eba94 (patch) | |
| tree | 32162f71a0e903b4b30a831f748cacba710012fa | |
| parent | c43e5dfe7e57e73d60d5e3ca2320ea52958726b2 (diff) | |
| parent | bfd96de42bc942fa24158a8c87b9e905c2460b72 (diff) | |
[MERGE]:Technically improvement suggested by rco.
bzr revid: apa@tinyerp.com-20120507091523-6e164ijjnd134g4f
| -rw-r--r-- | addons/project/project.py | 18 | ||||
| -rw-r--r-- | addons/project/project_view.xml | 12 | ||||
| -rw-r--r-- | addons/project/static/src/js/project.js | 4 | ||||
| -rw-r--r-- | addons/project_issue/project_issue.py | 8 | ||||
| -rw-r--r-- | addons/project_issue/project_issue_view.xml | 17 | ||||
| -rw-r--r-- | addons/project_issue/static/src/js/project_issue.js | 4 | ||||
| -rw-r--r-- | addons/project_long_term/project_long_term.py | 8 | ||||
| -rw-r--r-- | addons/project_long_term/project_long_term_view.xml | 14 | ||||
| -rw-r--r-- | addons/project_timesheet/project_timesheet.py | 8 | ||||
| -rw-r--r-- | addons/project_timesheet/project_timesheet_view.xml | 14 | ||||
| -rw-r--r-- | addons/project_timesheet/static/src/js/project_timesheet.js | 4 |
11 files changed, 50 insertions, 61 deletions
diff --git a/addons/project/project.py b/addons/project/project.py index 27370363140..29816f5f922 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -155,7 +155,7 @@ class project(osv.osv): raise osv.except_osv(_('Operation Not Permitted !'), _('You cannot delete a project containing tasks. I suggest you to desactivate it.')) return super(project, self).unlink(cr, uid, ids, *args, **kwargs) - def _open_task(self, cr, uid, ids, field_name, arg, context=None): + def _task_count(self, cr, uid, ids, field_name, arg, context=None): open_task={} task_pool=self.pool.get('project.task') for id in ids: @@ -163,14 +163,6 @@ class project(osv.osv): open_task[id] = len(task_ids) return open_task - def company_uom_id(self, cr, uid, ids, field_name, arg, context=None): - uom_company = {} - for project in self.browse(cr,uid,ids): - user_browse = self.pool.get('res.users').browse(cr,uid,project.user_id.id) - uom_company[project.id] = project.company_id.project_time_mode_id.name or user_browse.company_id.project_time_mode_id.name - return uom_company - - _columns = { 'complete_name': fields.function(_complete_name, string="Project Name", type='char', size=250), 'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the project without removing it."), @@ -207,10 +199,10 @@ class project(osv.osv): 'warn_header': fields.text('Mail Header', help="Header added at the beginning of the email for the warning message sent to the customer when a task is closed.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}), 'warn_footer': fields.text('Mail Footer', help="Footer added at the beginning of the email for the warning message sent to the customer when a task is closed.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}), 'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}), - 'task': fields.boolean('Task',help = "If you check this field tasks appears in kanban view"), - 'open_task': fields.function(_open_task , type='integer',string="Open Tasks"), + 'use_tasks': fields.boolean('Task',help = "If you check this field tasks appears in kanban view"), + 'task_count': fields.function(_task_count , type='integer',string="Open Tasks"), 'color': fields.integer('Color Index'), - 'company_uom_id': fields.function(company_uom_id,type="char"), + 'company_uom_id': fields.related('company_id', 'project_time_mode_id', type='many2one', relation='product.uom'), } def dummy(self, cr, uid, ids, context=None): return False @@ -247,7 +239,7 @@ class project(osv.osv): 'priority': 1, 'sequence': 10, 'type_ids': _get_type_common, - 'task' : True, + 'use_tasks' : True, } # TODO: Why not using a SQL contraints ? diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 1b317d671ca..a9886e3b1c7 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -45,7 +45,7 @@ <page string="Administration"> <group col="2" colspan="2" name="kanban"> <separator colspan="2" string="Project Management"/> - <field name="task"/> + <field name="use_tasks"/> </group> <group col="2" colspan="2"> <separator colspan="4" string="Performance"/> @@ -172,11 +172,11 @@ <field name="date"/> <field name="name"/> <field name="members"/> - <field name="task"/> + <field name="use_tasks"/> <field name="user_id"/> <field name="date"/> <field name="color"/> - <field name="open_task"/> + <field name="task_count"/> <templates> <t t-name="kanban-box"> <div class="project_vignettes"> @@ -198,8 +198,8 @@ </ul> <h4><t t-esc="record.name.value.substr(0,33)"/><t t-if="record.name.value.length > 33">...</t></h4> <div id="list"> - <t t-if="record.task.raw_value"> - <a id="1" name="open_tasks" class="oe_project_buttons" type="object"><t t-if="record.open_task.value <= 1"> Task</t><t t-if="record.open_task.value > 1"> Tasks</t>(<t t-esc="record.open_task.value"/>)</a> + <t t-if="record.use_tasks.raw_value"> + <a id="1" name="open_tasks" class="oe_project_buttons" type="object"><t t-if="record.task_count.value <= 1"> Task</t><t t-if="record.task_count.value > 1"> Tasks</t>(<t t-esc="record.task_count.value"/>)</a> </t> </div> <br/> @@ -216,7 +216,7 @@ <tr> <th align="left" width="70px">Progress</th> <td align="left"> - <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"/>s + <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"/> </td> </tr> </table> diff --git a/addons/project/static/src/js/project.js b/addons/project/static/src/js/project.js index 5365e0b0942..001777103d6 100644 --- a/addons/project/static/src/js/project.js +++ b/addons/project/static/src/js/project.js @@ -17,8 +17,8 @@ openerp.project = function(openerp) { }); //if task is true , then open the task when click on the anywhere in the box. - if(this.record.task.raw_value)$(this.$element).find('.click_button').attr('data-name','open_tasks'); - if(!this.record.task.raw_value)$(this.$element).find('.click_button').attr('data-name','dummy'); + if(this.record.use_tasks.raw_value)$(this.$element).find('.click_button').attr('data-name','open_tasks'); + if(!this.record.use_tasks.raw_value)$(this.$element).find('.click_button').attr('data-name','dummy'); // set sequence like Tasks,Issues,Timesheets and Phases my_list = $("#list a") diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 575d51e7b1c..db2ad97b414 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -517,7 +517,7 @@ project_issue() class project(osv.osv): _inherit = "project.project" - def _compute_issue(self, cr, uid, ids, field_name, arg, context=None): + def _issue_count(self, cr, uid, ids, field_name, arg, context=None): res={} issue_pool=self.pool.get('project.issue') for project in self.browse(cr, uid, ids, context=context): @@ -528,12 +528,12 @@ class project(osv.osv): _columns = { 'project_escalation_id' : fields.many2one('project.project','Project Escalation', help='If any issue is escalated from the current Project, it will be listed under the project selected here.', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}), 'reply_to' : fields.char('Reply-To Email Address', size=256), - 'issues' : fields.boolean('Issues',help = "If you check this field issues are appears in kanban view"), - 'total_issues': fields.function(_compute_issue , type='integer',string="Issue"), + 'use_issues' : fields.boolean('Issues',help = "If you check this field issues are appears in kanban view"), + 'issue_count': fields.function(_issue_count , type='integer'), } _defaults = { - 'issues' : True, + 'use_issues' : True, } def open_issues(self, cr, uid, ids, context=None): diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index f9290e5c7e1..66ad9c04e30 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -345,8 +345,8 @@ <field name="type">form</field> <field name="inherit_id" ref="project.edit_project"/> <field name="arch" type="xml"> - <xpath expr="//field[@name='task']" position="after"> - <field name="issues"/> + <xpath expr="//field[@name='use_tasks']" position="after"> + <field name="use_issues"/> </xpath> <field name="priority" position="before"> <field name="project_escalation_id"/> @@ -361,19 +361,16 @@ <field name="type">kanban</field> <field name="inherit_id" ref="project.view_project_kanban"/> <field name="arch" type="xml"> - <field name="task" position="after"> - <field name="issues"/> - <field name="total_issues" invisible="1"/> + <field name="use_tasks" position="after"> + <field name="use_issues"/> + <field name="issue_count" invisible="1"/> </field> <xpath expr="//div[@id='list']" position="inside"> - <t t-if="record.issues.raw_value"> - <a id="2" name="open_issues" class="oe_project_buttons" type="object"><t t-if="record.total_issues.value <= 1">Issue</t><t t-if="record.total_issues.value > 1">Issues</t>(<t t-esc="record.total_issues.value"/>)</a> + <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 <= 1">Issue</t><t t-if="record.issue_count.value > 1">Issues</t>(<t t-esc="record.issue_count.value"/>)</a> </t> </xpath> </field> </record> - - - </data> </openerp> diff --git a/addons/project_issue/static/src/js/project_issue.js b/addons/project_issue/static/src/js/project_issue.js index 61ee078bd0d..b0433055160 100644 --- a/addons/project_issue/static/src/js/project_issue.js +++ b/addons/project_issue/static/src/js/project_issue.js @@ -4,8 +4,8 @@ openerp.project_issue = function(openerp) { self = this; self._super(); if(this.view.dataset.model == 'project.project') { - if(this.record.task.raw_value && this.record.issues.raw_value)$(this.$element).find('.click_button').attr('data-name','open_tasks'); - if(!this.record.task.raw_value && this.record.issues.raw_value)$(this.$element).find('.click_button').attr('data-name','open_issues'); + 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'); }; } diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py index 7806bc0abb9..582a5ed8ef0 100644 --- a/addons/project_long_term/project_long_term.py +++ b/addons/project_long_term/project_long_term.py @@ -217,7 +217,7 @@ project_user_allocation() class project(osv.osv): _inherit = "project.project" - def _open_phase(self, cr, uid, ids, field_name, arg, context=None): + def _phase_count(self, cr, uid, ids, field_name, arg, context=None): open_phase={} phase_pool=self.pool.get('project.phase') for id in ids: @@ -227,12 +227,12 @@ class project(osv.osv): _columns = { 'phase_ids': fields.one2many('project.phase', 'project_id', "Project Phases"), - 'phases' : fields.boolean('Phase',help = "If you check this field Phases are appears in kanban view"), - 'open_phases' : fields.function(_open_phase , type='integer',string="Open Phases"), + 'use_phases' : fields.boolean('Phase',help = "If you check this field Phases are appears in kanban view"), + 'phase_count' : fields.function(_phase_count , type='integer',string="Open Phases"), } _defaults = { - 'phases' : True, + 'use_phases' : True, } def open_phase(self, cr, uid, ids, context=None): #Open the View for the Tasks for the project diff --git a/addons/project_long_term/project_long_term_view.xml b/addons/project_long_term/project_long_term_view.xml index 1f258ff2ead..f5dcb48576d 100644 --- a/addons/project_long_term/project_long_term_view.xml +++ b/addons/project_long_term/project_long_term_view.xml @@ -104,8 +104,8 @@ <field name="type">form</field> <field name="inherit_id" ref="project.edit_project"/> <field name="arch" type="xml"> - <xpath expr="//field[@name='task']" position="after"> - <field name="phases"/> + <xpath expr="//field[@name='use_tasks']" position="after"> + <field name="use_phases"/> </xpath> </field> </record> @@ -116,13 +116,13 @@ <field name="type">kanban</field> <field name="inherit_id" ref="project.view_project_kanban"/> <field name="arch" type="xml"> - <field name="task" position="after"> - <field name="phases"/> - <field name="open_phases"/> + <field name="use_tasks" position="after"> + <field name="use_phases"/> + <field name="phase_count"/> </field> <xpath expr="//div[@id='list']" position="inside"> - <t t-if="record.phases.raw_value"> - <a id="4" name="open_phase" class="oe_project_buttons" type="object"><t t-if="record.open_phases.value <= 1">Phase</t><t t-if="record.open_phases.value > 1">Phases</t>(<t t-esc="record.open_phases.value"/>)</a> + <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 <= 1">Phase</t><t t-if="record.phase_count.value > 1">Phases</t>(<t t-esc="record.phase_count.value"/>)</a> </t> </xpath> </field> diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index 59cb4be9321..9a718e08acc 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -48,7 +48,7 @@ class project_project(osv.osv): return res - def _compute_timesheet(self, cr, uid, ids, field_name, arg, context=None): + def _timesheet_count(self, cr, uid, ids, field_name, arg, context=None): res={} aal_pool=self.pool.get('account.analytic.line') for project in self.browse(cr, uid, ids, context=context): @@ -57,13 +57,13 @@ class project_project(osv.osv): return res _columns = { - 'timesheets' : fields.boolean('Timesheets',help = "If you check this field timesheets appears in kanban view"), + 'use_timesheets' : fields.boolean('Timesheets',help = "If you check this field timesheets appears in kanban view"), 'amt_to_invoice': fields.function(_to_invoice,string="Amount to Invoice",multi="sums"), 'hrs_to_invoice': fields.function(_to_invoice,string="Hours to Invoice",multi="sums"), - 'total_timesheet': fields.function(_compute_timesheet , type='integer',string="Issue"), + 'timesheet_count': fields.function(_timesheet_count , type='integer',string="Issue"), } _defaults = { - 'timesheets' : True, + 'use_timesheets' : True, } def onchange_partner_id(self, cr, uid, ids, part=False, context=None): diff --git a/addons/project_timesheet/project_timesheet_view.xml b/addons/project_timesheet/project_timesheet_view.xml index 0efc228136d..6ac8afcfaf8 100644 --- a/addons/project_timesheet/project_timesheet_view.xml +++ b/addons/project_timesheet/project_timesheet_view.xml @@ -7,8 +7,8 @@ <field name="type">form</field> <field name="inherit_id" ref="project.edit_project"/> <field name="arch" type="xml"> - <xpath expr="//field[@name='task']" position='after'> - <field name="timesheets"/> + <xpath expr="//field[@name='use_tasks']" position='after'> + <field name="use_timesheets"/> <field name="amt_to_invoice" invisible="True"/> <field name="hrs_to_invoice" invisible="True"/> </xpath> @@ -31,14 +31,14 @@ <field name="type">kanban</field> <field name="inherit_id" ref="project.view_project_kanban"/> <field name="arch" type="xml"> - <field name="task" position="after"> - <field name="timesheets" context="{'search_default_account_id': project_id, 'default_account_id': project_id}"/> - <field name="total_timesheet"/> + <field name="use_tasks" position="after"> + <field name="use_timesheets" context="{'search_default_account_id': project_id, 'default_account_id': project_id}"/> + <field name="timesheet_count"/> <field name="currency_id"/> </field> <xpath expr="//div[@id='list']" position="inside"> - <t t-if="record.timesheets.raw_value"> - <a id="3" name="open_timesheets" class="oe_project_buttons" type="object"><t t-if="record.total_timesheet.value <= 1">Timesheet</t><t t-if="record.total_timesheet.value > 1">Timesheets</t>(<t t-esc="record.total_timesheet.value"/>)</a> + <t t-if="record.use_timesheets.raw_value"> + <a id="3" name="open_timesheets" class="oe_project_buttons" type="object"><t t-if="record.timesheet_count.value <= 1">Timesheet</t><t t-if="record.timesheet_count.value > 1">Timesheets</t>(<t t-esc="record.timesheet_count.value"/>)</a> </t> </xpath> diff --git a/addons/project_timesheet/static/src/js/project_timesheet.js b/addons/project_timesheet/static/src/js/project_timesheet.js index ef8bbc02f2e..3eff53a8651 100644 --- a/addons/project_timesheet/static/src/js/project_timesheet.js +++ b/addons/project_timesheet/static/src/js/project_timesheet.js @@ -11,9 +11,9 @@ openerp.project_timesheet = function(openerp) { } if(include(this.view.fields_keys,"issues")) { - if(!this.record.task.raw_value && !this.record.issues.raw_value && this.record.timesheets.raw_value)$(this.$element).find('.click_button').attr('data-name','open_timesheets'); + 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.task.raw_value && this.record.timesheets.raw_value)$(this.$element).find('.click_button').attr('data-name','open_tasks'); + if(this.record.use_tasks.raw_value && this.record.use_timesheets.raw_value)$(this.$element).find('.click_button').attr('data-name','open_tasks'); }; } }); |
