Override workflow button

When I want to override in a custom module some workflow I usually do this:

    @classmethod
    @ModelView.button
    @Workflow.transition('validated')
    def validate_invoice(cls, invoices):
        super().validate_invoice(invoices)
        # My stuff

But I notice that doing this it also works:

    @classmethod
    def validate_invoice(cls, invoices):
        super().validate_invoice(invoices)
        # My stuff

So I’m wondering if it’s needed for something the ModelView and Workflow. Also I want to question about other decorators like @set_employee('quoted_by').

Thanks.

1 Like

ModelView.button is a requirement to get security enforcement on your custom code.

For this other, it is better because it ensure the same behavior no matter if the method is extended or not.
And usually we can ignore the set_employee because it has no impact on the actual code of the method.

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