Skip to Content
Menu
This question has been flagged
1 Reply
24104 Views

Hi,

How to change below code to old api ................



 res = self.env.ref('account.action_account_payments')? (not like odoo8 api before it like cr,uid,)
res = res.read(cr,uid,ids)[0]
res['domain'] = str([('id','in',[pay_id.id])])
data.payment_id = pay_id.id
return res
Avatar
Discard
Best Answer

Hello, 

All the xml records are stored in "ir.model.data" object. There is a method called "get_object_reference" which gives you the database ID from xml ID.

In this method you have to pass module name where xml record is created and xml ID of the record.

self.pool.get('account.action_account_payments').get_object_reference(cr, uid, 'module_name', 'xml_id_of_record')[1]

you can find Solution from Below link.

https://www.odoo.com/forum/help-1/question/how-to-reference-record-in-database-by-is-xml-id-90391

Avatar
Discard