Harry (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-project-10-click-rga into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-project-10-click-rga/+merge/132656
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-project-10-click-rga/+merge/132656
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-project-10-click-rga.
=== modified file 'project/project.py'
--- project/project.py	2012-10-24 20:14:24 +0000
+++ project/project.py	2012-11-02 08:26:22 +0000
@@ -178,7 +178,18 @@
         res =  super(project, self).unlink(cr, uid, ids, *args, **kwargs)
         mail_alias.unlink(cr, uid, alias_ids, *args, **kwargs)
         return res
-
+    
+    def _get_attached_docs(self, cr, uid, ids, field_name, arg, context):
+        res = {}
+        attachment = self.pool.get('ir.attachment')
+        task = self.pool.get('project.task')
+        for id in ids:
+            project_attachments = attachment.search(cr, uid, [('res_model', '=', 'project.project'), ('res_id', 'in', [id])], context=context)
+            task_ids = task.search(cr, uid, [('project_id', 'in', [id])])
+            task_attachments = attachment.search(cr, uid, [('res_model', '=', 'project.task'), ('res_id', 'in', task_ids)], context=context)
+            res[id] = len(project_attachments + task_attachments)
+        return res
+        
     def _task_count(self, cr, uid, ids, field_name, arg, context=None):
         res = dict.fromkeys(ids, 0)
         task_ids = self.pool.get('project.task').search(cr, uid, [('project_id', 'in', ids)])
@@ -189,7 +200,25 @@
     def _get_alias_models(self, cr, uid, context=None):
         """Overriden in project_issue to offer more options"""
         return [('project.task', "Tasks")]
-
+    
+    def attachment_tree_view(self, cr, uid, ids, context):
+        attachment = self.pool.get('ir.attachment')
+        project_attachments = attachment.search(cr, uid, [('res_model', '=', 'project.project'), ('res_id', 'in', ids)], context=context)
+        task_ids = self.pool.get('project.task').search(cr, uid, [('project_id', 'in', ids)])
+        task_attachments = attachment.search(cr, uid, [('res_model', '=', 'project.task'), ('res_id', 'in', task_ids)], context=context)
+        all_attachment = project_attachments + task_attachments
+        res_id = ids and ids[0] or False
+        return {
+                'name': _('Attachments'),
+                'domain': [('id','in', all_attachment)],
+                'res_model': 'ir.attachment',
+                'type': 'ir.actions.act_window',
+                'view_id': False,
+                'view_mode': 'tree,form',
+                'view_type': 'form',
+                'limit': 80,
+                'context': "{'default_res_model': '%s','default_res_id': %d}" % (self._name, res_id)
+             }
     # 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 = {
@@ -232,6 +261,7 @@
                                         help="The kind of document created when an email is received on this project's email alias"),
         'privacy_visibility': fields.selection([('public','Public'), ('followers','Followers Only')], 'Privacy / Visibility', required=True),
         'state': fields.selection([('template', 'Template'),('draft','New'),('open','In Progress'), ('cancelled', 'Cancelled'),('pending','Pending'),('close','Closed')], 'Status', required=True,),
+        'doc_count':fields.function(_get_attached_docs, string="Number of documents attached", type='int')
      }
 
     def _get_type_common(self, cr, uid, context):
@@ -728,11 +758,11 @@
                       If the case needs to be reviewed then the status is \
                       set to \'Pending\'.'),
         'categ_ids': fields.many2many('project.category', string='Tags'),
-        'kanban_state': fields.selection([('normal', 'Normal'),('blocked', 'Blocked'),('done', 'Ready To Pull')], 'Kanban State',
+        'kanban_state': fields.selection([('normal', 'Normal'),('blocked', 'Blocked'),('done', 'Ready for next stage')], 'Kanban State',
                                          help="A task's kanban state indicates special situations affecting it:\n"
                                               " * Normal is the default situation\n"
                                               " * Blocked indicates something is preventing the progress of this task\n"
-                                              " * Ready To Pull indicates the task is ready to be pulled to the next stage",
+                                              " * Ready for next stage indicates the task is ready to be pulled to the next stage",
                                          readonly=True, required=False),
         'create_date': fields.datetime('Create Date', readonly=True,select=True),
         'date_start': fields.datetime('Starting Date',select=True),
@@ -792,6 +822,11 @@
         """
         return self.write(cr, uid, ids, {'priority' : priority})
 
+    def set_very_high_priority(self, cr, uid, ids, *args):
+        """Set task priority to very high
+        """
+        return self.set_priority(cr, uid, ids, '0')
+    
     def set_high_priority(self, cr, uid, ids, *args):
         """Set task priority to high
         """
@@ -1398,7 +1433,7 @@
         'task_id': fields.many2one('project.task', 'Task', ondelete='cascade', required=True, select=True),
         'type_id': fields.many2one('project.task.type', 'Stage'),
         'state': fields.selection([('draft', 'New'), ('cancelled', 'Cancelled'),('open', 'In Progress'),('pending', 'Pending'), ('done', 'Done')], 'Status'),
-        'kanban_state': fields.selection([('normal', 'Normal'),('blocked', 'Blocked'),('done', 'Ready To Pull')], 'Kanban State', required=False),
+        'kanban_state': fields.selection([('normal', 'Normal'),('blocked', 'Blocked'),('done', 'Ready for next stage')], 'Kanban State', required=False),
         'date': fields.date('Date', select=True),
         'end_date': fields.function(_get_date, string='End Date', type="date", store={
             'project.task.history': (_get_related_date, None, 20)

=== modified file 'project/project_view.xml'
--- project/project_view.xml	2012-10-29 15:25:57 +0000
+++ project/project_view.xml	2012-11-02 08:26:22 +0000
@@ -63,8 +63,8 @@
             <field name="arch" type="xml">
                 <form string="Project" version="7.0">
                 <header>
+                    <button name="set_open" string="Re-open project" type="object" states="pending" class="oe_highlight"/>
                     <button name="set_done" string="Close Project" type="object" states="open,pending"/>
-                    <button name="set_open" string="Re-open project" type="object" states="pending" class="oe_highlight"/>
                     <button name="set_open" string="Re-open project" type="object" states="cancelled,close"/>
                     <button name="set_pending" string="Pending" type="object" states="open"/>
                     <button name="set_template" string="Set as Template" type="object" states="open"/>
@@ -88,7 +88,7 @@
                     <div class="oe_right oe_button_box" name="buttons">
                         <button name="%(act_project_project_2_project_task_all)d" string="Tasks"
                             type="action" attrs="{'invisible':[('use_tasks','=', 0)]}"/>
-                        <button name="%(base.action_attachment)d" string="Documents" type="action"/>
+                        <button name="attachment_tree_view" string="Documents" type="object"/>
                     </div>
                     <group>
                         <group>
@@ -223,6 +223,7 @@
                     <field name="task_count"/>
                     <field name="alias_id"/>
                     <field name="alias_domain"/>
+                    <field name="doc_count"/>
                     <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_global_click">
@@ -240,6 +241,9 @@
                                     <div class="oe_kanban_project_list">
                                         <a t-if="record.use_tasks.raw_value" name="%(act_project_project_2_project_task_all)d" type="action" style="margin-right: 10px"> <field name="task_count"/> Tasks</a>
                                     </div>
+                                    <div class="oe_kanban_project_list">
+                                        <a t-if="record.doc_count.raw_value" name="attachment_tree_view" type="object" style="margin-right: 10px"> <field name="doc_count"/> Documents</a>
+                                    </div>
                                     <div class="oe_kanban_footer_left">
                                         <span groups="project.group_time_work_estimation_tasks">
                                             <span class="oe_e">R</span>
@@ -389,7 +393,7 @@
                                 states="cancelled,done" context="{'button_reactivate':True}" groups="base.group_user"/>
                         <button name="action_close" string="Done" type="object"
                                 states="draft,open,pending" groups="base.group_user"/>
-                        <button name="do_cancel" string="Cancel" type="object"
+                        <button name="do_cancel" string="Cancel Task" type="object"
                                 states="draft,open,pending" groups="base.group_user"/>
                         <field name="stage_id" widget="statusbar" clickable="True"/>
                     </header>
@@ -403,12 +407,15 @@
                             <field name="project_id"  on_change="onchange_project(project_id)" context="{'default_use_tasks':1}"/>
                             <field name="user_id" attrs="{'readonly':[('state','in',['done', 'cancelled'])]}" options='{"no_open": True}'/>
                             <field name="company_id" groups="base.group_multi_company" widget="selection"/>
+                            <field name="planned_hours" widget="float_time"
+                                    groups="project.group_time_work_estimation_tasks"
+                                    on_change="onchange_planned(planned_hours, effective_hours)"/>
                         </group>
                         <group>
                             <field name="date_deadline" attrs="{'readonly':[('state','in',['done', 'cancelled'])]}"/>
                             <field name="categ_ids" widget="many2many_tags"/>
                             <field name="progress" widget="progressbar"
-                                groups="project.group_time_work_estimation_tasks"/>
+                                groups="project.group_time_work_estimation_tasks" attrs="{'invisible':[('state','=','cancelled')]}"/>
                         </group>
                     </group>
                     <notebook>
@@ -458,9 +465,6 @@
                                 <field name="priority" groups="base.group_user"/>
                                 <field name="sequence"/>
                                 <field name="partner_id"/>
-                                <field name="planned_hours" widget="float_time" attrs="{'readonly':[('state','!=','draft')]}"
-                                    groups="project.group_time_work_estimation_tasks"
-                                    on_change="onchange_planned(planned_hours, effective_hours)"/>
                                 <field name="state" invisible="1"/>
                             </group>
                         </page>
@@ -525,10 +529,11 @@
                                 </div>
                                 <div class="oe_kanban_bottom_right">
                                     <a t-if="record.kanban_state.raw_value === 'normal'" type="object" string="In Progress" name="set_kanban_state_done" class="oe_kanban_status"> </a>
-                                    <a t-if="record.kanban_state.raw_value === 'done'" type="object" string="Stage Done" name="set_kanban_state_blocked" class="oe_kanban_status oe_kanban_status_green"> </a>
+                                    <a t-if="record.kanban_state.raw_value === 'done'" type="object" string="Ready for next stage" name="set_kanban_state_blocked" class="oe_kanban_status oe_kanban_status_green"> </a>
                                     <a t-if="record.kanban_state.raw_value === 'blocked'" type="object" string="Blocked" name="set_kanban_state_normal" class="oe_kanban_status oe_kanban_status_red"> </a>
-                                    <a t-if="record.priority.raw_value == 1" type="object" string="Priority" name="set_normal_priority" class="oe_e oe_star_on">7</a>
-                                    <a t-if="record.priority.raw_value != 1" type="object" string="Priority" name="set_high_priority" class="oe_e oe_star_off">7</a>
+                                    <a t-if="record.priority.raw_value == 2" type="object" string="Important" name="set_very_high_priority" class="oe_e oe_star_on">7</a>
+                                    <a t-if="record.priority.raw_value == 1 or record.priority.raw_value == 3 or record.priority.raw_value == 4" type="object" string="Normal" name="set_normal_priority" class="oe_e oe_star_off">7</a>
+                                    <a t-if="record.priority.raw_value == 0" type="object" string="Very Important" name="set_high_priority" class="oe_e oe_star_very_high_priority">7</a>
                                     <img t-att-src="kanban_image('res.users', 'image_small', record.user_id.raw_value)" t-att-title="record.user_id.value" width="24" height="24" class="oe_kanban_avatar"/>
                                 </div>
                                 <div class="oe_kanban_footer_left">

=== modified file 'project/static/src/css/project.css'
--- project/static/src/css/project.css	2012-09-12 15:11:51 +0000
+++ project/static/src/css/project.css	2012-11-02 08:26:22 +0000
@@ -2,6 +2,21 @@
   margin: 2px;
 }
 
+.openerp .oe_kanban_view .oe_kanban_content .oe_star_very_high_priority {
+  color: #cccccc;
+  text-shadow: 0 0 2px black;
+  vertical-align: top;
+  position: relative;
+  top: -5px;
+}
+.openerp .oe_kanban_view .oe_kanban_content .oe_star_very_high_priority:hover {
+  text-decoration: none;
+}
+
+.openerp .oe_kanban_view .oe_kanban_content .oe_star_very_high_priority {
+  color: red;
+}
+
 .oe_kanban_project {
     width: 220px;
     min-height: 160px;

=== modified file 'project/static/src/js/project.js'
--- project/static/src/js/project.js	2012-08-24 18:27:43 +0000
+++ project/static/src/js/project.js	2012-11-02 08:26:22 +0000
@@ -57,6 +57,12 @@
             } else if (self.dataset.model === 'project.task') {
                 self.project_display_categ_names();
             }
+        },
+        on_record_moved: function(record, old_group, old_index, new_group, new_index){
+            var self = this;
+            this._super.apply(this, arguments);
+            if(new_group.state.folded)
+                new_group.do_action_toggle_fold();
         }
     });
 
@@ -67,6 +73,10 @@
             } else {
                 this._super.apply(this, arguments);
             }
-        }
+        },
+        bind_events: function() {
+            this._super();
+            this.view.project_display_categ_names();
+        },
     });
 };

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to