255845f6efca5fdb8c9954013e17b38e65243585
1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # etudesetchantiersidf module for OpenERP, Custom module for Étude et
5 # Chantiers île-de-France
6 # Copyright (C) 2014-2022 etudesetchantiersidf
7 # (<http://etudesetchantiersiledefrance.unarec.org/>)
9 # This file is a part of etudesetchantiersidf
11 # etudesetchantiersidf is free software: you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License as published
13 # by the Free Software Foundation, either version 3 of the License, or (at
14 # your option) any later version.
16 # etudesetchantiersidf is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 ##############################################################################
26 from openerp
.osv
import osv
27 from openerp
.osv
import orm
28 from openerp
.osv
import fields
31 class product_category(orm
.Model
):
32 _inherit
= 'product.category'
35 'is_fixed_price': fields
.boolean('Fixed price', help='Check this box to \
36 prevent price change for products \
37 belong to this category'),
40 class product_product(orm
.Model
):
41 _inherit
= 'product.product'
43 def is_fixed_price_get(self
, cr
, uid
, ids
, name
, args
, context
=None):
44 """Return if products are fixed price or not"""
46 for product
in self
.browse(cr
, uid
, ids
, context
=context
):
47 categ
= product
.product_tmpl_id
.categ_id
48 res
[product
.id] = categ
.is_fixed_price
52 'is_fixed_price': fields
.function(is_fixed_price_get
,
60 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: