Odoo Help

Welcome!

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

0

How to if records of an model are created or modified ?

By
MouBou
on 5/20/16, 6:28 AM 150 views

can i use write() & create() to test if an model has new records or modified recods

0
Jose Vasquez
On 5/20/16, 9:03 AM

Hi MouBou,

Yes, you can use the functions of writing and creating, you leave an example to follow and you can see the data:

import logging
_logger = logging.getLogger(__name__)

class ew_example(models.Model):
    _name = 'ew.example

    api.model
    def create(self, vals):
        _logger.info('VALS>>>>>%r',vals)
        return super(ew_example, self).create(vals)

    @api.multi
    def write(self, vals):
        _logger.info('VALS>>>>>%r',vals)  
return super(ew_example, self).write(vals)

I hope it helps you, regards.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

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

Question tools

1 follower(s)

Stats

Asked: 5/20/16, 6:28 AM
Seen: 150 times
Last updated: 5/20/16, 9:03 AM