Sanjay Gohel (Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-project-gallery-apa-fields-improvement-sgo
 into lp:~openerp-dev/openobject-addons/trunk-project-gallery-apa.

Requested reviews:
  Amit Patel (OpenERP) (apa-tiny)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-project-gallery-apa-fields-improvement-sgo/+merge/104874

hello sir,
  I have made following changes.
1. rename field names which is as follows in related module
    task            -> use_tasks   
    open_task       -> task_count  
    issues          -> use_issues
    total_issues    -> issue_count
    phases          -> use_phases
    open_phases     -> phase_count
    timesheets      -> use_timesheets
    total_timesheet -> timesheet_count

2. Make the field 'company_uom_id' a fields a related to product.uom
 remove the extra 's' from that company_uom_id

Thank you
SGO
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-project-gallery-apa-fields-improvement-sgo/+merge/104874
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-project-gallery-apa.
=== modified file 'project/project.py'
--- project/project.py	2012-04-25 11:55:19 +0000
+++ project/project.py	2012-05-07 07:34:27 +0000
@@ -155,7 +155,7 @@
                 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 @@
             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 @@
         '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 @@
         'priority': 1,
         'sequence': 10,
         'type_ids': _get_type_common,
-        'task' : True,
+        'use_tasks' : True,
     }
 
     # TODO: Why not using a SQL contraints ?

=== modified file 'project/project_view.xml'
--- project/project_view.xml	2012-04-27 06:27:25 +0000
+++ project/project_view.xml	2012-05-07 07:34:27 +0000
@@ -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 &lt;= 1"> Task</t><t t-if="record.open_task.value &gt; 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 &lt;= 1"> Task</t><t t-if="record.task_count.value &gt; 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>

=== modified file 'project/static/src/js/project.js'
--- project/static/src/js/project.js	2012-04-27 06:31:52 +0000
+++ project/static/src/js/project.js	2012-05-07 07:34:27 +0000
@@ -17,8 +17,8 @@
                  });
                 
                 //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")

=== modified file 'project_issue/project_issue.py'
--- project_issue/project_issue.py	2012-04-24 11:33:21 +0000
+++ project_issue/project_issue.py	2012-05-07 07:34:27 +0000
@@ -517,7 +517,7 @@
 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 @@
     _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):

=== modified file 'project_issue/project_issue_view.xml'
--- project_issue/project_issue_view.xml	2012-04-27 06:27:25 +0000
+++ project_issue/project_issue_view.xml	2012-05-07 07:34:27 +0000
@@ -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 &lt;= 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 &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>
         </record>
-        
-        
-
     </data>
 </openerp>

=== modified file 'project_issue/static/src/js/project_issue.js'
--- project_issue/static/src/js/project_issue.js	2012-04-10 12:44:14 +0000
+++ project_issue/static/src/js/project_issue.js	2012-05-07 07:34:27 +0000
@@ -4,8 +4,8 @@
             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');
             };
             	
         }

=== modified file 'project_long_term/project_long_term.py'
--- project_long_term/project_long_term.py	2012-04-24 11:33:21 +0000
+++ project_long_term/project_long_term.py	2012-05-07 07:34:27 +0000
@@ -217,7 +217,7 @@
 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 @@
      
     _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

=== modified file 'project_long_term/project_long_term_view.xml'
--- project_long_term/project_long_term_view.xml	2012-04-30 10:49:34 +0000
+++ project_long_term/project_long_term_view.xml	2012-05-07 07:34:27 +0000
@@ -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 &lt;= 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 &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>

=== modified file 'project_timesheet/project_timesheet.py'
--- project_timesheet/project_timesheet.py	2012-04-30 11:15:21 +0000
+++ project_timesheet/project_timesheet.py	2012-05-07 07:34:27 +0000
@@ -48,7 +48,7 @@
             
         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 @@
         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):

=== modified file 'project_timesheet/project_timesheet_view.xml'
--- project_timesheet/project_timesheet_view.xml	2012-04-30 10:49:34 +0000
+++ project_timesheet/project_timesheet_view.xml	2012-05-07 07:34:27 +0000
@@ -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 &lt;= 1">Timesheet</t><t t-if="record.total_timesheet.value &gt; 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 &lt;= 1">Timesheet</t><t t-if="record.timesheet_count.value &gt; 1">Timesheets</t>(<t t-esc="record.timesheet_count.value"/>)</a>
 		    </t>
 		</xpath>
 

=== modified file 'project_timesheet/static/src/js/project_timesheet.js'
--- project_timesheet/static/src/js/project_timesheet.js	2012-04-10 12:42:25 +0000
+++ project_timesheet/static/src/js/project_timesheet.js	2012-05-07 07:34:27 +0000
@@ -11,9 +11,9 @@
 		}
             	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');
             };
         }
     });

_______________________________________________
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