Hi all,
I'm also quite new to Tryton development and I really like what I've
seen so far. I'm working on some modules to make myself more familair
with the framework.
I'm encountering a small issue with a one2many field.
My class includes two one2many fields: "party" and "contact".
party = fields.Many2One("party.party", 'Party', required=True)
contact = fields.Many2One("party.address", 'Contactperson',
required=True,
domain = [
('party', '=', Eval('party')),
('delivery', '=', False),
('invoice', '=', False),
],
When I make a dedicated module with a form, this works. When I change
party, I can only select contactpersons from that party (technically
it is redundant to store both in the same record, but from usability
perspective I really want the user to first select the company, then
the contactperson. I may solve this technically later by using a
Function field for party or something). However, for now everything
works as expected.
Then I inherit the party.party object and add a One2Many field to
above's described model and create an altered view.
This is the field that I add into the inherited party.party model:
visitreports = fields.One2Many('party.visit', 'party', 'Visit
reports')
Still works correctly, I see the objects for the selected party now.
However, when I click "New record" button on this One2Many field, I
have a small problem. The window that is displayed now does not
contain the "party" field (which is understandable), but now the
"contact" field does not work as a result. It doesn't find any
contactperson. I guess it can't evaluate Eval('party') in this
scenario correctly (I do not see any erros in the logs, however).
Would there be a way to solve this, so that this construction will
work in both standalone forms and One2Many fields?
Best regards,
Vincent
--
[email protected] mailing list