Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3911 Widoki

I'd like to have a many2one field in a model whose related model is given by the value of another field of the first model (or possibly a field of some other related model); i.e. the related model is not known until a resource is created. Something like:

class model(osv.osv):
    _columns = {'rel_model': fields.many2one('ir.model', 'Model'),
                'res_id': fields.many2one(lambda self, *a: self.rel_model, 'Resource')}

I'm aware of fields.reference, but I'd like to be able to separate the selection of model and resource, and still have a proper many2one widget to select the resource. And I'd also prefer to have a res_id field that contains a proper ID value; fields.reference stores a string "model,ID".

Any suggestions?

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
lut 25
6017
1
gru 24
1536
1
cze 24
4208
5
cze 23
35665
1
lis 22
16091