Skip to Content
मेन्यू
This question has been flagged
1 Reply
3657 Views

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
Discard

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

Author

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.

Author

Hello,

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

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

And the error disappeared.

Greetings

Best Answer

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
Discard

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 Replies Views Activity
0
मई 21
2316
2
जन॰ 23
2309
0
मई 22
2265
1
जुल॰ 25
2196
2
जुल॰ 25
7700