This question has been flagged
1 Reply
2539 Views

Hello house,

I have a many2many field on res.partner relating to product.template.

On the partner form page, a list of products has been selected for the partner.

My case is that when, when a quotation is been raised and any of the product in the selected list is been selected on sales order line, a warning message should show.

Please how can I achieve it on Odoo 10

Avatar
Discard
Best Answer

Hi Sputy,

You do like:

# first get partneron sale order

partner = self.partner_id


# loop to check any product in sale line is exist in partner form or not if, then raise warning

for line in self.order_line:

    for product_tmpl in partner.PRODUCT_TEMPLATE_MANY2MANY_FIELD:

        if product_tmpl.id == line.product_id.product_tmp_id.id:

            # Here you can set warning whatever you want


* PRODUCT_TEMPLATE_MANY2MANY_FIELD (many2many field that you have taken in partner form)

Accept and upvote answer if helpful

Thanks and regards

Haresh Kansara

Avatar
Discard