diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py index c6ced4e59fd..c6e70b06cad 100644 --- a/addons/purchase/stock.py +++ b/addons/purchase/stock.py @@ -156,6 +156,10 @@ class stock_move(osv.osv): return self.write(cr, uid, [move.id], {'price_unit': price}, context=context) super(stock_move, self).attribute_price(cr, uid, move, context=context) + def _get_taxes(self, cr, uid, move, context=None): + if move.origin_returned_move_id.purchase_line_id.taxes_id: + return [tax.id for tax in move.origin_returned_move_id.purchase_line_id.taxes_id] + return super(stock_move, self)._get_taxes(cr, uid, move, context=context) class stock_picking(osv.osv): _inherit = 'stock.picking' diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py index fed88af30d8..924f458606a 100644 --- a/addons/sale_stock/sale_stock.py +++ b/addons/sale_stock/sale_stock.py @@ -413,6 +413,10 @@ class stock_move(osv.osv): extra_move_tax[move.picking_id, move.product_id] = [(6, 0, [x.id for x in move.procurement_id.sale_line_id.tax_id])] return (is_extra_move, extra_move_tax) + def _get_taxes(self, cr, uid, move, context=None): + if move.procurement_id.sale_line_id.tax_id: + return [tax.id for tax in move.procurement_id.sale_line_id.tax_id] + return super(stock_move, self)._get_taxes(cr, uid, move, context=context) class stock_location_route(osv.osv): _inherit = "stock.location.route" diff --git a/addons/stock/stock.py b/addons/stock/stock.py index ceb9e98221e..0f6c455d436 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2555,6 +2555,8 @@ class stock_move(osv.osv): code = 'incoming' return code + def _get_taxes(self, cr, uid, move, context=None): + return [] class stock_inventory(osv.osv): _name = "stock.inventory" diff --git a/addons/stock_account/stock.py b/addons/stock_account/stock.py index f47a5f8e5f5..1b8c32bfbaf 100644 --- a/addons/stock_account/stock.py +++ b/addons/stock_account/stock.py @@ -152,11 +152,7 @@ class stock_move(osv.osv): uos_id = move.product_uos.id quantity = move.product_uos_qty - taxes_ids = [] - if move.origin_returned_move_id.purchase_line_id.taxes_id: - taxes_ids = [tax.id for tax in move.origin_returned_move_id.purchase_line_id.taxes_id] - elif move.procurement_id.sale_line_id.tax_id: - taxes_ids = [tax.id for tax in move.procurement_id.sale_line_id.tax_id] + taxes_ids = self._get_taxes(cr, uid, move, context=context) return { 'name': move.name,