mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[MIG] stock_available_immediately: Migration to 14.0
This commit is contained in:
@@ -6,8 +6,9 @@
|
||||
|
||||
{
|
||||
"name": "Ignore planned receptions in quantity available to promise",
|
||||
"version": "12.0.1.0.0",
|
||||
"version": "14.0.1.0.0",
|
||||
"depends": ["stock_available"],
|
||||
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
||||
"author": "Camptocamp,Sodexis,Odoo Community Association (OCA),Sergio Díaz",
|
||||
"license": "AGPL-3",
|
||||
"category": "Hidden",
|
||||
|
||||
@@ -9,11 +9,8 @@ from odoo import api, models
|
||||
class ProductProduct(models.Model):
|
||||
_inherit = "product.product"
|
||||
|
||||
@api.multi
|
||||
def _compute_available_quantities_dict(self):
|
||||
res, stock_dict = super(
|
||||
ProductProduct, self
|
||||
)._compute_available_quantities_dict()
|
||||
res, stock_dict = super()._compute_available_quantities_dict()
|
||||
for product in self:
|
||||
res[product.id]["immediately_usable_qty"] -= stock_dict[product.id][
|
||||
"incoming_qty"
|
||||
@@ -22,4 +19,4 @@ class ProductProduct(models.Model):
|
||||
|
||||
@api.depends("virtual_available", "incoming_qty")
|
||||
def _compute_available_quantities(self):
|
||||
return super(ProductProduct, self)._compute_available_quantities()
|
||||
return super()._compute_available_quantities()
|
||||
|
||||
@@ -7,3 +7,4 @@
|
||||
* `Tecnativa <https://www.tecnativa.com>`_:
|
||||
|
||||
* Pedro M. Baeza
|
||||
* Florian da Costa <florian.dacosta@akretion.com>
|
||||
|
||||
@@ -14,38 +14,36 @@ class TestStockLogisticsWarehouse(TransactionCase):
|
||||
in stock, both on product and template.
|
||||
"""
|
||||
moveObj = self.env["stock.move"]
|
||||
productObj = self.env["product.product"]
|
||||
templateObj = self.env["product.template"]
|
||||
supplier_location = self.env.ref("stock.stock_location_suppliers")
|
||||
stock_location = self.env.ref("stock.stock_location_stock")
|
||||
customer_location = self.env.ref("stock.stock_location_customers")
|
||||
uom_unit = self.env.ref("uom.product_uom_unit")
|
||||
|
||||
# Create product template
|
||||
templateAB = templateObj.create({"name": "templAB", "uom_id": uom_unit.id})
|
||||
# Create product template with 2 variant
|
||||
templateAB = templateObj.create(
|
||||
{"name": "templAB", "uom_id": uom_unit.id, "type": "product"}
|
||||
)
|
||||
self.env["product.template.attribute.line"].create(
|
||||
{
|
||||
"product_tmpl_id": templateAB.id,
|
||||
"attribute_id": self.env.ref("product.product_attribute_2").id,
|
||||
"value_ids": [
|
||||
(
|
||||
6,
|
||||
0,
|
||||
[
|
||||
self.env.ref("product.product_attribute_value_3").id,
|
||||
self.env.ref("product.product_attribute_value_4").id,
|
||||
],
|
||||
)
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
# Create product A and B
|
||||
productA = productObj.create(
|
||||
{
|
||||
"name": "product A",
|
||||
"standard_price": 1,
|
||||
"type": "product",
|
||||
"uom_id": uom_unit.id,
|
||||
"default_code": "A",
|
||||
"product_tmpl_id": templateAB.id,
|
||||
}
|
||||
)
|
||||
|
||||
productB = productObj.create(
|
||||
{
|
||||
"name": "product B",
|
||||
"standard_price": 1,
|
||||
"type": "product",
|
||||
"uom_id": uom_unit.id,
|
||||
"default_code": "B",
|
||||
"product_tmpl_id": templateAB.id,
|
||||
}
|
||||
)
|
||||
productA = templateAB.product_variant_ids[0]
|
||||
productB = templateAB.product_variant_ids[1]
|
||||
|
||||
# Create a stock move from INCOMING to STOCK
|
||||
stockMoveInA = moveObj.create(
|
||||
|
||||
Reference in New Issue
Block a user