how to fetch a column in browse_record_list in orm browse method in openERP

1.4k views Asked by At

I'm beginner in openERP. I'm trying to get a column in a table. While using ORM browse method and iterating that object i got the result in browse_record_list as browse_record(table.name,21). I want to fetch that particular id 21 alone through that browse method but instead im getting same browse_record as shown above.

How to fetch that particular column alone.

updated:

d_c=None
    dc =None
    dc=self.pool.get('some.table').browse(cr,uid,1,context={})
    if dc:
        d_name = dc.name
        d_id =dc.id
        d_some_id=dc.some_id

    logging.info(d_name)
    logging.info(d_id)
    logging.info(d_some_id)

In this code when i saw the log it shows id and name as in the table as expected,but that some_id alone gives browse_record(some.table,21)

1

There are 1 answers

15
Emipro Technologies Pvt. Ltd. On BEST ANSWER

You can access all the fields of that table from the browsable object.

id = browse_record.id
name = browse_record.name

Similarly you can access all the relational tables data as well, like customer in sale order.

partner_id = sale_order_object.partner_id.id
partner_name = sale_order_object.partner_id.name

You can also update tables data through that browsable object.

browse_record.write({'field_name' : field_value})

Browsable record list:

for obj in browse_obj_list:
    id = obj.id

Read more

Odoo Documentation

Odoo Documentation