2017-04-25 13:48 GMT-03:00 Ul <[email protected]>:

> Am 25.04.2017 um 18:24 schrieb Mark Shane Hayden:
> > Hi...see my comments within your message below:
> >
> > On Apr 25, 2017 10:16, "Ul" <[email protected] <mailto:[email protected]>> wrote:
> >
> >     Hello,
> >
> >     i have a Problem with domains on a fields.Reference:
> >
> >     I want to restrict the value of a Many2One field depending on a
> >     fields.Reference in the target.
> >
> >     The target is a stock.lot that i extended with a field.Reference
> called
> >     'origin'.
> >
> >     Now i want to restrict the lots in a M2O-field in another Model to a
> >     certain lot.origin.
> >
> >     One try was giving the value of the Reverence as a tuple:
> >
> >     supplier_lot = fields.Many2One('stock.lot', 'Supplier Lot',
> >         domain=[ ('origin', '=',
> >                    ('party.party', Eval('context', {}).get('supplier',
> -1))
> >                  ),
> >                  ('product', '=', Eval('product'))
> >                ])
> >
> >     This way it works fine when creating:
> >       - only the right Lots are sugested in the search
> >       - creating new lots the origin fields are filled with the right
> values
> >       - the new lot is saved to all right with the right origin
> >     but when i want to save the record with the field 'supplier_lot'
> >     containing the domain, i get a popup stating that i cant save
> because of
> >     a domain mismach in this field. Did i miss anything here, or is this
> a
> >     bug? Unfortunaltelly i was not able to spot the very place this
> domain
> >     is validated and fails.
> >
> >     The other try was using a fouth parameter in the domain with even
> worse
> >     result:
> >
> >     supplier_lot = fields.Many2One('stock.lot', 'Supplier Lot',
> >         domain=[ ('origin', '=',
> >                    Eval('context', {}).get('supplier', -1),
> >                    'party.party'
> >                  ),
> >                  ('product', '=', Eval('product'))
> >                ])
> >
> >
> > This four parameter version may seem "worse" but it is closer to the
> > correct answer.
> >
> > You need to compare on origin.id <http://origin.id> not just origin:
> >
> > domain=[ ('origin.id <http://origin.id>', '=',
> >                Eval(...
> >
> > See if that works for you.
> >
> Thanks, like this I did get as far as with the tuple: i can find or
> create the lot, but still can't save the record containing the domain
> because of domain mismatch.
> And now the origin field is not filled automatically when i create a new
> lot according to the domain as it was with the tuple.
>
>
​Maybe a dumb question, but:
Did you add 'product' to the depends ?​



>
>
> --
> 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/b3e97a8e-f4b5-1412-2b73-b4d7d7c949c0%40gmx.de.
>



-- 
-------------------------
Karla  Mª  Stenger  Sábat
[email protected]

-- 
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/CAF9qxNrmj9q9EnOi6KN2_zrGfTEpUnwguRxQ9TC6HhCGKkH-FQ%40mail.gmail.com.

Reply via email to