From 5a9e33634605a67064b60743e88d8e52e1711de5 Mon Sep 17 00:00:00 2001 From: Ludovic CHEVALIER Date: Mon, 4 Feb 2013 16:34:13 +0100 Subject: [PATCH] [order] work in progress: disallow make anonym order when ther is a membership product --- __init__.py | 1 + pos_membership.py | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 pos_membership.py diff --git a/__init__.py b/__init__.py index 96390f5..ee06cef 100644 --- a/__init__.py +++ b/__init__.py @@ -20,5 +20,6 @@ # along with this program. If not, see . # ############################################################################## +import pos_membership # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/pos_membership.py b/pos_membership.py new file mode 100644 index 0000000..d705c86 --- /dev/null +++ b/pos_membership.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# POS Membership module for OpenERP, Manage membership payments from POS. +# Copyright (C) 2013 L'Heureux Cyclage () +# +# This file is a part of POS Membership +# +# POS Membership 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. +# +# ReMembership 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 fields + +class pos_order(osv.osv): + _inherit = 'pos.order' + + def _check_membership_product(self, cr, uid, ids, context=None): + #TODO : check condition and return boolean accordingly + if not context is None: + context = {} + order_line_obj = self.pool.get('pos.order.line') + #order_obj = self.pool.get('pos.order') + data_order_line = order_line_obj.browse(cr, uid, ids, context=context) + for data in data_order_line: + print("INFO: pos_membership - Line:" + data.id), + print("Product: " + data.product_id) + return True + + _constraints = [ + (_check_membership_product, 'Error: Invalid Message', ['field_name']), + ] + +pos_order() + + + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: -- 2.20.1