El jueves, 12 de abril de 2018, 9:27:28 (UTC+2), Sergi Almacellas Abellana  
escribió:
> El 11/04/18 a les 13:21, Javier Uribe ha escrit:
> > I have a wizard to modify data from a model (pretty similar to 
> > http://hg.tryton.org/modules/sale/file/default/sale.py#l1861)
> > 
> > so we have a method default_start:
> > 
> >  def default_start(self, fields):
> >         batch = self.get_batch()
> >         defaults = {}
> > 
> >         for fieldname in fields:
> >             value = getattr(batch, fieldname)
> >             if isinstance(value, Model):
> >                 if getattr(batch.__class__, fieldname)._type == 'reference':
> >                     value = str(value)
> >                 else:
> >                     value = value.id
> >             elif isinstance(value, (list, tuple)):
> >                 value = [r.id for r in value]
> >             defaults[fieldname] = value
> > 
> >         defaults['state'] = 'draft'
> >         return defaults
> > 
> > On write method I check that the batch is on draft state so it should fail 
> > but 
> > as I put the state to 'draft' on the default_start method now I can write 
> > without any problem. That is to say, I have mimiced a draft mode so I can 
> > modify the model using the write method. And so it happens and it works 
> > using Tryton client.
> > 
> > Now if I do this on proteus:
> >     >>> edit_batch = Wizard('agro.farm.batch.edit', [batch])
> >     >>> edit_batch.execute('modify')
> > 
> > The test fails because of domain (the check I said I had on the write 
> > method). So it is like the draft is not considered on proteus or something 
> > weird happens
> > 
> Could you please clarify which tests fails and which error are you
> having? It will be great to have the error traceback for more information.
> 
> -- 
> Sergi Almacellas Abellana
> www.koolpi.com
> Twitter: @pokoli_srk

It was my bad, sorry, it didn't have to do with the domain check but thank you.

-- 
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/04d5aff9-7e84-496c-95d9-d0ae6dbf83be%40googlegroups.com.

Reply via email to