[FIX] stock_account: Product description on invoices

The system showed different Description for product in invoice when you generate invoices based on delivery
orders compared with based on the sales order lines. But the invoice is in the two cases attached with the SO.
Then the description of the product must be the description linked to the SO line.

opw:660723
This commit is contained in:
Goffin Simon 2016-01-04 15:47:53 +01:00
parent 3f86507df5
commit 3033b05349
1 changed files with 4 additions and 1 deletions

View File

@ -135,10 +135,13 @@ class stock_move(osv.osv):
fp_obj = self.pool.get('account.fiscal.position')
# Get account_id
fp = fp_obj.browse(cr, uid, context.get('fp_id')) if context.get('fp_id') else False
name = False
if inv_type in ('out_invoice', 'out_refund'):
account_id = move.product_id.property_account_income.id
if not account_id:
account_id = move.product_id.categ_id.property_account_income_categ.id
if move.procurement_id and move.procurement_id.sale_line_id:
name = move.procurement_id.sale_line_id.name
else:
account_id = move.product_id.property_account_expense.id
if not account_id:
@ -156,7 +159,7 @@ class stock_move(osv.osv):
taxes_ids = self._get_taxes(cr, uid, move, context=context)
return {
'name': move.name,
'name': name or move.name,
'account_id': account_id,
'product_id': move.product_id.id,
'uos_id': uos_id,