# -*- 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: