Yes, you can add the required constraint to the name field. All i think @ced is saying here is that each time you update the database (by activating or updating a module or using trytond-admin
) the required constraint will get removed from the name field (because of the change made in series 4.0), and then it will see your customization and so will re-add the required constraint again.
However, as mentioned, you may want to consider using a different method to alert users to fields that should be filled in. One suggestion could be that, if for example the name is required because it must be shown on an invoice, then perhaps you could check the name is filled in before an invoice is posted, by raising a UserError
for a blank party name during the validate_invoice
or post
method from account.invoice
? Or maybe when a sale is confirmed?

Also be sure if you register an extension for a class defined in a module that your custom module depends on this module. It is important that the main class is registered first.
You need to include the module that your module depends on in the tryton.cfg
file. So if you are overriding things in the Party
class then you need to make sure that the module where the Party
class is defined (the party module) is included in the list of depends in tryton.cfg
.
You also need to make sure you register your customized Party
class in the register
method in your __init__.py
file with the correct module
and type_
arguments.
These two things together should then mean that the main Party
class from the party module is registered first, and then your customization of the Party
class is registered afterwards.