Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Using if else in OpenOffice Report

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 334
    Comment on it

    Printing any field on an OpenERP report on a conditional basis, you can add a simple line in your report

    [[(object.field == 'Some Value') and 'value1' or 'value2']] is equivalent to

    if object.field:
       print value1
    else:
       print value2
    

    Suppose I want to print Cash Memo if cash_credit (the mode of payment for the invoice) is Cash and print Credit Memo if cash_credit is Credit, then I write this statement in my Openerp report as:

    [[ (o.cash_credit == 'Cash') and 'Cash Memo' or 'Credit Memo' ]]

    and convert to fields.

 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: