Community mailing list archives
Re: Set custom domain when displaying existing record (when onchange is not triggered)by
A better solution is to have a domain depending on other computed field, and put the logic on the compute method of that field. See an example here:Regards.
Domain definition: https://github.com/odoomrp/odoomrp-wip/blob/8.0/sale_product_variants/models/sale_order.py#L51
Compute method: https://github.com/odoomrp/odoomrp-wip/blob/8.0/sale_product_variants/models/sale_order.py#L382015-09-16 10:11 GMT+02:00 Graeme Gellatly <email@example.com>:
If it is just a domain for search / constraints all I do is set a fake xml domain like (field, =, sol_o2m) .
Then use an override of search to test for it and transform it to the actual domain I want.
It isn't exactly your use case but the concept will work.
Sent from TypeMailOn 16 Sep 2015, at 6:07 PM, Jonathan Wilson <firstname.lastname@example.org> wrote:Hi CommunityWe have a need for a fairly complex domain on a many2one on sales order lines on the form view that pops up from sales order header.While it can be easily calculated in one browse and lookup, it cannot be expressed in the xml. (The domain, in some cases, simply ends up being [('id', 'in', (x, y))]This is triggered by onchanges and works well for new data, or when data changes.However, when opening an existing line, the onchanges are not triggered.Since the domain should be set for an existing record and there is no way to code it in to the default domain, is there a way we could cause the display of an existing record to trigger an onchange? Even if I define a new invisible column on the view, I can not think of any way to get a new record to put a value in there to cause an onchange!
Willow IT, Jon Wilson