~matjaz-6/openerpsl/banking

« back to all changes in this revision

Viewing changes to purchase_landing_costs/stock_picking_in.py

  • Committer: dusan
  • Date: 2012-12-11 20:57:51 UTC
  • mfrom: (13.1.3 openerpsl)
  • Revision ID: dusan@ubuntu-20121211205751-3jqoyz1w86ffdu74
[MERGE]merge with parent trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
##############################################################################
 
3
#
 
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>)
 
7
#
 
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.
 
12
#
 
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.
 
17
#
 
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/>.
 
20
#
 
21
##############################################################################
 
22
from osv import osv, fields
 
23
import decimal_precision as dp
 
24
 
 
25
#----------------------------------------------------------
 
26
# Stock Picking INHERIT
 
27
#----------------------------------------------------------
 
28
class stock_picking_in(osv.osv):
 
29
    _inherit = "stock.picking.in"
 
30
 
 
31
#    # per amount landing costs amount
 
32
#    def _landing_costs_per_value(self, cr, uid, ids, name, args, context):
 
33
#        if not ids:
 
34
#            return {}        
 
35
#        result = {}
 
36
#        for line in self.browse(cr, uid, ids):
 
37
#            per_value = 0.0
 
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
 
43
#        return result
 
44
#
 
45
#    # per unit landing costs amount
 
46
#    def _landing_costs_per_unit(self, cr, uid, ids, name, args, context):
 
47
#        if not ids:
 
48
#            return {}        
 
49
#        result = {}
 
50
#        for line in self.browse(cr, uid, ids):
 
51
#            per_unit = 0.0
 
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
 
57
#        return result
 
58
#
 
59
#    # picking quantity for cost calculation
 
60
#    def _landing_costs_base_quantity(self, cr, uid, ids, name, args, context):
 
61
#        if not ids:
 
62
#            return {}
 
63
#        result = {}
 
64
#        for line in self.browse(cr, uid, ids):
 
65
#            base_quantity = 0.0
 
66
#            if line.move_lines:
 
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
 
71
#        return result
 
72
#    
 
73
#    # picking amount for costs calculation
 
74
#    def _landing_costs_base_amount(self, cr, uid, ids, name, args, context):
 
75
#        if not ids:
 
76
#            return {}
 
77
#        result = {}
 
78
#        for line in self.browse(cr, uid, ids):
 
79
#            base_amount = 0.0
 
80
#            if line.move_lines:
 
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
 
85
#        return result
 
86
 
 
87
    _columns = { 
 
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'),
 
93
    }
 
94
 
 
95
stock_picking_in()
 
 
b'\\ No newline at end of file'