To add a default value to recently added party field in POS Sale

Hi everyone! Sorry I am new to Tryton, so I face a lot of problems even by adding very basic features.

Recently, I’ve added this field to POS Sale class and the problem I’m facing is that every time I am creating a new POS Sale entry I’ve to manually select party from the selection area (that magnifying icon). What I want to do instead is to have a default value for this thing, so I don’t have to manually select every time for new entry
I mean to say that the party section should not be blank it should have a default value

party = fields.Many2One('', "Party", depends=['state'], states={
        'required': Eval('state', 'open') == 'done',
        'readonly': Eval('state', 'open') == 'posted'

You can define default value for the Model by adding a method default_party, see Set default values — trytond latest documentation
As party is a Many2One the method must return the id of the party.

1 Like

You solved my problem! Thank you so much <3

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.