I have been reading and practicing with coopengo tryton-training, and wow, what a tutorial. It’s been an awesome help to develop the account_ao module in a more or less straightforward way. It does a pretty good job on developing a module in Tryton ERP.
After pretty much finishing the development of the module, there are fields that I need to make them required, so I can export the data of the field to an XML file. In the tutorial, specifically in the last step, it explains how can we override some module, which IMHO is one of the best developer feature Tryton offers.
So after reading and following the last step, specifically this step, I could change the description field, for example, of the product to be a required field in this way:
class Product(ModelSQL, metaclass=PoolMeta): __name__ = 'product.product' @classmethod def __setup__(cls): super(Product, cls).__setup__() cls.description.required = True
And it works fine. However, I don’t know whether it’s the best way to do this.
I say this because after I start implementing other required needed fields, there are situations that this approach does not work as expected. For example, one of the fields that I need to make it required is in the party module in which I need to make, for example, the name of the product field as a required field. So following the same approach as before I did the following:
class Party(ModelSQL, metaclass=PoolMeta): "Party" __name__ = 'party.party' @classmethod def __setup__(cls): super(Party, cls).__setup__() cls.name.required = True
However, for some reason it does not work. The field still not required, and works as if I didn’t make the party name field required and the user can save a product without the name field.
Can you guys help me with this.
Thank you all for the great work.