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

-- 
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/cbb22377-43d9-40fb-96a4-f809edf63a16%40googlegroups.com.

Reply via email to