[FIX] account_analytic_analysis: revert method signature change made at rev 9277
authorMartin Trigaux <mat@openerp.com>
Thu, 8 May 2014 08:39:48 +0000 (10:39 +0200)
committerMartin Trigaux <mat@openerp.com>
Thu, 8 May 2014 08:39:48 +0000 (10:39 +0200)
The additional parameters were made to avoid overwriting values when changing of template.
As we can not add parameters in only one module, we overwrite values only for not saved records.
This mitigates the overwrite while not changing the API.

bzr revid: mat@openerp.com-20140508083948-gkk7d1250a8znhlt

addons/account_analytic_analysis/account_analytic_analysis.py
addons/account_analytic_analysis/account_analytic_analysis_view.xml

index 6c71f94..785d7cd 100644 (file)
@@ -542,18 +542,17 @@ class account_analytic_account(osv.osv):
             'nodestroy': True,
         }
 
-    def on_change_template(self, cr, uid, ids, template_id, date_start=False, fix_price_invoices=False, invoice_on_timesheets=False, recurring_invoices=False, context=None):
+    def on_change_template(self, cr, uid, ids, template_id, date_start=False, context=None):
         if not template_id:
             return {}
-        obj_analytic_line = self.pool.get('account.analytic.invoice.line')
         res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, date_start=date_start, context=context)
 
         template = self.browse(cr, uid, template_id, context=context)
         
-        if not fix_price_invoices:
+        if not ids:
             res['value']['fix_price_invoices'] = template.fix_price_invoices
             res['value']['amount_max'] = template.amount_max
-        if not invoice_on_timesheets:
+        if not ids:
             res['value']['invoice_on_timesheets'] = template.invoice_on_timesheets
             res['value']['hours_qtt_est'] = template.hours_qtt_est
         
@@ -561,7 +560,7 @@ class account_analytic_account(osv.osv):
             res['value']['to_invoice'] = template.to_invoice.id
         if template.pricelist_id.id:
             res['value']['pricelist_id'] = template.pricelist_id.id
-        if not recurring_invoices:
+        if not ids:
             invoice_line_ids = []
             for x in template.recurring_invoice_line_ids:
                 invoice_line_ids.append((0, 0, {
index 97fb15e..a6fe828 100644 (file)
@@ -38,9 +38,6 @@
                 <field name="partner_id" position="attributes">
                     <attribute name="attrs">{'required': [('type','=','contract'),'|','|',('fix_price_invoices','=',True), ('invoice_on_timesheets', '=', True), ('recurring_invoices', '=', True)]}</attribute>
                 </field>
-                <field name="template_id" position="attributes">
-                    <attribute name="on_change">on_change_template(template_id, date_start, fix_price_invoices, invoice_on_timesheets, recurring_invoices)</attribute>
-                </field>
                 <xpath expr='//group[@name="invoice_on_timesheets"]' position="replace">
                 </xpath>
                 <xpath expr='//separator[@name="description"]' position='before'>