Hi,

On 2018-06-27 18:53, Oscar Alvarez wrote:
> It is possible to use field reference (origin) instead of Many2One?

Yes: 
http://doc.tryton.org/4.8/trytond/doc/ref/models/fields.html#trytond.model.fields.One2Many

> for  example in this case:
> 
> class A(...):
> 
>      name = fields.Char(......)
> 
>      documents = field.One2Many('document.notification', 'origin', '???')
> 
> class B(...):
> 
>      name = fields.Char(......)
> 
>      documents = field.One2Many('document.notification', 'origin', '???')
> 
> 
> 
> 
> class DocumentNotification(...):
>    anotherfields = .....
>    origin = fields.Reference('Origin', selection='get_origin') --> this 
> field keep reference to records from A model or B model or C model, etc.
> 

That's all you have to do. The '???' should be the string of the field.

-- 
Cédric Krier - B2CK SPRL
Email/Jabber: cedric.kr...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

-- 
You received this message because you are subscribed to the Google Groups 
"tryton-dev" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton-dev/20180628082943.GA3931%40kei.

Reply via email to