El jueves, 17 de agosto de 2017, 4:00:06 (UTC-3), Cédric Krier escribió:
> On 2017-08-16 22:01, Francisco Maria Moyano Casco wrote:
> > 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):
> >          ..........
> >          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.
> 
> 
> Is 'request_date' a Date field? Or is it a DateTime?
> If it is a Date, you must use date.today() instead of datetime.now()
> (and even better to use Pool().get('ir.date').today())

It is a DateTime. But the issue is not there. If I use another field, say a 
Char, it acts like I just described.

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/89b23ba5-95ff-4e95-817d-b490501e6b0d%40googlegroups.com.

Reply via email to