[VIEW][PYTHON][TRANS] +fixed price field in products categories
[burette/etudesetchantiersidf.git] / point_of_sale.py
diff --git a/point_of_sale.py b/point_of_sale.py
new file mode 100644 (file)
index 0000000..2ea2f21
--- /dev/null
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    etudesetchantiersidf module for OpenERP, Custom module for Étude et
+#    Chantiers île-de-France
+#    Copyright (C) 2014-2018 etudesetchantiersidf
+#    (<http://etudesetchantiersiledefrance.unarec.org/>)
+#
+#    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 <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp.osv import osv
+from openerp.osv import orm
+from openerp.osv import fields
+
+
+class pos_order_line(orm.Model):
+    _inherit = 'pos.order.line'
+
+    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:
+            products_obj = self.pool.get('product.product')
+            product = products_obj.browse(cr, uid, product_id, context=context)
+            res['value'].update({'is_fixed_price': product.is_fixed_price})
+        return res
+
+    _columns = {
+        'is_fixed_price': fields.boolean('Fixed price'),
+    }
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: