X-Git-Url: https://git.cyclocoop.org/?p=burette%2Fetudesetchantiersidf.git;a=blobdiff_plain;f=product.py;fp=product.py;h=0f1bbde933ce4109ba700c0e8e491876c83ae646;hp=0000000000000000000000000000000000000000;hb=cb080bacb89f6d070fddc2dc805859926be1b89b;hpb=7e625420fd26cdfc963879e0891e9be925bd1faf diff --git a/product.py b/product.py new file mode 100644 index 0000000..0f1bbde --- /dev/null +++ b/product.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# etudesetchantiersidf module for OpenERP, Custom module for Étude et +# Chantiers île-de-France +# Copyright (C) 2014-2018 etudesetchantiersidf +# () +# +# This file is a part of etudesetchantiersidf +# +# etudesetchantiersidf is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as published +# by the Free Software Foundation, either version 3 of the License, or (at +# your option) any later version. +# +# etudesetchantiersidf 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.osv import osv +from openerp.osv import orm +from openerp.osv import fields + + +class product_category(orm.Model): + _inherit = 'product.category' + + _columns = { + 'is_fixed_price': fields.boolean('Fixed price', help='Check this box to \ + prevent price change for products \ + belong to this category'), + } + +class product_product(orm.Model): + _inherit = 'product.product' + + def is_fixed_price_get(self, cr, uid, ids, name, args, context=None): + """Return if products are fixed price or not""" + res = {} + for product in self.browse(cr, uid, ids, context=context): + categ = product.product_tmpl_id.categ_id + res[product.id] = categ.is_fixed_price + return res + + _columns = { + 'is_fixed_price': fields.function(is_fixed_price_get, + method=True, + string='Fixed price', + type='boolean', + store=False), + } + + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: