I have one model, that I use to show and edit my values/fields and two or more models that are generated always with identical fields through other modules.
This sub-models containing different transaction engines. I want to integrate the fields of the sub-models into my main model depending on a field that contains the sub-model name. The clue is that some of my fields in the main model should than point to the corresponding fields in the sub-models.
I tried different things as switching the environment, inheritance or using referenced fields. But nothing seems to work in a way that is useful.
Any ideas how to get this to work.?
For a better understanding I place here some code of my trial with fields.Reference:
ref_provider = fields.Reference(
[('exchange.provider.internal', 'Internal'), ('exchange.provider.dumy', 'Dumy')],
balance = fields.Float(
'Balance Pr', related='ref_provider.balance') # NOT WORKING!!!
With the field ref_provider I declare witch transaction engine (Account) I will use. The Balance field should then show the Balance of this Account. But this creates an error because it is not a normal relation. I could try to get out the model and the id separat from re_provider and then merge it together for the related field.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 4/5/16, 9:21 AM|
|Seen: 529 times|
|Last updated: 9/2/16, 5:00 AM|