Skip to content

Commit

Permalink
[FIX]point of sale: passing analytic account
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JosDeGraeve authored and simongoffin committed Jun 24, 2015
1 parent 765cd3f commit 3abd451
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion addons/point_of_sale/point_of_sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,14 +990,17 @@ def action_invoice(self, cr, uid, ids, context=None):
'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, [],
line.product_id.id,
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
Expand Down

0 comments on commit 3abd451

Please sign in to comment.