İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
3659 Görünümler

Hi!


When building a custom module in odoo.sh I get the following error:


AssertionError: nombre is a required field ({'invisible': [('company_type', '=', 'company')], 'required': [('company_type', '=', 'person')]})

The field definition is:

nombre = fields.Char(string="Primer Nombre")

It is a simple field so I don't understand what the error means, could you please help me?


Thank you

Greetings


Avatar
Vazgeç

try deleting existing records in the table and see, whether the error is still there

Üretici

The error occurs when a build is generated in development, that is, with an empty database that from what I see later, demo data is generated.

Üretici

Hello,

Thanks Ray for your reply. Finally leave the field like this:

name = fields.Char (string = "First Name", default = "")

And the error disappeared.

Greetings

En İyi Yanıt

It appears you have made your nombre field required for all res.partner records where company_type = person.

The development branches run test suites which include creating res.partner records, but since those test suites don't know anything about your nombre field, they are not providing a value, which causes the error.

If you set a default value for your nombre field, then the Odoo test trying to create a res.partner record won't face the error, because the field will have a value as required.

 

Avatar
Vazgeç

Basically, this error should not occur even if a value is not provided.

completely similar as when we setup Odoo locally and there's a required field that is null, the system tells us there's a bad query precising that the required field has null value but most importantly, no error at all failing the run of Odoo.

It happens due to the nature of the testing code that is run during development builds of the branch on Odoo.sh - when you setup Odoo locally there are no such tests run unless you use the `--test-enable` option on the command-line or configuration file.

İlgili Gönderiler Cevaplar Görünümler Aktivite
0
May 21
2318
2
Oca 23
2312
0
May 22
2266
1
Tem 25
2198
2
Tem 25
7702