This question has been flagged
4 Replies
3280 Views

how to verify vendor on the purchase order for a product is same as the vendor given on the product details in odoo12   community version

Avatar
Discard
Author Best Answer

i got answer

class VendorValidate(models.Model):
    _inherit = 'purchase.order'
   
    @api.multi
    def _add_supplier_to_product(self) :
        vendor_list=[]
        for order in self:
            for line in order.order_line:
                if order.partner_id.id not in line.product_id.variant_seller_ids.mapped('name.id'):
                    vendor_list.append(line.product_id.name)       
            else:
                 if vendor_list:
                    raise UserError("raise error")   

Avatar
Discard
Best Answer

Hello,

Can you give me some details about your case ?

Are you talking about Enterprise or Community ?

----------

Thanks.

Acespritech Solutions Pvt Ltd.

Apps on Odoo Store  : https://www.odoo.com/apps/modules/browse?search=acespritech

Skype: acespritech

Website: http://www.acespritech.com

Avatar
Discard
Best Answer

You need to provide more details about the purchase order and vendor. Also, enterprise information needs to be listed.

Avatar
Discard
Best Answer

First why you want to verify , because here you are selecting vendor and you know from where you are going to purchase. 

While the vendor list in product detail is simply the pricelist. If you have valid pricelist from the same vendor then you get the prices. If not still you can update the prices on purchase order itself.

BTW your requirements you can easily get/guess by adding product and supplier, if vendor is one defined on product then you can get the prices. Now if you got 0 prices means either you haven't defined vendor on product details or not matched the conditions.

Avatar
Discard