1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# pricelist_discount module for OpenERP, Pricelist Discount
5
# Copyright (C) 2009 SYLEAM Info Services (<http://www.syleam.fr/>)
6
# Jean-Sébastien SUZANNE <jean-sebastien.suzanne@syleam.fr>
7
# Copyright (C) 2012 SYLEAM Info Services (<http://www.syleam.fr/>)
8
# Benoît MOTTIN <benoit.mottin@syleam.fr>
9
# Sebastien LANGE <sebastien.lange@syleam.fr>
10
# Copyright (C) 2013 initOS GmbH & Co. KG <http://www.initos.com>
12
# This file is a part of pricelist_discount
14
# pricelist_discount is free software: you can redistribute it and/or modify
15
# it under the terms of the GNU Affero General Public License as published
16
# by the Free Software Foundation, either version 3 of the License, or
17
# (at your option) any later version.
19
# pricelist_discount is distributed in the hope that it will be useful,
20
# but WITHOUT ANY WARRANTY; without even the implied warranty of
21
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
# GNU Affero General Public License for more details.
24
# You should have received a copy of the GNU Affero General Public License
25
# along with this program. If not, see <http://www.gnu.org/licenses/>.
27
##############################################################################
29
from osv import osv, fields
32
class product_pricelist(osv.Model):
33
_inherit = "product.pricelist"
35
def price_get(self, cr, uid, ids, prod_id, qty, partner=None,
38
Add discount if set in result
40
context = context or {}
41
result = super(product_pricelist, self)\
42
.price_get(cr, uid, ids, prod_id, qty,
43
partner=partner, context=context)
44
if 'discount' in context:
45
discount = self.pool.get('product.pricelist.item')\
46
.browse(cr, uid, result['item_id'].values()[0],
50
result.update({'discount': discount})
54
class product_pricelist_item(osv.Model):
55
_inherit = 'product.pricelist.item'
58
'discount': fields.float('Discount (%)', digits=(16, 2)),
67
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: