Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to create membership IDs in OpenERP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 445
    Comment on it

    In OpenERP first we create the form and browse the record of  account invoice line and then select to the product in product form and then find to the the current user’s ID for security checks. In account invoice line we check to the list of membership line IDs and fields name  and  standard dictionary for contextual values and also  dictionary of state Value.

    use this function show in given below

    def members(self, cr, uid, ids, name, args, context=None):
      
        res = {}
        inv_obj = self.pool.get('account.invoice')
        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
          istate = fetched[0]
          state = 'none'
          if (istate == 'draft') | (istate == 'proforma'):
            state = 'waiting'
          elif istate == 'open':
            state = 'invoiced'
          elif istate == 'paid':
            state = 'paid'
            inv = inv_obj.browse(cr, uid, fetched[1], context=context)
            for payment in inv.payment_ids:
              if payment.invoice and payment.invoice.type == 'out_refund':
                state = 'canceled'
          elif istate == 'cancel':
            state = 'canceled'
          res[line.id] = state
        return res
    
    

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: