1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# OpenERP, Open Source Management Solution
5
# Copyright (C) 2004-2012 OpenERP s.a. (<http://www.openerp.com>).
6
# Copyright (C) 2012 Mentis d.o.o. (<http://www.mentis.si>)
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU Affero General Public License as
10
# published by the Free Software Foundation, either version 3 of the
11
# License, or (at your option) any later version.
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU Affero General Public License for more details.
18
# You should have received a copy of the GNU Affero General Public License
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
##############################################################################
22
from osv import osv, fields
23
import decimal_precision as dp
25
#----------------------------------------------------------
26
# Stock Picking INHERIT
27
#----------------------------------------------------------
28
class stock_picking_in(osv.osv):
29
_inherit = "stock.picking.in"
31
# # per amount landing costs amount
32
# def _landing_costs_per_value(self, cr, uid, ids, name, args, context):
36
# for line in self.browse(cr, uid, ids):
38
# if line.landing_costs_line_ids:
39
# for costs in line.landing_costs_line_ids:
40
# if costs.distribution_type == 'per_value':
41
# per_value += costs.amount
42
# result[line.id] = per_value
45
# # per unit landing costs amount
46
# def _landing_costs_per_unit(self, cr, uid, ids, name, args, context):
50
# for line in self.browse(cr, uid, ids):
52
# if line.landing_costs_line_ids:
53
# for costs in line.landing_costs_line_ids:
54
# if costs.distribution_type == 'per_unit':
55
# per_unit += costs.amount
56
# result[line.id] = per_unit
59
# # picking quantity for cost calculation
60
# def _landing_costs_base_quantity(self, cr, uid, ids, name, args, context):
64
# for line in self.browse(cr, uid, ids):
67
# for ml in line.move_lines:
68
# if ml.product_id.landing_cost_calculate:
69
# base_quantity += ml.product_qty
70
# result[line.id] = base_quantity
73
# # picking amount for costs calculation
74
# def _landing_costs_base_amount(self, cr, uid, ids, name, args, context):
78
# for line in self.browse(cr, uid, ids):
81
# for ml in line.move_lines:
82
# if ml.product_id.landing_cost_calculate:
83
# base_amount += ml.price_unit * ml.product_qty
84
# result[line.id] = base_amount
88
'landing_costs_line_ids': fields.one2many('purchase.landing.cost.position', 'picking_id', 'Landing Costs'),
89
# 'landing_costs_per_value': fields.function(_landing_costs_per_value, digits_compute=dp.get_precision('Account'), string='Landing Costs Amount Per Value For Average Price'),
90
# 'landing_costs_per_unit': fields.function(_landing_costs_per_unit, digits_compute=dp.get_precision('Account'), string='Landing Costs Amount Per Unit For Average Price'),
91
# 'landing_costs_base_quantity': fields.function(_landing_costs_base_quantity, digits_compute=dp.get_precision('Account'), string='Picking Quantity For Per Unit Calculation'),
92
# 'landing_costs_base_amount': fields.function(_landing_costs_base_amount, digits_compute=dp.get_precision('Account'), string='Picking Amount For Per Value Calculation'),
b'\\ No newline at end of file'