forked from camptocamp/stock-logistics-warehouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstock.py
More file actions
53 lines (47 loc) · 2.14 KB
/
stock.py
File metadata and controls
53 lines (47 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013 Agile Business Group sagl (<http://www.agilebg.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import fields, orm
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):
_super = super(stock_move, self)
location = move.location_id
location_dest = move.location_dest_id
if (location.company_id
and location_dest.company_id
and location.company_id != location_dest.company_id):
return _super._create_product_valuation_moves(
cr, uid, move, context=context)
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
return _super._create_product_valuation_moves(
cr, uid, move, context=context)