diff --git a/purchase_by_sale_history/tests/test_purchase_by_sale_history.py b/purchase_by_sale_history/tests/test_purchase_by_sale_history.py index 4b4c6d52..bef5421d 100644 --- a/purchase_by_sale_history/tests/test_purchase_by_sale_history.py +++ b/purchase_by_sale_history/tests/test_purchase_by_sale_history.py @@ -53,12 +53,12 @@ class TestPurchaseBySaleHistory(common.TransactionCase): # Assign vendor to products created earlier. self.env['product.supplierinfo'].create({ - 'name': purchase_partner.id, + 'partner_id': purchase_partner.id, 'product_tmpl_id': product11.product_tmpl_id.id, 'product_id': product11.id, }) self.env['product.supplierinfo'].create({ - 'name': purchase_partner.id, + 'partner_id': purchase_partner.id, 'product_tmpl_id': product2.product_tmpl_id.id, }) # New wizard picks up the correct number of products supplied by this vendor. diff --git a/purchase_by_sale_history/wizard/purchase_by_sale_history.py b/purchase_by_sale_history/wizard/purchase_by_sale_history.py index efb86018..c231a03d 100644 --- a/purchase_by_sale_history/wizard/purchase_by_sale_history.py +++ b/purchase_by_sale_history/wizard/purchase_by_sale_history.py @@ -40,8 +40,8 @@ class PurchaseBySaleHistory(models.TransientModel): self.env.cr.execute("""SELECT COUNT(DISTINCT(psi.product_id)) + COUNT(DISTINCT(p.id)) FROM product_supplierinfo psi LEFT JOIN product_product p ON p.product_tmpl_id = psi.product_tmpl_id AND psi.product_id IS NULL - WHERE psi.name = %d;""" - % (wiz.purchase_id.partner_id.id, )) + WHERE psi.partner_id = %s;""", + (wiz.purchase_id.partner_id.id,)) wiz.product_count = self.env.cr.fetchall()[0][0] def _history_product_ids(self): @@ -51,8 +51,8 @@ class PurchaseBySaleHistory(models.TransientModel): self.env.cr.execute("""SELECT DISTINCT(COALESCE(psi.product_id, p.id)) FROM product_supplierinfo psi LEFT JOIN product_product p ON p.product_tmpl_id = psi.product_tmpl_id AND psi.product_id IS NULL - WHERE psi.name = %d;""" - % (self.purchase_id.partner_id.id, )) + WHERE psi.partner_id = %s;""", + (self.purchase_id.partner_id.id,)) rows = self.env.cr.fetchall() return [r[0] for r in rows if r[0]]