How can I create a table under a vendor/contact that shows a list of products associated with that vendor? I'd like to be able to open up a contact and see all of the products that have that contact set as the vendor, but I'm not sure how to do this. I'm guessing it's a many2one relationship?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
I am new here and would like to know on how to go about creating this report. Does anyone have step by step instructions or video? Thank you.
Hi,
You can try this code:
|
Add a Many2many field to link contacts to products in models.py:
from odoo import models, fields, api |
Create a file views/res_partner_views.xml:
<odoo>
<data>
<record id="view_res_partner_form_
<field name="name">res.partner.form.
<field name="model">res.partner</fiel
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='contacts']
<field name="product_ids" widget="many2many_tags" options="{'no_create': True}" context="{'default_vendor_id': id}"/>
</xpath>
</field>
</record>
</data>
</odoo>
Hope it helps
Thanks for the reply! I'm new to Odoo and am not sure where I would go to try the code. Can you provide a more detailed explanation of where to do that at?
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
Inscribirse