diff --git a/product_cores/__manifest__.py b/product_cores/__manifest__.py index 83abf041..0695c131 100755 --- a/product_cores/__manifest__.py +++ b/product_cores/__manifest__.py @@ -3,7 +3,7 @@ { 'name': 'Product Cores', 'author': 'Hibou Corp. ', - 'version': '15.0.1.0.0', + 'version': '16.0.1.0.0', 'category': 'Tools', 'license': 'OPL-1', 'summary': 'Charge customers core deposits.', @@ -12,6 +12,7 @@ Charge customers core deposits. """, 'website': 'https://hibou.io/', 'depends': [ + 'delivery', 'sale_stock', 'purchase_stock', ], diff --git a/product_cores/models/product.py b/product_cores/models/product.py index b88df8d9..a5376356 100644 --- a/product_cores/models/product.py +++ b/product_cores/models/product.py @@ -48,7 +48,7 @@ class ProductProduct(models.Model): product_core_id = fields.Many2one('product.product', string='Product Core') def get_purchase_core_service(self, vendor): - seller_line = self.seller_ids.filtered(lambda l: l.name == vendor and l.product_core_service_id) + seller_line = self.seller_ids.filtered(lambda l: l.partner_id == vendor and l.product_core_service_id) # only want to return the first one for l in seller_line: return l.product_core_service_id diff --git a/product_cores/tests/test_product_cores.py b/product_cores/tests/test_product_cores.py index 2bbe195c..aa979d35 100644 --- a/product_cores/tests/test_product_cores.py +++ b/product_cores/tests/test_product_cores.py @@ -77,7 +77,7 @@ class TestProductCores(common.TransactionCase): # Create a supplierinfo for this vendor with a core service product self.env['product.supplierinfo'].create({ - 'name': self.vendor.id, + 'partner_id': self.vendor.id, 'price': 10.0, 'product_core_service_id': self.product_core_service.id, 'product_tmpl_id': self.product.product_tmpl_id.id, @@ -111,7 +111,7 @@ class TestProductCores(common.TransactionCase): self.assertEqual(purchase.state, 'purchase') self.assertEqual(len(purchase.picking_ids), 1) self.assertEqual(len(purchase.picking_ids.move_line_ids), 1) # shouldn't have the service - purchase.picking_ids.move_line_ids.qty_done = purchase.picking_ids.move_line_ids.product_uom_qty + purchase.picking_ids.move_line_ids.qty_done = purchase.picking_ids.move_line_ids.reserved_uom_qty purchase.picking_ids.button_validate() purchase.flush() @@ -195,13 +195,13 @@ class TestProductCores(common.TransactionCase): sale.action_confirm() self.assertTrue(sale.state in ('sale', 'done')) self.assertEqual(len(sale.picking_ids), 1) - self.assertEqual(len(sale.picking_ids.move_lines), 1) - self.assertEqual(sale.picking_ids.move_lines.product_id, self.product) + self.assertEqual(len(sale.picking_ids.move_ids), 1) + self.assertEqual(sale.picking_ids.move_ids.product_id, self.product) sale.picking_ids.action_assign() - self.assertEqual(so_line.product_uom_qty, sale.picking_ids.move_lines.reserved_availability) - for move_line in sale.picking_ids.mapped('move_lines.move_line_ids'): - move_line.qty_done = move_line.product_uom_qty + self.assertEqual(so_line.product_uom_qty, sale.picking_ids.move_ids.reserved_availability) + for move_line in sale.picking_ids.mapped('move_ids.move_line_ids'): + move_line.qty_done = move_line.reserved_uom_qty sale.picking_ids.button_validate() self.assertEqual(sale.picking_ids.state, 'done') self.assertEqual(so_line.qty_delivered, so_line.product_uom_qty) @@ -235,8 +235,8 @@ class TestProductCores(common.TransactionCase): return_picking = sale.picking_ids.filtered(lambda p: p.state != 'done') self.assertTrue(return_picking) - for move_line in return_picking.mapped('move_lines.move_line_ids'): - move_line.qty_done = move_line.product_uom_qty + for move_line in return_picking.mapped('move_ids.move_line_ids'): + move_line.qty_done = move_line.reserved_uom_qty return_picking.button_validate() self.assertTrue(all(l.qty_delivered == 0.0 for l in sale.order_line)) diff --git a/product_cores/views/product_views.xml b/product_cores/views/product_views.xml index da7157d9..ea0d19d0 100644 --- a/product_cores/views/product_views.xml +++ b/product_cores/views/product_views.xml @@ -49,7 +49,7 @@ product.supplierinfo - +