diff options
| author | Martin Trigaux <mat@openerp.com> | 2014-06-10 14:31:36 +0200 |
|---|---|---|
| committer | Martin Trigaux <mat@openerp.com> | 2014-06-10 14:31:36 +0200 |
| commit | 46bf4db8843b88ca6034ffbc92604978efd81dcd (patch) | |
| tree | 5f86a2d5fa52aafe195f12db1f62493f4c2307b4 /addons/account_analytic_default/account_analytic_default.py | |
| parent | 37bff3b62c5c98120cf7ed772a3964d09229675f (diff) | |
[FIX] small fixes
- set the company_id parameters at the end of the method to avoid incompatibities with calls in account_analytic_plans
- instead of checking the context, actually pass the company_id argument in the product_change from uos_id_change
Diffstat (limited to 'addons/account_analytic_default/account_analytic_default.py')
| -rw-r--r-- | addons/account_analytic_default/account_analytic_default.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/addons/account_analytic_default/account_analytic_default.py b/addons/account_analytic_default/account_analytic_default.py index 3d6f1b4ace3..e0e8f7292ef 100644 --- a/addons/account_analytic_default/account_analytic_default.py +++ b/addons/account_analytic_default/account_analytic_default.py @@ -39,7 +39,7 @@ class account_analytic_default(osv.osv): 'date_stop': fields.date('End Date', help="Default end date for this Analytic Account."), } - def account_get(self, cr, uid, product_id=None, partner_id=None, company_id=None, user_id=None, date=None, context=None): + def account_get(self, cr, uid, product_id=None, partner_id=None, user_id=None, date=None, company_id=None, context=None): domain = [] if product_id: domain += ['|', ('product_id', '=', product_id)] @@ -78,10 +78,7 @@ class account_invoice_line(osv.osv): def product_id_change(self, cr, uid, ids, product, uom_id, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, currency_id=False, context=None, company_id=None): res_prod = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom_id, qty, name, type, partner_id, fposition_id, price_unit, currency_id=currency_id, context=context, company_id=company_id) - if context is None: - context = {} - company_id = company_id if company_id != None else context.get('company_id',False) - rec = self.pool.get('account.analytic.default').account_get(cr, uid, product, partner_id, company_id, uid, time.strftime('%Y-%m-%d'), context=context) + rec = self.pool.get('account.analytic.default').account_get(cr, uid, product, partner_id, uid, time.strftime('%Y-%m-%d'), company_id=company_id, context=context) if rec: res_prod['value'].update({'account_analytic_id': rec.analytic_id.id}) else: @@ -95,7 +92,7 @@ class stock_picking(osv.osv): def _get_account_analytic_invoice(self, cursor, user, picking, move_line): partner_id = picking.partner_id and picking.partner_id.id or False - rec = self.pool.get('account.analytic.default').account_get(cursor, user, move_line.product_id.id, partner_id, company_id, user, time.strftime('%Y-%m-%d'), context={}) + rec = self.pool.get('account.analytic.default').account_get(cursor, user, move_line.product_id.id, partner_id, user, time.strftime('%Y-%m-%d')) if rec: return rec.analytic_id.id @@ -116,7 +113,7 @@ class sale_order_line(osv.osv): anal_def_obj = self.pool.get('account.analytic.default') for line in inv_line_obj.browse(cr, uid, create_ids, context=context): - rec = anal_def_obj.account_get(cr, uid, line.product_id.id, sale_line.order_id.partner_id.id, sale_line.order_id.user_id.id, False, time.strftime('%Y-%m-%d'), context=context) + rec = anal_def_obj.account_get(cr, uid, line.product_id.id, sale_line.order_id.partner_id.id, sale_line.order_id.user_id.id, time.strftime('%Y-%m-%d'), context=context) if rec: inv_line_obj.write(cr, uid, [line.id], {'account_analytic_id': rec.analytic_id.id}, context=context) |
