Skip to Content
Menu
This question has been flagged
3 Replies
15692 Views

Hi,

I want to edit the relation (object it refer ex. res.parter) of an existing Odoo field. 

Error!

Properties of base fields cannot be altered in this manner! Please modify them through Python code, preferably through a custom addon!

i want to edit the relation of partner_shipping_id  from sale.order   where can i find particular in odoo/addons path what folder? can you help me.

 

Avatar
Discard

seems to me, you have already asked this question, and I have answered for the same.. do have a look at it...

Best Answer

The same error appears when you are saving an object that has a related field to a property of  ir.model.fields and the field is not market as readonly.

For example:

model    = fields.Char(related='model_id.model', string='Model tech name', readonly=True)
model_id = fields.Many2one(related='step_id.model_id', readonly=True)

field_id = fields.Many2one('ir.model.fields', string='Field', required=True,    
domain="[('model_id', '=', model), ('ttype', 'not in', ['function', 'binary', 'many2many', 'many2one', 'one2many', 'reference'])]",    
ondelete='set null')

field_type = fields.Selection(related='field_id.ttype', string='Field Type', readonlyu=True)

In my case, it was a typing error in the readonly attribute of the field_type (I did type readonlyu), so it was not being recognized and the form was trying to modify it.

I know it was not your problem, but maybe another developer come here looking for info about the same message error.

Avatar
Discard
Best Answer

I think you are confusing a couple of things. It is never a good idea to mess directly with the Odoo source code. There is no need to either, since its all modular and you can change anything you want to from your own module.

First, if you want to write your own module, have a look at this guide:

https://doc.odoo.com/trunk/server/03_module_dev_01/

Secondly, for refence, check the modules path that your installation provided. My assumption is here is that you installed it yourself. Open the configuration file for your Odoo instance to find out what directories get loaded with Odoo (you will find them under addons_path). The shipping address should be in the "sale" or otherwise in the "stock" module somewhere. Do a grep commandline in the addons-directory to find out where it originates.

Lastly, add the path to your directory in this configuration file and you should be able to load your own module. So long as your module has the right dependencies (for example: sale,stock) you should be fine in altering what you wanted to in your example.

Good luck!

Avatar
Discard