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

If you too hate the display of this forum, please refer:
https://gist.github.com/blaggacao/459255636f8abd8afe20

domain = ('foofield', 'operator', barvalue)

  • In my case barvalue IS a list.
  • I want foofield to be a list. More specifically, I want foofield to contain the values (as a list) of the many2many field 'foofield'
  • I want operator do define foofield as an entire subset of barvalue. (best guess: 'in')

I know this is probably not possible, so workaround, conceptual help would be nice...

Awatar
Odrzuć
Autor

Part of the Answer: https://github.com/odoo-colombia/odoo_advanced_tax_engine/blob/89b71c7ec836e69fb5eabdb24bc0491a93b60096/account_fiscal_allocation_rule/models/fiscal_allocation_rule.py#L147-L168 Still open: https://github.com/odoo-colombia/odoo_advanced_tax_engine/blob/89b71c7ec836e69fb5eabdb24bc0491a93b60096/account_fiscal_allocation_rule/models/fiscal_allocation_rule.py#L182-L184

Autor

Hope with this rewrite of the question, it is more understandable... :) Thanks.

Najlepsza odpowiedź

David,

The domain you wrote should simply work because the [(field, operator, value)] in your case is [] in [] and for many2many fields, this should suffice.

Do you face any errors, warnings?

Thanks.

Awatar
Odrzuć
Autor Najlepsza odpowiedź

Actually, https://github.com/odoo/odoo/blob/1f20f61ab4f6acf79f4db6ba9a17c1282014ef5f/openerp/osv/expression.py#L932-L971 supports your answer very well.

Errors might raise from different sources while debugging. I somehow was prone to believe this doesn't work because documentation (https://doc.openerp.com/v6.0/developer/2_5_Objects_Fields_Methods/methods.html/) states: 

field_name must be a valid name of field of the object model, possibly following many-to-one relationships using dot-notation, e.g 'street' or 'partner_id.country' are valid values

 

(explicitely states many2one but doesn't mention many2many )

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
lut 25
18
1
mar 15
3580
0
mar 15
3697
3
maj 24
5145
1
gru 20
3146