mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[MIG] product_cores: to Odoo 15.0
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
{
|
||||
'name': 'Product Cores',
|
||||
'author': 'Hibou Corp. <hello@hibou.io>',
|
||||
'version': '14.0.1.0.0',
|
||||
'version': '15.0.1.0.0',
|
||||
'category': 'Tools',
|
||||
'license': 'OPL-1',
|
||||
'summary': 'Charge customers core deposits.',
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user