On 06/12/10 02:55 -0800, Ian Wilson wrote:
> Hello,
> 
> Sorry forgot difference between tryton and tryton-dev.  Moved this question
> from tryton to here.
> 
> I have wizard that I want to interact only with model views.  My users will
> use the wizard to lookup inventory and pricing for a product.
> 
> I have created a module and things are going along okay except I want to set
> values for a Many2One field.  I'm not sure what to pass in or if its even
> possible.
> 
> I have an action that precedes the form like this:
> 
>         'check': {
>             'actions': ['_check'],
>             'result': {
>                 'type': 'form',
>                 'object': 'product.stock_price_check.init',
>                 'state': [
>                     ('end', 'Cancel', 'tryton-cancel'),
>                     ('check', 'Check', 'tryton-ok', True),
>                 ],
>             },
>         }
> 
> The action should return the fields that I want to be used in the form(or at
> least that seems to work).
> 
> I cannot figure out what to pass for Many2One fields such as this:
> 
> class CheckProductInit(ModelView):
>     _name = 'product.stock_price_check.init'
>     #...
>     stock_lines =
>  fields.One2Many('product.stock_price_check.init.stock_line',
> 'check_product', 'Stock Lines',
>             readonly=True)
> 
> I need to make these stock lines, they are a class that inherits from
> ModelView, in _check and send them to the form but ModelView does not have
> create method and a dictionary does not work.  I thought I had done this
> before in another module but I can't find any examples of this in my modules
> or in the system modules.
> 
> Anyways any help would be appreciated.

The format for One2Many is a list of dictionnary where the keys are the field
names of the targeted Model.

-- 
Cédric Krier

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/

Attachment: pgpbMuXzPkh18.pgp
Description: PGP signature

Reply via email to