Quantcast
Channel: OpenERP Help - Individual question feed
Viewing all articles
Browse latest Browse all 68

How do use a fields.funtion in one object to change one variable depending on a change of state of another object state?

$
0
0
Hi, I'm trying to do a fields.function in account.voucher.line that when the state of account.voucher change save some information in account.voucher.line. I've started just by saving one thing. But I'm facing some issues. I've done this code: class account_voucher_line(osv.osv): _name = 'account.voucher.line' _description = 'Voucher Lines' _order = "move_line_id" _inherit = "account.voucher.line" def _get_invoice(self, cr, uid, ids, field_name, arg, context=None): result = {} import pdb #stop code to debug pdb.set_trace() #stop code to debug ############################################################# ### In here "ids" is from account.voucher, I need the id from account.voucher.line # ############################################################# return result _columns = { 'account_invoice': fields.function(_get_invoice, method=True, type="many2one", relation='account.invoice', store={'account.voucher': (lambda self, cr, uid, ids, ctx={}: ids , ['state'], 10),}, string="Invoice"), } account_voucher_line() 1º : What I'm trying to do is possible? 2º : If so, how do I pass to the function the id(or another field) from account.voucher.line? Thanks!

Viewing all articles
Browse latest Browse all 68

Trending Articles