Odoo Help


2 Answers
Timothy Solomon South Africa
4/22/13, 7:32 AM

There is an easier way, just add the columns in your model:

_columns = {
        'create_date' : fields.datetime('Date Created', readonly=True),
        'create_uid' : fields.many2one('res.users', 'by User', readonly=True),

Then you can use as a normal column in xml

AJ Schrafel Paper Corp United States
4/24/13, 5:35 PM

NOTE - readonly=True is required for this to work.

santoshnayak India
10/17/13, 6:48 AM

Hi Timothy, i want bit more clarity. I am using Restful API for Openerp V7. I want write my own date into create_date field instead of letting ORM to put current system date, as well as read create_date. If i set readonly=True, then how could i write. Please give me some suggestion. Thank you..!

Timothy Solomon South Africa
7/3/14, 6:41 AM

I dont think you can overwrite the create_date. Why not just use a new date field for your date? create_date is an existing field on all tables so you cant use that name for your field.

klacus Hungary
4/21/13, 3:06 AM

Yes, because you need a different way to read this data.

I think the good solution is this:

perm_read(cr, user, ids, context=None, details=True)

Returns some metadata about the given records.
Parameters: details – if True, *_uid fields are replaced with the name of the user
Returns:    list of ownership dictionaries for each requested record
Return type:    list of dictionaries with the following keys:

    id: object id
    create_uid: user who created the record
    create_date: date when the record was created
    write_uid: last user who changed the record
    write_date: date of the last change to the record
    xmlid: XML ID to use to refer to this record (if there is one), in format module.name

You need to create a field and link in xml what is displaying the result of perm read of the current record. Just use google in orm methods... in documentation, older forums, like this

perms = self.perm_read(cr,uid,ids)
wr_date =  perms[0].get('write_date', 'n/a')
Ask a Question
Keep Informed
0 follower(s)
About This Community

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

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now