Odoo Help

Welcome!

This community 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.

0

Refund Invoice

By
Jihen BEN ALI
on 6/7/16, 8:00 AM 173 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 

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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