diff --git a/product_cores/__manifest__.py b/product_cores/__manifest__.py index d245ddf1..83abf041 100755 --- a/product_cores/__manifest__.py +++ b/product_cores/__manifest__.py @@ -3,7 +3,7 @@ { 'name': 'Product Cores', 'author': 'Hibou Corp. ', - 'version': '14.0.1.0.0', + 'version': '15.0.1.0.0', 'category': 'Tools', 'license': 'OPL-1', 'summary': 'Charge customers core deposits.', diff --git a/product_cores/models/purchase.py b/product_cores/models/purchase.py index 3f9673ae..95ba7087 100644 --- a/product_cores/models/purchase.py +++ b/product_cores/models/purchase.py @@ -17,6 +17,7 @@ class PurchaseOrder(models.Model): class PurchaseOrderLine(models.Model): _inherit = 'purchase.order.line' + qty_received = fields.Float(recursive=True) core_line_id = fields.Many2one('purchase.order.line', string='Core Purchase Line', copy=False) @api.model diff --git a/product_cores/models/sale.py b/product_cores/models/sale.py index 327af418..c1cfb7d9 100644 --- a/product_cores/models/sale.py +++ b/product_cores/models/sale.py @@ -17,6 +17,7 @@ class SaleOrder(models.Model): class SaleOrderLine(models.Model): _inherit = 'sale.order.line' + qty_delivered = fields.Float(recursive=True) core_line_id = fields.Many2one('sale.order.line', string='Core Sale Line', copy=False) @api.model diff --git a/product_cores/tests/test_product_cores.py b/product_cores/tests/test_product_cores.py index e7a760e8..2bbe195c 100644 --- a/product_cores/tests/test_product_cores.py +++ b/product_cores/tests/test_product_cores.py @@ -153,22 +153,13 @@ class TestProductCores(common.TransactionCase): def test_02_sale(self): # Need Inventory. - adjustment = self.env['stock.inventory'].create({ - 'name': 'Initial', - 'product_ids': [(4, self.product.id)], + adjust_quant = self.env['stock.quant'].with_context(inventory_mode=True).create({ + 'product_id': self.product.id, + 'inventory_quantity': 20.0, + 'location_id': self.env.ref('stock.warehouse0').lot_stock_id.id, }) - adjustment.action_start() - if not adjustment.line_ids: - adjustment_line = self.env['stock.inventory.line'].create({ - 'inventory_id': adjustment.id, - 'product_id': self.product.id, - 'location_id': self.env.ref('stock.warehouse0').lot_stock_id.id, - }) - adjustment.line_ids.write({ - # Maybe add Serial. - 'product_qty': 20.0, - }) - adjustment.action_validate() + adjust_quant.action_apply_inventory() + self.assertEqual(self.product.virtual_available, 20.0) sale = self.env['sale.order'].create({ 'partner_id': self.customer.id,