Divyesh Makwana(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-addons_issue_account_analytic_analysis-mdi
 into lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons_issue_account_analytic_analysis-mdi/+merge/116262

Hello Sir,

I have improved the following things:

If you use a 'Template of Contract', it does not take into account, the Task 
Management, Issues Tracking, Time-sheets checkbox even if it is True in 
Template.

Thanks,
Divyesh
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons_issue_account_analytic_analysis-mdi/+merge/116262
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-addons_issue_account_analytic_analysis-mdi.
=== modified file 'account_analytic_analysis/account_analytic_analysis.py'
--- account_analytic_analysis/account_analytic_analysis.py	2012-06-26 09:48:43 +0000
+++ account_analytic_analysis/account_analytic_analysis.py	2012-07-23 12:23:24 +0000
@@ -455,7 +455,6 @@
         'invoice_on_timesheets' : fields.boolean("Invoice On Timesheets"),
         'month_ids': fields.function(_analysis_all, multi='analytic_analysis', type='many2many', relation='account_analytic_analysis.summary.month', string='Month'),
         'user_ids': fields.function(_analysis_all, multi='analytic_analysis', type="many2many", relation='account_analytic_analysis.summary.user', string='User'),
-        'template_id': fields.many2one('account.analytic.account', 'Template of Contract'),
         'hours_qtt_est': fields.float('Estimation of Hours to Invoice'),
         'est_total' : fields.function(_sum_of_fields, type="float",multi="sum_of_all", string="Total Estimation"),
         'invoiced_total' : fields.function(_sum_of_fields, type="float",multi="sum_of_all", string="Total Invoiced"),
@@ -483,18 +482,15 @@
     def on_change_template(self, cr, uid, ids, template_id, context=None):
         if not template_id:
             return {}
-        res = {'value':{}}
-        template = self.browse(cr, uid, template_id, context=context)
-        res['value']['date_start'] = template.date_start
-        res['value']['date'] = template.date
-        res['value']['fix_price_invoices'] = template.fix_price_invoices
-        res['value']['invoice_on_timesheets'] = template.invoice_on_timesheets
-        res['value']['quantity_max'] = template.quantity_max
-        res['value']['hours_qtt_est'] = template.hours_qtt_est
-        res['value']['amount_max'] = template.amount_max
-        res['value']['to_invoice'] = template.to_invoice.id
-        res['value']['pricelist_id'] = template.pricelist_id.id
-        res['value']['description'] = template.description
+        res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context)
+        if template_id and 'value' in res:
+            template = self.browse(cr, uid, template_id, context=context)
+            res['value']['fix_price_invoices'] = template.fix_price_invoices
+            res['value']['invoice_on_timesheets'] = template.invoice_on_timesheets
+            res['value']['hours_qtt_est'] = template.hours_qtt_est
+            res['value']['amount_max'] = template.amount_max
+            res['value']['to_invoice'] = template.to_invoice.id
+            res['value']['pricelist_id'] = template.pricelist_id.id
         return res
 account_analytic_account()
 

=== modified file 'account_analytic_analysis/account_analytic_analysis_view.xml'
--- account_analytic_analysis/account_analytic_analysis_view.xml	2012-06-26 11:02:35 +0000
+++ account_analytic_analysis/account_analytic_analysis_view.xml	2012-07-23 12:23:24 +0000
@@ -20,9 +20,6 @@
             <field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
             <field eval="40" name="priority"/>
             <field name="arch" type="xml">
-                <xpath expr='//field[@name="type"]' position='after'>
-                    <field name="template_id" on_change="on_change_template(template_id,context)"  domain="[('type','=','template')]" attrs="{'invisible': [('type','in',['view', 'normal','template'])]}" context="{'default_type' : 'template'}"/>
-                </xpath>
                 <xpath expr='//div[@name="duration"]' position="after" version="7.0">
                     <label for="quantity_max"/>
                     <div>

=== modified file 'account_analytic_analysis/security/ir.model.access.csv'
--- account_analytic_analysis/security/ir.model.access.csv	2012-07-06 15:08:17 +0000
+++ account_analytic_analysis/security/ir.model.access.csv	2012-07-23 12:23:24 +0000
@@ -3,5 +3,3 @@
 access_account_analytic_analysis_summary_month_sale,account_analytic_analysis.summary.month sale,model_account_analytic_analysis_summary_month,base.group_sale_salesman,1,0,0,0
 access_account_analytic_analysis_summary_user,account_analytic_analysis.summary.user,model_account_analytic_analysis_summary_user,account.group_account_manager,1,0,0,0
 access_account_analytic_analysis_summary_month,account_analytic_analysis.summary.month,model_account_analytic_analysis_summary_month,account.group_account_manager,1,0,0,0
-access_account_analytic_analysis_summary_user_project_user,account_analytic_analysis.summary.user project,model_account_analytic_analysis_summary_user,project.group_project_user,1,0,0,0
-access_account_analytic_analysis_summary_month_project_user,account_analytic_analysis.summary.month project,model_account_analytic_analysis_summary_month,project.group_project_user,1,0,0,0

=== modified file 'analytic/analytic.py'
--- analytic/analytic.py	2012-06-26 15:12:40 +0000
+++ analytic/analytic.py	2012-07-23 12:23:24 +0000
@@ -161,6 +161,7 @@
                                   "The type 'Analytic account' stands for usual accounts that you only want to use in accounting.\n"\
                                   "If you select Contract or Project, it offers you the possibility to manage the validity and the invoicing options for this account.\n"\
                                   "The special type 'Template of Project' allows you to define a template with default data that you can reuse easily."),
+        'template_id': fields.many2one('account.analytic.account', 'Template of Contract'),
         'description': fields.text('Description'),
         'parent_id': fields.many2one('account.analytic.account', 'Parent Analytic Account', select=2),
         'child_ids': fields.one2many('account.analytic.account', 'parent_id', 'Child Accounts'),
@@ -184,6 +185,17 @@
             }, string='Currency', type='many2one', relation='res.currency'),
     }
     
+    def on_change_template(self, cr, uid, ids, template_id, context=None):
+        if not template_id:
+            return {}
+        res = {'value':{}}
+        template = self.browse(cr, uid, template_id, context=context)
+        res['value']['date_start'] = template.date_start
+        res['value']['date'] = template.date
+        res['value']['quantity_max'] = template.quantity_max
+        res['value']['description'] = template.description
+        return res
+    
     def on_change_partner_id(self, cr, uid, ids,partner_id, name, context={}):
         res={}
         if partner_id:

=== modified file 'analytic/analytic_view.xml'
--- analytic/analytic_view.xml	2012-07-13 09:53:41 +0000
+++ analytic/analytic_view.xml	2012-07-23 12:23:24 +0000
@@ -18,6 +18,7 @@
                                 <field name="partner_id" on_change="on_change_partner_id(partner_id, name)" attrs="{'required':[('type','=','contract')]}"/>
                                 <field name="parent_id" on_change="on_change_parent(parent_id)" attrs="{'invisible': [('type','in',['contract','template'])]}"/>
                                 <field name="type"/>
+                                <field name="template_id" on_change="on_change_template(template_id,context)" domain="[('type','=','template')]" attrs="{'invisible': [('type','in',['view', 'normal','template'])]}" context="{'default_type' : 'template'}"/>
                             </group>
                             <group>
                                 <field name="code"/>

=== modified file 'hr_timesheet/hr_timesheet.py'
--- hr_timesheet/hr_timesheet.py	2012-05-31 09:27:54 +0000
+++ hr_timesheet/hr_timesheet.py	2012-07-23 12:23:24 +0000
@@ -198,6 +198,13 @@
     _columns = {
         'use_timesheets': fields.boolean('Timesheets', help="Check this field if this project manages timesheets"),
     }
+    
+    def on_change_template(self, cr, uid, ids, template_id, context=None):
+        res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context)
+        if template_id and 'value' in res:
+            template = self.browse(cr, uid, template_id, context=context)
+            res['value']['use_timesheets'] = template.use_timesheets
+        return res
 
 account_analytic_account()
 

=== modified file 'project/project.py'
--- project/project.py	2012-07-21 18:23:18 +0000
+++ project/project.py	2012-07-23 12:23:24 +0000
@@ -1225,6 +1225,13 @@
         'use_tasks': fields.boolean('Tasks Mgmt.',help="If check,this contract will be available in the project menu and you will be able to manage tasks or track issues"),
         'company_uom_id': fields.related('company_id', 'project_time_mode_id', type='many2one', relation='product.uom'),
     }
+    
+    def on_change_template(self, cr, uid, ids, template_id, context=None):
+        res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context)
+        if template_id and 'value' in res:
+            template = self.browse(cr, uid, template_id, context=context)
+            res['value']['use_tasks'] = template.use_tasks
+        return res
 
     def _trigger_project_creation(self, cr, uid, vals, context=None):
         '''

=== modified file 'project_issue/project_issue.py'
--- project_issue/project_issue.py	2012-07-09 08:18:34 +0000
+++ project_issue/project_issue.py	2012-07-23 12:23:24 +0000
@@ -593,6 +593,13 @@
         'use_issues' : fields.boolean('Issues Tracking', help="Check this field if this project manages issues"),
     }
     
+    def on_change_template(self, cr, uid, ids, template_id, context=None):
+        res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context)
+        if template_id and 'value' in res:
+            template = self.browse(cr, uid, template_id, context=context)
+            res['value']['use_issues'] = template.use_issues
+        return res
+    
     def _trigger_project_creation(self, cr, uid, vals, context=None):
         res = super(account_analytic_account, self)._trigger_project_creation(cr, uid, vals, context=context)
         return res or vals.get('use_issues')

_______________________________________________
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