Skip to content

Commit

Permalink
[MIG] stock_available_mrp: Migration to 13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ps-tubtim committed Mar 4, 2021
1 parent 71fa1c4 commit fc49cf9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
8 changes: 4 additions & 4 deletions stock_available_mrp/demo/mrp_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
ref="mrp.product_product_table_kit_product_template"
/>
<field
name="attribute_value_ids"
name="product_template_attribute_value_ids"
eval="[(6,0,[ref('product.product_attribute_value_3')])]"
/>
</record>
<record id="mrp.product_product_table_kit" model="product.product">
<field
name="attribute_value_ids"
name="product_template_attribute_value_ids"
eval="[(6,0,[ref('product.product_attribute_value_4')])]"
/>
</record>
<record id="mrp.mrp_bom_kit_line_2" model="mrp.bom.line">
<field
name="attribute_value_ids"
name="bom_product_template_attribute_value_ids"
eval="[(6,0,[ref('product.product_attribute_value_4')])]"
/>
</record>
Expand All @@ -40,7 +40,7 @@
<field name="sequence">5</field>
<field name="bom_id" ref="mrp.mrp_bom_kit" />
<field
name="attribute_value_ids"
name="bom_product_template_attribute_value_ids"
eval="[(6,0,[ref('product.product_attribute_value_3')])]"
/>
</record>
Expand Down
6 changes: 2 additions & 4 deletions stock_available_mrp/models/product_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class ProductProduct(models.Model):
def _compute_available_quantities(self):
super(ProductProduct, self)._compute_available_quantities()

@api.multi
def _get_bom_id_domain(self):
"""
Real multi domain
Expand All @@ -31,7 +30,6 @@ def _get_bom_id_domain(self):
("product_tmpl_id", "in", self.mapped("product_tmpl_id.id")),
]

@api.multi
@api.depends("product_tmpl_id")
def _compute_bom_id(self):
bom_obj = self.env["mrp.bom"]
Expand All @@ -43,8 +41,9 @@ def _compute_bom_id(self):
)
if product_boms:
product.bom_id = first(product_boms)
else:
product.bom_id = False

@api.multi
def _compute_available_quantities_dict(self):
res, stock_dict = super(
ProductProduct, self
Expand Down Expand Up @@ -117,7 +116,6 @@ def _compute_available_quantities_dict(self):

return res, stock_dict

@api.multi
def _explode_boms(self):
"""
return a dict by product_id of exploded bom lines
Expand Down
1 change: 1 addition & 0 deletions stock_available_mrp/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
* Laurent Mignon <laurent.mignon@acsone.eu>
* Cédric Pigeon <cedric.pigeon@acsone.eu>
* Florian da Costa <florian.dacosta@akretion.com>
* Pimolnat Suntian <pimolnats@ecosoft.co.th>
17 changes: 6 additions & 11 deletions stock_available_mrp/tests/test_potential_qty.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def create_inventory(self, product_id, qty, location_id=None):
location_id = self.wh_main.lot_stock_id.id

inventory = self.env["stock.inventory"].create(
{"name": "Test inventory", "location_id": location_id, "filter": "partial"}
{"name": "Test inventory", "location_ids": [(4, location_id)]}
)
inventory.action_start()
self.env["stock.inventory.line"].create(
Expand Down Expand Up @@ -129,8 +129,7 @@ def test_potential_qty_no_bom_for_company(self):
{
"name": "Receive CPUa8",
"company_id": chicago_id,
"location_id": self.wh_ch.lot_stock_id.id,
"filter": "partial",
"location_ids": [(4, self.wh_ch.lot_stock_id.id)],
}
)
inventory.action_start()
Expand All @@ -150,8 +149,7 @@ def test_potential_qty_no_bom_for_company(self):
{
"name": "components for 1st variant",
"company_id": chicago_id,
"location_id": self.wh_ch.lot_stock_id.id,
"filter": "partial",
"location_ids": [(4, self.wh_ch.lot_stock_id.id)],
}
)
inventory.action_start()
Expand Down Expand Up @@ -212,8 +210,7 @@ def test_potential_qty(self):
inventory = self.env["stock.inventory"].create(
{
"name": "Receive Mouses",
"location_id": self.wh_main.lot_stock_id.id,
"filter": "partial",
"location_ids": [(4, self.wh_main.lot_stock_id.id)],
}
)
inventory.action_start()
Expand All @@ -238,8 +235,7 @@ def test_potential_qty(self):
inventory = self.env["stock.inventory"].create(
{
"name": "components for 1st variant",
"location_id": self.wh_main.lot_stock_id.id,
"filter": "partial",
"location_ids": [(4, self.wh_main.lot_stock_id.id)],
}
)
inventory.action_start()
Expand Down Expand Up @@ -269,8 +265,7 @@ def test_potential_qty(self):
inventory = self.env["stock.inventory"].create(
{
"name": "components for 2nd variant",
"location_id": self.wh_ch.lot_stock_id.id,
"filter": "partial",
"location_ids": [(4, self.wh_ch.lot_stock_id.id)],
}
)
inventory.action_start()
Expand Down

0 comments on commit fc49cf9

Please sign in to comment.