Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

RE: [Odoo CE 17.0] Fields related to custom fields don't save any values

by
johan
- 19/12/2024 12:39:45

Dear,

 

You use many2one field. That are pointers to an record in a different model. See https://www.odoo.com/documentation/18.0/developer/reference/backend/orm.html#fields. In this field, odoo stores an ID of the related record in the different model. Here you define a link to the same model. I guess you better use basic fields than. So make product_measures_length = fields.Integer(“Largo”). Now you can store a length as 100 in this field. I guess a field name length is sufficient. In an other model, you can reference your field as product.measures.lenght. Now you need product.measures.product_measures_length…

 

With kind regards,

 

Van Hirtum Johan

 

Van: Redes Sociales JLBBERP [mailto:notifications@odoo-community.org]
Verzonden: donderdag 19 december 2024 10:02
Aan: Contributors
Onderwerp: Re: [Odoo CE 17.0] Fields related to custom fields don't save any values

 

Hello everyone,

 

Since my first message related to the problem seen in the title, I made some progress, but I'm still not able to store values on the custom fields.

 

But recently, thanks to another OCA addon I had installed in the odoo server, I noticed that the only thing I needed to store the values is just the custom model (which is called "product.measures"), so I don't need to create custom fields inside the custom model, because they are already created outside the custom model.

 

To sum up, I will reupload the link to my company's GitHub repository, which has been recently updated, so anyone can see the module I modified:

 

 

Any help is appreciated, because right now, I'm in a "stand-by" situation.

 

Best regards

El 13/12/2024 9:04 CET Redes Sociales JLBBERP <redes_sociales@jlbberp.com> escribió:

 

 

Hello Houssine,

 

Of course, I'm sending you the link to the custom code in GitHub:

 

 

The custom code is inside the "models" folder.

 

Best regards.

El 12/12/2024 15:17 CET Houssine BAKKALI <notifications@odoo-community.org> escribió:

 

 

Hi,

 

Could you show the custom code to allow us to have a better view of what you did ?

 

Don't hesitate to put your question on the odoo forum and share the link with us.

 

Regards, 

Houssine

 

Le mar. 10 déc. 2024, 10:58, Redes Sociales JLBBERP <notifications@odoo-community.org> a écrit :

Hello Jesus,

 

I don't fully understand what you mean by "add the name field in the module". Do you mean giving the module a name field like "_name="product.example""?

El 10/12/2024 10:32 CET Jesus Sokamby <notifications@odoo-community.org> escribió:

 

 

 

Hi, there,
I suggest you add the name field in the model and also the security/ir.model.access.csv file in the module.

 

Le mar. 10 déc. 2024 à 10:08, Francesco Ballerini <notifications@odoo-community.org> a écrit :

Hello, add parameter `store=True` on those related fields. Update module after it.

 

Regards

 

--Francesco Ballerini

 

Il giorno mar 10 dic 2024 alle ore 09:38 Redes Sociales JLBBERP <notifications@odoo-community.org> ha scritto:

Hello everyone,

 

I am writing this message because I need help with making fields related to custom fields store values into the database.

 

Some days ago, I made a custom model through Python called "product_measures", which is inside a model called "product_dimension". Said model not only has three Many2one fields, each one for the product's measures, but is also inside another model of "product_dimension" called "product_template", which has the same fields but with the related field section and different names. The problem is that whenever I write anything on the fields, it doesn't save anything. Also, I'm trying to make it so every value that is created and is a number is converted into a Float.

 

I'm sending the module in a zip file because I have been stuck with this problem for quite some time, and I would like to solve this problem as soon as possible.

 

Thanks in advance for anyone who answers.

 

Best regards.

Fout! Bestandsnaam niet opgegeven.

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe

 

Fout! Bestandsnaam niet opgegeven.

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe

 

 

_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe

Reference