diff options
| author | Rajesh Prajapati (OpenERP) <rpr@tinyerp.com> | 2012-10-05 17:35:03 +0530 |
|---|---|---|
| committer | Rajesh Prajapati (OpenERP) <rpr@tinyerp.com> | 2012-10-05 17:35:03 +0530 |
| commit | cdff4611b0a588546afb9b706bbd2d0fbda7bf2f (patch) | |
| tree | 0a0a99b33e52547987ab69b2a29f3ec23c188142 /addons/project | |
| parent | 7202b8f7efbc76e2a40b1a4a8d7a95ed0d2ce573 (diff) | |
| parent | ba97319054728490e4d8a601382dd6fd2ab4f970 (diff) | |
[MERGE] merge with main addons
bzr revid: rpr@tinyerp.com-20121005120503-07e0zo8ucv8k0q3s
Diffstat (limited to 'addons/project')
| -rw-r--r-- | addons/project/i18n/nl.po | 8 | ||||
| -rw-r--r-- | addons/project/project.py | 62 | ||||
| -rw-r--r-- | addons/project/project_data.xml | 40 | ||||
| -rw-r--r-- | addons/project/project_view.xml | 59 | ||||
| -rw-r--r-- | addons/project/wizard/project_task_reevaluate.py | 2 |
5 files changed, 100 insertions, 71 deletions
diff --git a/addons/project/i18n/nl.po b/addons/project/i18n/nl.po index f543f48834e..f8c8bc84ba9 100644 --- a/addons/project/i18n/nl.po +++ b/addons/project/i18n/nl.po @@ -7,14 +7,14 @@ msgstr "" "Project-Id-Version: OpenERP Server 6.0dev\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2012-02-08 01:37+0100\n" -"PO-Revision-Date: 2012-06-28 12:50+0000\n" +"PO-Revision-Date: 2012-09-29 14:57+0000\n" "Last-Translator: Erwin <Unknown>\n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-09-21 04:42+0000\n" -"X-Generator: Launchpad (build 15985)\n" +"X-Launchpad-Export-Date: 2012-09-30 04:44+0000\n" +"X-Generator: Launchpad (build 16049)\n" #. module: project #: view:report.project.task.user:0 @@ -1326,7 +1326,7 @@ msgstr "" #. module: project #: view:project.task:0 msgid "Delegation" -msgstr "" +msgstr "Delegeren" #. module: project #: model:ir.model,name:project.model_res_users diff --git a/addons/project/project.py b/addons/project/project.py index 3572fd094b3..6b02a018293 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -55,7 +55,6 @@ class project_task_type(osv.osv): } _order = 'sequence' - def short_name(name): """Keep first word(s) of name to make it small enough but distinctive""" @@ -191,7 +190,6 @@ class project(osv.osv): # Lambda indirection method to avoid passing a copy of the overridable method when declaring the field _alias_models = lambda self, *args, **kwargs: self._get_alias_models(*args, **kwargs) - _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."), @@ -311,11 +309,12 @@ class project(osv.osv): task_obj.duplicate_task(cr, uid, map_task_id, context=context) return True - def copy(self, cr, uid, id, default={}, context=None): + def copy(self, cr, uid, id, default=None, context=None): if context is None: context = {} + if default is None: + default = {} - default = default or {} context['active_test'] = False default['state'] = 'open' default['tasks'] = [] @@ -509,6 +508,8 @@ def Project(): model_name=vals.get('alias_model', 'project.task'), context=context) vals['alias_id'] = alias_id + if vals.get('partner_id', False): + vals['type'] = 'contract' project_id = super(project, self).create(cr, uid, vals, context) mail_alias.write(cr, uid, [vals['alias_id']], {'alias_defaults': {'project_id': project_id} }, context) self.create_send_note(cr, uid, [project_id], context=context) @@ -518,20 +519,16 @@ def Project(): return self.message_post(cr, uid, ids, body=_("Project has been <b>created</b>."), context=context) def set_open_send_note(self, cr, uid, ids, context=None): - message = _("Project has been <b>opened</b>.") - return self.message_post(cr, uid, ids, body=message, context=context) + return self.message_post(cr, uid, ids, body=_("Project has been <b>opened</b>."), context=context) def set_pending_send_note(self, cr, uid, ids, context=None): - message = _("Project is now <b>pending</b>.") - return self.message_post(cr, uid, ids, body=message, context=context) + return self.message_post(cr, uid, ids, body=_("Project is now <b>pending</b>."), context=context) def set_cancel_send_note(self, cr, uid, ids, context=None): - message = _("Project has been <b>cancelled</b>.") - return self.message_post(cr, uid, ids, body=message, context=context) + return self.message_post(cr, uid, ids, body=_("Project has been <b>canceled</b>."), context=context) def set_close_send_note(self, cr, uid, ids, context=None): - message = _("Project has been <b>closed</b>.") - return self.message_post(cr, uid, ids, body=message, context=context) + return self.message_post(cr, uid, ids, body=_("Project has been <b>closed</b>."), context=context) def write(self, cr, uid, ids, vals, context=None): # if alias_model has been changed, update alias_model_id accordingly @@ -648,12 +645,12 @@ class task(base_stage, osv.osv): res[task.id]['progress'] = 100.0 return res - def onchange_remaining(self, cr, uid, ids, remaining=0.0, planned = 0.0): + def onchange_remaining(self, cr, uid, ids, remaining=0.0, planned=0.0): if remaining and not planned: return {'value':{'planned_hours': remaining}} return {} - def onchange_planned(self, cr, uid, ids, planned = 0.0, effective = 0.0): + def onchange_planned(self, cr, uid, ids, planned=0.0, effective=0.0): return {'value':{'remaining_hours': planned - effective}} def onchange_project(self, cr, uid, id, project_id): @@ -684,13 +681,14 @@ class task(base_stage, osv.osv): #FIXME why there is already the copy and the old one self.write(cr, uid, new, {'parent_ids':[(6,0,set(parent_ids))], 'child_ids':[(6,0, set(child_ids))]}) - def copy_data(self, cr, uid, id, default={}, context=None): + def copy_data(self, cr, uid, id, default=None, context=None): + if default is None: + default = {} default = default or {} default.update({'work_ids':[], 'date_start': False, 'date_end': False, 'date_deadline': False}) if not default.get('remaining_hours', False): default['remaining_hours'] = float(self.read(cr, uid, id, ['planned_hours'])['planned_hours']) default['active'] = True - default['stage_id'] = False if not default.get('name', False): default['name'] = self.browse(cr, uid, id, context=context).name or '' if not context.get('copy',False): @@ -698,7 +696,6 @@ class task(base_stage, osv.osv): default.update({'name':new_name}) return super(task, self).copy_data(cr, uid, id, default, context) - def _is_template(self, cr, uid, ids, field_name, arg, context=None): res = {} for task in self.browse(cr, uid, ids, context=context): @@ -768,7 +765,7 @@ class task(base_stage, osv.osv): }), 'user_id': fields.many2one('res.users', 'Assigned to'), 'delegated_user_id': fields.related('child_ids', 'user_id', type='many2one', relation='res.users', string='Delegated To'), - 'partner_id': fields.many2one('res.partner', 'Contact'), + 'partner_id': fields.many2one('res.partner', 'Customer'), 'work_ids': fields.one2many('project.task.work', 'task_id', 'Work done'), 'manager_id': fields.related('project_id', 'analytic_account_id', 'user_id', type='many2one', relation='res.users', string='Project Manager'), 'company_id': fields.many2one('res.company', 'Company'), @@ -776,7 +773,6 @@ class task(base_stage, osv.osv): 'color': fields.integer('Color Index'), 'user_email': fields.related('user_id', 'email', type='char', string='User Email', readonly=True), } - _defaults = { 'stage_id': _get_default_stage_id, 'project_id': _get_default_project_id, @@ -789,7 +785,6 @@ class task(base_stage, osv.osv): 'user_id': lambda obj, cr, uid, context: uid, 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'project.task', context=c), } - _order = "priority, sequence, date_start, name, id" def set_priority(self, cr, uid, ids, priority, *args): @@ -852,9 +847,8 @@ class task(base_stage, osv.osv): (_check_recursion, 'Error ! You cannot create recursive tasks.', ['parent_ids']), (_check_dates, 'Error ! Task end-date must be greater then task start-date', ['date_start','date_end']) ] - # + # Override view according to the company definition - # def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): users_obj = self.pool.get('res.users') if context is None: context = {} @@ -886,9 +880,9 @@ class task(base_stage, osv.osv): res['fields'][f]['string'] = res['fields'][f]['string'].replace('Hours',tm) return res - # **************************************** + # ---------------------------------------- # Case management - # **************************************** + # ---------------------------------------- def stage_find(self, cr, uid, cases, section_id, domain=[], order='sequence', context=None): """ Override of the base.stage method @@ -1020,10 +1014,12 @@ class task(base_stage, osv.osv): new_attachment_ids.append(attachment.copy(cr, uid, attachment_id, default={'res_id': delegated_task_id}, context=context)) return new_attachment_ids - def do_delegate(self, cr, uid, ids, delegate_data={}, context=None): + def do_delegate(self, cr, uid, ids, delegate_data=None, context=None): """ Delegate Task to another users. """ + if delegate_data is None: + delegate_data = {} assert delegate_data['user_id'], _("Delegated User should be specified") delegated_tasks = {} for task in self.browse(cr, uid, ids, context=context): @@ -1100,6 +1096,11 @@ class task(base_stage, osv.osv): def create(self, cr, uid, vals, context=None): task_id = super(task, self).create(cr, uid, vals, context=context) + task_record = self.browse(cr, uid, task_id, context=context) + if task_record.project_id: + project_follower_ids = [follower.id for follower in task_record.project_id.message_follower_ids] + self.message_subscribe(cr, uid, [task_id], project_follower_ids, + context=context) self._store_history(cr, uid, [task_id], context=context) self.create_send_note(cr, uid, [task_id], context=context) return task_id @@ -1109,6 +1110,9 @@ class task(base_stage, osv.osv): def write(self, cr, uid, ids, vals, context=None): if isinstance(ids, (int, long)): ids = [ids] + if vals.get('project_id'): + project_id = self.pool.get('project.project').browse(cr, uid, vals.get('project_id'), context=context) + vals['message_follower_ids'] = [(4, follower.id) for follower in project_id.message_follower_ids] if vals and not 'kanban_state' in vals and 'stage_id' in vals: new_stage = vals.get('stage_id') vals_reset_kstate = dict(vals, kanban_state='normal') @@ -1162,7 +1166,7 @@ class task(base_stage, osv.osv): return result # --------------------------------------------------- - # mail gateway + # Mail gateway # --------------------------------------------------- def message_new(self, cr, uid, msg, custom_values=None, context=None): @@ -1228,14 +1232,14 @@ class task(base_stage, osv.osv): def stage_set_send_note(self, cr, uid, ids, stage_id, context=None): """ Override of the (void) default notification method. """ stage_name = self.pool.get('project.task.type').name_get(cr, uid, [stage_id], context=context)[0][1] - return self.message_post(cr, uid, ids, body= _("Stage changed to <b>%s</b>.") % (stage_name), context=context) + return self.message_post(cr, uid, ids, body=_("Stage changed to <b>%s</b>.") % (stage_name), + context=context) def create_send_note(self, cr, uid, ids, context=None): return self.message_post(cr, uid, ids, body=_("Task has been <b>created</b>."), context=context) def case_draft_send_note(self, cr, uid, ids, context=None): - msg = _('Task has been set as <b>draft</b>.') - return self.message_post(cr, uid, ids, body=msg, context=context) + return self.message_post(cr, uid, ids, body=_('Task has been set as <b>draft</b>.'), context=context) def do_delegation_send_note(self, cr, uid, ids, context=None): for task in self.browse(cr, uid, ids, context=context): diff --git a/addons/project/project_data.xml b/addons/project/project_data.xml index 5cc4c99df1b..560c1c3552a 100644 --- a/addons/project/project_data.xml +++ b/addons/project/project_data.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> - <data noupdate="1"> + <data> <!-- This will set the unit of measure used in projects and tasks.--> <record id="base.main_company" model="res.company"> <field name="project_time_mode_id" ref="product.product_uom_hour"></field> @@ -72,7 +72,7 @@ </record> <record id="project_tt_deployment" model="project.task.type"> <field name="sequence">7</field> - <field name="name">Deployment</field> + <field name="name">Done</field> <field name="state">done</field> <field name="case_default" eval="True"/> </record> @@ -84,6 +84,42 @@ <field name="fold" eval="True"/> </record> + <!-- mail: subtypes --> + <record id="mt_project_new" model="mail.message.subtype"> + <field name="name">New Task</field> + <field name="res_model">project.project</field> + <field name="default" eval="False"/> + </record> + <record id="mt_project_closed" model="mail.message.subtype"> + <field name="name">Task Closed</field> + <field name="res_model">project.project</field> + </record> + <record id="mt_project_canceled" model="mail.message.subtype"> + <field name="name">Task Canceled</field> + <field name="res_model">project.task</field> + </record> + <record id="mt_project_stage" model="mail.message.subtype"> + <field name="name">Task Stage Changed</field> + <field name="res_model">project.task</field> + </record> + + <record id="mt_task_new" model="mail.message.subtype"> + <field name="name">New Task</field> + <field name="res_model">project.task</field> + </record> + <record id="mt_task_closed" model="mail.message.subtype"> + <field name="name">Task Closed</field> + <field name="res_model">project.task</field> + </record> + <record id="mt_task_canceled" model="mail.message.subtype"> + <field name="name">Task canceled</field> + <field name="res_model">project.task</field> + </record> + <record id="mt_task_change" model="mail.message.subtype"> + <field name="name">Task Stage Changed</field> + <field name="res_model">project.task</field> + </record> + <!-- notify all employees of module installation --> <record model="mail.message" id="module_install_notification"> <field name="model">mail.group</field> diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 83d3414f74e..bd63eec84c5 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -10,15 +10,14 @@ <menuitem id="menu_project_management" name="Project" parent="base.menu_main_pm" sequence="1"/> <menuitem id="base.menu_definitions" name="Configuration" parent="base.menu_main_pm" sequence="60"/> - - <act_window - context="{'search_default_project_id': [active_id], 'default_project_id': active_id}" - id="act_project_project_2_project_task_all" - name="Tasks" - res_model="project.task" - src_model="project.project" - view_mode="kanban,tree,form,calendar,graph" - view_type="form"/> + + <record id="act_project_project_2_project_task_all" model="ir.actions.act_window"> + <field name="res_model">project.task</field> + <field name="view_type">form</field> + <field name="name">Tasks</field> + <field name="view_mode">kanban,tree,form,calendar,graph</field> + <field name="context">{'search_default_project_id': [active_id], 'default_project_id': active_id}</field> + </record> <!-- Project Read/Unread actions --> <record id="actions_server_project_unread" model="ir.actions.server"> @@ -93,12 +92,12 @@ </div> <group> <group> + <field name="privacy_visibility"/> <field name="user_id" string="Project Manager" attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"/> - <field name="partner_id" string="Contact" on_change="onchange_partner_id(partner_id)"/> </group> <group> - <field name="privacy_visibility"/> - <field name="analytic_account_id" readonly="1" required="0"/> + <field name="partner_id" on_change="onchange_partner_id(partner_id)"/> + <field name="analytic_account_id" readonly="1" required="0" attrs="{'invisible': [('analytic_account_id','=',False)]}"/> </group> </group> <notebook> @@ -122,14 +121,14 @@ </field> </page> <page string="Other Info"> - <group string="Email Interface" colspan="2"> - <div attrs="{'invisible': [('alias_domain', '=', False)]}"> - <field name="alias_id" invisible="1" required="0"/> - <label for="alias_name" class="oe_edit_only "/> - <field name="alias_name" class="oe_inline" attrs="{'required': [('alias_id', '!=', False)]}"/>@<field name="alias_domain" class="oe_inline"/> - </div> - </group> <group> + <group string="Email Interface" attrs="{'invisible': [('alias_domain', '=', False)]}"> + <div> + <field name="alias_id" invisible="1" required="0"/> + <label for="alias_name" class="oe_edit_only "/> + <field name="alias_name" class="oe_inline" attrs="{'required': [('alias_id', '!=', False)]}"/>@<field name="alias_domain" class="oe_inline"/> + </div> + </group> <group string="Administration" groups="project.group_time_work_estimation_tasks"> <field name="planned_hours" widget="float_time"/> <field name="effective_hours" widget="float_time"/> @@ -137,8 +136,7 @@ </group> <group string="Miscellaneous" name="misc"> <field name="date"/> - <field name="parent_id" domain="[('id','!=',analytic_account_id)]" context="{'current_model': 'project.project'}"/> - <field name="priority"/> + <field name="priority" groups="base.group_no_one"/> <field name="active" attrs="{'invisible':[('state','in',['open', 'pending', 'template'])]}"/> <field name="currency_id" groups="base.group_multi_currency" required="1"/> @@ -153,7 +151,7 @@ </sheet> <div class="oe_chatter"> <field name="message_ids" widget="mail_thread"/> - <field name="message_follower_ids" widget="mail_followers"/> + <field name="message_follower_ids" widget="mail_followers" help="Follow this project to automatically follow all related tasks and issues."/> </div> </form> </field> @@ -207,15 +205,6 @@ </field> </record> - <act_window - context="{'search_default_project_id': active_id, 'default_project_id': active_id}" - id="act_project_project_2_project_task_all" - name="Tasks" - res_model="project.task" - src_model="project.project" - view_mode="kanban,tree,form,calendar,graph" - view_type="form"/> - <record model="ir.ui.view" id="view_project_kanban"> <field name="name">project.project.kanban</field> <field name="model">project.project</field> @@ -250,7 +239,7 @@ <a t-if="record.use_tasks.raw_value" name="%(act_project_project_2_project_task_all)d" type="action"> <field name="task_count"/> Tasks</a> </div> <div class="oe_kanban_footer_left"> - <span> + <span groups="project.group_time_work_estimation_tasks"> <span class="oe_e">R</span> <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"/> </span> @@ -529,7 +518,7 @@ <div class="oe_kanban_content"> <div><b><field name="name"/></b></div> <div> - <field name="project_id"/> + <field name="project_id"/><br/> <t t-esc="kanban_text_ellipsis(record.description.value, 160)"/><br/> <t t-if="record.date_deadline.raw_value and record.date_deadline.raw_value lt (new Date())" t-set="red">oe_kanban_text_red</t> <span t-attf-class="#{red || ''}"><i><field name="date_deadline"/></i></span> @@ -723,7 +712,7 @@ </record> <record id="ir_project_task_open" model="ir.values"> - <field eval=" 'tree_but_open'" name="key2"/> + <field eval="'tree_but_open'" name="key2"/> <field eval="'project.project'" name="model"/> <field name="name">View project's tasks</field> <field eval="'ir.actions.act_window,'+str(dblc_proj)" name="value"/> @@ -767,7 +756,7 @@ <field name="model">project.task.type</field> <field name="arch" type="xml"> <tree string="Task Stage"> - <field name="sequence"/> + <field name="sequence" widget="handle"/> <field name="name"/> <field name="state"/> </tree> diff --git a/addons/project/wizard/project_task_reevaluate.py b/addons/project/wizard/project_task_reevaluate.py index 382c9d64361..b00c531717f 100644 --- a/addons/project/wizard/project_task_reevaluate.py +++ b/addons/project/wizard/project_task_reevaluate.py @@ -26,7 +26,7 @@ from tools.translate import _ class project_task_reevaluate(osv.osv_memory): _name = 'project.task.reevaluate' - def _get_remaining(self,cr, uid, context=None): + def _get_remaining(self, cr, uid, context=None): if context is None: context = {} active_id = context.get('active_id', False) |
