Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
3665 Weergaven

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
Annuleer

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

Auteur

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.

Auteur

Hello,

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

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

And the error disappeared.

Greetings

Beste antwoord

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
Annuleer

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.

Gerelateerde posts Antwoorden Weergaven Activiteit
0
mei 21
2320
2
jan. 23
2316
0
mei 22
2269
1
jul. 25
2214
2
jul. 25
7708