cls._buttons.update({
'draft': {
'invisible': Eval('state').in_(['request']),
},
'request': {
'invisible': Eval('state').in_(['draft']),
},
})
@classmethod
@ModelView.button
@Workflow.transition('request')
def draft(cls, myRequests):
..........
cls.write(myRequests,{
'request_date': datetime.now(),
})
The thing is, that I had defined two pair of views for the same model.
On both pair when I clicked on the draft button, doesn't save the register. Only does what it has to do (put the datetime.now() on request_date field).
When I wanted to close the form, one of the form only close after confirm the a save message.
On the other form, it doesn't close. Ask me over and over again to save the register.
When I comment the line cls.write(....), acts normally, but doesn't do what I want it to do.
Hi,
I'm using tryton 3.8. I'm trying to make a workflow that goes from draft state to request state. I defined the transitions, updates, and buttons:
@classmethod
def __setup__(cls):
super(myClass, cls).__setup__()
cls._transitions |= set((
('draft','request'),
))
cls._buttons.update({
'draft': {
'invisible': Eval('state').in_(['request']),
},
'request': {
'invisible': Eval('state').in_(['draft']),
},
})
@classmethod
@ModelView.button
@Workflow.transition('request')
def draft(cls, myRequests):