[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.
This commit is contained in:
parent
765cd3fbec
commit
3abd451aca
|
@ -990,7 +990,6 @@ class pos_order(osv.osv):
|
||||||
'invoice_id': inv_id,
|
'invoice_id': inv_id,
|
||||||
'product_id': line.product_id.id,
|
'product_id': line.product_id.id,
|
||||||
'quantity': line.qty,
|
'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_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, [],
|
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.product_id.uom_id.id,
|
||||||
line.qty, partner_id = order.partner_id.id,
|
line.qty, partner_id = order.partner_id.id,
|
||||||
fposition_id=order.partner_id.property_account_position.id)['value'])
|
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['price_unit'] = line.price_unit
|
||||||
inv_line['discount'] = line.discount
|
inv_line['discount'] = line.discount
|
||||||
inv_line['name'] = inv_name
|
inv_line['name'] = inv_name
|
||||||
|
|
Loading…
Reference in New Issue