for order in self.pool.get('pos.order').browse(cr, uid, ids, context=context):
if order.lines:
list_membership_line += member_line_obj.search(cr, uid, [('pos_order_line', 'in', [ l.id for l in order.lines])], context=context)
- res = \
- { 'class': 'pos.order'
- , 'ids': list_membership_line
- }
- #res= list_membership_line
+ #res = \
+ # { 'class': 'pos.order'
+ # , 'ids': list_membership_line
+ # }
+ res= list_membership_line
print("DEV: [pos_membership] [membership_line] [_get_membership_lines_from_pos_order]: res=%s" % str(res))
return res
return False
return True
- def _state(self, cr, uid, data, name, args, context=None):
+ def _state(self, cr, uid, ids, name, args, context=None):
"""Compute the state lines
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param return: Dictionary of state Value
"""
res = {}
- print("DEV: [pos_membership] [membership_line] [_state]: name=%s data=%s args=%s context=%s" % (str(name), str(data), str(args), str(context)))
- if type(data) == type(list()) or data.get('class') == 'account.invoice':
- inv_obj = self.pool.get('account.invoice')
- if type(data) == type(list()):
- ids = data
- else:
- ids = data.get('ids')
- for line in self.browse(cr, uid, ids, context=context):
- cr.execute('''
- SELECT i.state, i.id FROM
- account_invoice i
- WHERE
- i.id = (
- SELECT l.invoice_id FROM
- account_invoice_line l WHERE
- l.id = (
- SELECT ml.account_invoice_line FROM
- membership_membership_line ml WHERE
- ml.id = %s
- )
+ print("DEV: [pos_membership] [membership_line] [_state]: name=%s ids=%s args=%s context=%s" % (str(name), str(ids), str(args), str(context)))
+ inv_obj = self.pool.get('account.invoice')
+ ord_obj = self.pool.get('pos.order')
+ for line in self.browse(cr, uid, ids, context=context):
+ cr.execute('''
+ SELECT i.state, i.id FROM
+ account_invoice i
+ WHERE
+ i.id = (
+ SELECT l.invoice_id FROM
+ account_invoice_line l WHERE
+ l.id = (
+ SELECT ml.account_invoice_line FROM
+ membership_membership_line ml WHERE
+ ml.id = %s
)
- ''', (line.id,))
- fetched = cr.fetchone()
- if not fetched:
- res[line.id] = 'canceled'
- continue
+ )
+ ''', (line.id,))
+ fetched = cr.fetchone()
+ if fetched:
istate = fetched[0]
state = 'none'
if (istate == 'draft') | (istate == 'proforma'):
elif istate == 'cancel':
state = 'canceled'
res[line.id] = state
- elif data.get('class') == 'pos.order':
- ord_obj = self.pool.get('pos.order')
- for line in self.browse(cr, uid, data.get('ids'), context=context):
+ else:
cr.execute('''
SELECT i.state, i.id FROM
pos_order i