From 8f1a9ee6cdf4bf853af0c956978957bbf519b076 Mon Sep 17 00:00:00 2001 From: Lorenzo Battistini Date: Thu, 30 May 2013 17:22:27 +0200 Subject: [PATCH] [add] logic --- stock_optional_valuation/stock.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/stock_optional_valuation/stock.py b/stock_optional_valuation/stock.py index 5c6ab3230..9173df154 100644 --- a/stock_optional_valuation/stock.py +++ b/stock_optional_valuation/stock.py @@ -20,3 +20,24 @@ from openerp.osv import fields, orm from openerp.tools.translate import _ + +class stock_location(orm.Model): + _inherit = "stock.location" + + _columns = { + 'consider_internal': fields.boolean('Consider internal', help="Consider as internal location for inventory valuation: stock moves from internal to internal will not generate accounting entries"), + } + +class stock_move(orm.Model): + _inherit = "stock.move" + + def _create_product_valuation_moves(self, cr, uid, move, context=None): + if move.location_id.company_id == move.location_dest_id.company_id: + if (move.location_id.usage == 'internal' or + move.location_id.consider_internal) and ( + move.location_dest_id.usage == 'internal' or + move.location_dest_id.consider_internal): + return + res=super(stock_move,self)._create_product_valuation_moves( + cr, uid, move, context=context) + return res