Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
3701 Zobrazení

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
Zrušit

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

Autor

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.

Autor

Hello,

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

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

And the error disappeared.

Greetings

Nejlepší odpověď

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
Zrušit

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.

Related Posts Odpovědi Zobrazení Aktivita
0
kvě 21
2361
2
led 23
2356
0
kvě 22
2278
1
čvc 25
2294
2
čvc 25
7758