X-Git-Url: https://git.cyclocoop.org/?p=burette%2Fetudesetchantiersidf.git;a=blobdiff_plain;f=point_of_sale.py;h=93780f90b62e7117a30f4d19e20bbeb62ef06111;hp=2ea2f212006da121213d9de26745dd6fda1181dd;hb=HEAD;hpb=cb080bacb89f6d070fddc2dc805859926be1b89b diff --git a/point_of_sale.py b/point_of_sale.py index 2ea2f21..8a81140 100644 --- a/point_of_sale.py +++ b/point_of_sale.py @@ -3,7 +3,7 @@ # # etudesetchantiersidf module for OpenERP, Custom module for Étude et # Chantiers île-de-France -# Copyright (C) 2014-2018 etudesetchantiersidf +# Copyright (C) 2014-2023 etudesetchantiersidf # () # # This file is a part of etudesetchantiersidf @@ -31,6 +31,15 @@ from openerp.osv import fields class pos_order_line(orm.Model): _inherit = 'pos.order.line' + def create(self, cr, uid, vals, context=None): + product_id = vals['product_id'] + products_obj = self.pool.get('product.product') + product = products_obj.browse(cr, uid, product_id, context=context) + if product.is_fixed_price: + vals['price_unit'] = product.list_price + res = super(pos_order_line, self).create(cr, uid, vals, context=context) + return res + def onchange_product_id(self, cr, uid, ids, pricelist, product_id, qty=0, partner_id=False, context=None): res = super(pos_order_line, self).onchange_product_id(cr, uid, ids, pricelist, product_id, qty, partner_id, context=context) if product_id: