Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to Compute the quantity invoiced If case of a refund in openerp(odoo)-9

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 205
    Comment on it

    To Compute the quantity invoiced If case of a refund in openerp to Compute the quantity invoiced. If case of a refund, the quantity invoiced is decreased. Note that this is the case only if the refund is generated from and function given below to use this code in .py file.

     @api.depends('invoice_lines.invoice_id.state', 'invoice_lines.quantity')
        def _get_invoice_qty(self):
            for line in self:
                qty_invoiced = 0.0
                for invoice_line in line.invoice_lines:
                    if invoice_line.invoice_id.state != 'cancel':
                        if invoice_line.invoice_id.type == 'out_invoice':
                            qty_invoiced += invoice_line.quantity
                        elif invoice_line.invoice_id.type == 'out_refund':
                            qty_invoiced -= invoice_line.quantity
                line.qty_invoiced = qty_invoiced
    

 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: