diff --git a/addons/stock_account/stock.py b/addons/stock_account/stock.py index 554412b350b..7218ccd900a 100644 --- a/addons/stock_account/stock.py +++ b/addons/stock_account/stock.py @@ -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,