Help

2

[object with reference: loyalty_program - loyalty.program] error when reinstaling an uninstalled custom module

Avatar
javid

Hi!


how do I get rid of this error. I installed  a custom module that I purchased from odoo marketplace. I uninstalled it as I was getting some errors. After uninstalling it , I deleted it from the Addon folder. I then uploaded it again but am getting following error as i try to install it:

The operation cannot be completed, probably due to the following: - deletion: you may be trying to delete a record while other records still reference it- creation/update: a mandatory field is not correctly set

[object with reference: loyalty_program - loyalty.program]

Avatar
Discard
4 Answers
0
Avatar
Panda Medya
Best Answer

i have same problem guys

Avatar
Discard
0
Avatar
La Jayuhni Yarsyah
Best Answer

You should check all many2one fields related to loyalty.program, and find wich fields are restricted (ondelete="restrict") to relation model

For simple way to fix it, you can set ondelete parameter to "set null" or "cascade"  on Many2one fields wich related to loyalty.program.
Ex:
some_field_id = fields.Many2one('loyalty.program', ondelete="set null", onupdate="set null")

some_field_id = fields.Many2one('loyalty.program', ondelete="cascade", onupdate="cascade")

But you must carefully,,
If you use "cascade", it will delete related data to its model/table, on database when relation data deleted.

If you use "set null", it will give null value on database column when related data deleted,  only unlinked from relation table..

Regards,

Avatar
Discard
0
Best Answer

Same problem here.

@Avinash Nk how can we do the solution you are saying? 

Thank YOU

Avatar
Discard
0
Avatar
Avinash Nk
Best Answer

The module may creates records at the time of installation.if the record is used after installation.and if the record is referencing to other models then you cant uninstall that module.because at the time of un installation the module try to delete the records created by the module.in that try odoo understands that the records are still referencing to other models.and un installation of the module will effect the working of the module.so it prevents the un installation of the module.

solution :

hide the record creating codes from the module.then install it.

Avatar
Discard