Odoo Help


Refund Invoice

on 6/7/16, 8:00 AM 748 views

Hi everyone,

Please in the customer/supplier refund I need to get the invoice_line depending to the invoice_id of selected partner for that I had used this one below so any suggestion for how can I get invoice_line (I have used onchange on invoice_id but when I edit invoice line or when I save lines disapper)

'invoice_id' : fields.many2one('account.invoice', string='Invoice number'),
  def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
        res = super(kms_invoice, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context,
                                                        toolbar=toolbar, submenu=submenu)
        invoice_type = context.get('default_type')
        type = context.get('type')
        invoice_obj = self.pool.get('account.invoice')
        inv =invoice_obj.browse(cr, uid, context=context)
        if invoice_type == 'out_refund' or type == 'in_refund':
            doc = etree.XML(res['arch'])
            for node in doc.xpath("//field[@name='invoice_id']"):
                node.set('domain', "[('partner_id', '=', partner_id),('state','!=','draft'),('type','not in',('out_refund','in_refund'))]")
                setup_modifiers(node, res['fields']['invoice_id'])
            res['arch'] = etree.tostring(doc)
        return res 

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/7/16, 8:00 AM
Seen: 748 times
Last updated: 6/7/16, 8:19 AM