[FIX] account_analytic_analysis: recurring invoice line description and yearly interval
authorDenis Ledoux <dle@openerp.com>
Fri, 23 May 2014 09:16:46 +0000 (11:16 +0200)
committerDenis Ledoux <dle@openerp.com>
Fri, 23 May 2014 09:16:46 +0000 (11:16 +0200)
the product_id_change name is reset if name is not passed to method args
the product_id_change call in account_analytic_view set name as false so it is reset each time the product is change
the yearly interval add a year to the next recurring date instead of one month

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

index 76b68a7..4034ee5 100644 (file)
@@ -82,7 +82,7 @@ class account_analytic_invoice_line(osv.osv):
         if not name:
             name = self.pool.get('product.product').name_get(cr, uid, [res.id], context=local_context)[0][1]
             if res.description_sale:
-                result['name'] += '\n'+res.description_sale
+                name += '\n'+res.description_sale
 
         result.update({'name': name or False,'uom_id': uom_id or res.uom_id.id or False, 'price_unit': price})
 
@@ -750,6 +750,8 @@ class account_analytic_account(osv.osv):
                     new_date = next_date+relativedelta(days=+interval)
                 elif contract.recurring_rule_type == 'weekly':
                     new_date = next_date+relativedelta(weeks=+interval)
+                elif contract.recurring_rule_type == 'yearly':
+                    new_date = next_date+relativedelta(years=+interval)
                 else:
                     new_date = next_date+relativedelta(months=+interval)
                 self.write(cr, uid, [contract.id], {'recurring_next_date': new_date.strftime('%Y-%m-%d')}, context=context)
index a6fe828..1e2d757 100644 (file)
                     <div attrs="{'invisible': [('recurring_invoices','=',False)]}">
                         <field name="recurring_invoice_line_ids">
                             <tree string="Account Analytic Lines" editable="bottom">
-                                <field name="product_id" on_change="product_id_change(product_id, uom_id, quantity, name, parent.partner_id, price_unit, parent.pricelist_id, parent.company_id)"/>
+                                <field name="product_id" on_change="product_id_change(product_id, uom_id, quantity, False, parent.partner_id, price_unit, parent.pricelist_id, parent.company_id)"/>
                                 <field name="name"/>
                                 <field name="quantity"/>
                                 <field name="uom_id"/>