Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Hello Odoo community,
I'm making a custom module to manage access to building.
When granting access the user can select many partners. Once done, he can log departure for one or all of them.
For this purpose i created a model :
Access Model :
parter_ids = One2many(comodel_name="res.partner",inverse_name="Access_id")
def get_log_departure_view(self) :
So, the departure view is triggered by a button in the xml view, i tried something like :
<field name="partner_ids" widget="many2many_tags" readonly="1"/>
but this does not work, i have the following error : not all arguments converted during string formatting
I think that's because partner_ids/partner_ids.id is substituted to something like "[ID,?,[ID1,ID2..]]"
Any idea, suggestion or solution for what I'm trying to achieve would be a great help :)
The full code of your "Access Model" would be nice, because it is hard to understand what you are trying to achieve. It seems that both of your One2many fields point to the same inverse_name, thus meaning they will always show the same data? I have a feeling that a partner might have access to more than one building? If so you're probably better off using a Many2many relation.
As for your domain, try changing it to this:
domain="[('id', 'in', partner_ids.ids)]"
Again, not sure why you need 2 One2many fields with the same inverse field, instead of focusing on the problem, try to explain your end goal, maybe then we can form a better solution for you.
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 7/17/17, 9:21 AM|
|Seen: 99 times|
|Last updated: 7/17/17, 10:24 AM|