From 3abd451acafa9c03856efc5398aa03b4c3c4c863 Mon Sep 17 00:00:00 2001 From: Jos De Graeve Date: Wed, 10 Jun 2015 18:22:29 +0200 Subject: [PATCH] [FIX]point of sale: passing analytic account In the method action_invoice, the call to the method "_prepare_analytic_account" in dict "inv_line" had no effect because the value of account_analytic_id was being cleared by the product_id_change statement. So in the end the invoice line was created without any account attached Now it checks for an existing value, and if it is not already filled in, the value from _prepare_analytic_account is taken. --- addons/point_of_sale/point_of_sale.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 357c332f6ea..3fbd3257b0f 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -990,7 +990,6 @@ class pos_order(osv.osv): 'invoice_id': inv_id, 'product_id': line.product_id.id, 'quantity': line.qty, - 'account_analytic_id': self._prepare_analytic_account(cr, uid, line, context=context), } inv_name = product_obj.name_get(cr, uid, [line.product_id.id], context=context)[0][1] inv_line.update(inv_line_ref.product_id_change(cr, uid, [], @@ -998,6 +997,10 @@ class pos_order(osv.osv): line.product_id.uom_id.id, line.qty, partner_id = order.partner_id.id, fposition_id=order.partner_id.property_account_position.id)['value']) + if not inv_line.get('account_analytic_id', False): + inv_line['account_analytic_id'] = \ + self._prepare_analytic_account(cr, uid, line, + context=context) inv_line['price_unit'] = line.price_unit inv_line['discount'] = line.discount inv_line['name'] = inv_name