1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # etudesetchantiersidf module for OpenERP, Custom module for Étude et
5 # Chantiers île-de-France
6 # Copyright (C) 2014-2018 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 pos_order_line(orm
.Model
):
32 _inherit
= 'pos.order.line'
34 def create(self
, cr
, uid
, vals
, context
=None):
35 product_id
= vals
['product_id']
36 products_obj
= self
.pool
.get('product.product')
37 product
= products_obj
.browse(cr
, uid
, product_id
, context
=context
)
38 if product
.is_fixed_price
:
39 vals
['price_unit'] = product
.list_price
40 res
= super(pos_order_line
, self
).create(cr
, uid
, vals
, context
=context
)
43 def onchange_product_id(self
, cr
, uid
, ids
, pricelist
, product_id
, qty
=0, partner_id
=False, context
=None):
44 res
= super(pos_order_line
, self
).onchange_product_id(cr
, uid
, ids
, pricelist
, product_id
, qty
, partner_id
, context
=context
)
46 products_obj
= self
.pool
.get('product.product')
47 product
= products_obj
.browse(cr
, uid
, product_id
, context
=context
)
48 res
['value'].update({'is_fixed_price': product
.is_fixed_price
})
52 'is_fixed_price': fields
.boolean('Fixed price'),
55 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: