This question has been flagged
1 Reply
3776 Views

Hello, I have custom module that is inherited from res_partner. Until I installed Social (mail) module everithing was fine, but when I installed it I cannot save any record in the database, unless records made in my custom module. When I try to create new record in Customers, or create a new company (modifying existing company is OK), the following error occurs:

Attribute Error: No field image found in record.browse(my_mudule_name, int)

The traceback reports an error in mail_thread.create() method and in res_partner module, but the error occurs with context "my_module_name"!!!

The strange thing is that I can CRUD records with my custom module withoot any errors and mail_thread correctly records all actions (saw the report log), but no create operations are possible in any base module (Address book, Products, etc.)....

Please, help me sort this out if anyone has been where I'm... Any suggestions are very appeciated!

Avatar
Discard
Author Best Answer

After debugging I figured out (or at least think so) where is the problem:

It turns out that mail_thread.py overrides create method in res_partner.py and therefore if you have inheritance of type _name & _table in your custom module it collects wrong ids - not from original res_partner table but from the inherited table of your custom module and throws an exception...

The workaround I decide to use is to change the inheritance type as to accommodate everything in the res_partner table. The only inconvenience I found so far is that now I need to make all my custom module views inherited from res_partner_view.xml in order to display data for my module correctly.

If someone know better way to achieve this without view inheritance, please drop me a line. Thanks to all, hope that this is useful.

Avatar
Discard
Author

I did it without view inheritance and it works as charm :)