Odoo Help

0
1
Ivan
On 1/24/15, 3:18 AM

The problem is in this line:

for record in self.pool.get('account.invoice').browse(cr, uid, ['invoice'], context=context) :

It expects list of integers in the place of ['invoice'].  My guess is, it should be:

    def _get_invoice_status(self, cr, uid, ids, invoice_status, arg, context=None):
        inv_status = {}

       inv_obj = self.pool.get('account.invoice')
        for record in self.browse(cr, uid, ids, context=context) :

           _inv = record.invoice and inv_obj.browse(cr, uid, record.invoice, context=context) or False
            inv_status[record.id] = _inv and _inv.state or ''
        return inv_status

Having said that, why don't you make 'invoice' field to be many2one to the account.invoice model?

Thank you Ivan. Your code worked perfectly.

Abdullah Sofan
on 1/24/15, 8:09 AM
0
Abdullah Sofan
On 1/24/15, 4:51 AM

Thanks Ivan, But I am getting this error now in an alert window:

 

AccessError: ('AccessError', "No value found for account.invoice(u'66',).state")

 

Working with odoo is very hard when simple things like this have no straightforward guide tutorial.

Take a look at the server log or javascript console to see which line causes the error. It might not be the line that I've given you in my answer. The ID has been passed as string in the code u'...' means unicode string in python. Admittedly developing for Odoo is not for the faint heart, but it applies to all ERP. ERP can grow to such complexity that you wouldn't be able to "master" it. The best way is to learn how to find example, because the good thing about Odoo is it is open source and you can learn from how the official software has been build. Stephen Mack had collated one of the best collection of Odoo documentation. I would suggest that you learn about grep (or findstr in Windows), python, and read his posts: https://www.odoo.com/forum/help-1/question/the-hitchhikers-guide-to-odoo-71524 and https://www.odoo.com/forum/help-1/question/what-blogs-tutorials-forums-exist-about-odoo-68797

Ivan
on 1/24/15, 7:38 AM

About This Community

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

Question tools

1 follower(s)

Stats

Asked: 1/24/15, 1:52 AM
Seen: 3333 times
Last updated: 3/16/15, 8:10 AM