[order] work in progress: disallow make anonym order when ther is a membership product
[burette/pos_membership.git] / pos_membership.py
1 # -*- coding: utf-8 -*-
2 ##############################################################################
3 #
4 # POS Membership module for OpenERP, Manage membership payments from POS.
5 # Copyright (C) 2013 L'Heureux Cyclage (<http://www.heureux-cyclage.org>)
6 #
7 # This file is a part of POS Membership
8 #
9 # POS Membership is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # ReMembership is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #
22 ##############################################################################
23 from openerp.osv import osv
24 from openerp.osv import fields
25
26 class pos_order(osv.osv):
27 _inherit = 'pos.order'
28
29 def _check_membership_product(self, cr, uid, ids, context=None):
30 #TODO : check condition and return boolean accordingly
31 if not context is None:
32 context = {}
33 order_line_obj = self.pool.get('pos.order.line')
34 #order_obj = self.pool.get('pos.order')
35 data_order_line = order_line_obj.browse(cr, uid, ids, context=context)
36 for data in data_order_line:
37 print("INFO: pos_membership - Line:" + data.id),
38 print("Product: " + data.product_id)
39 return True
40
41 _constraints = [
42 (_check_membership_product, 'Error: Invalid Message', ['field_name']),
43 ]
44
45 pos_order()
46
47
48
49 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: