[FIX] mrp_production_hierarchy: disable _parent_store mechanism (MPTT) to fix issues when using the child_of search operator.

`(parent_left, parent_right)` duplicates can occur when creating multiple
manufacturing orders in parallel, which mess up the result of the `child_of`
search operator (wrong result returned).
Related Odoo issue: https://github.com/odoo/odoo/pull/14515
Odoo fix (for `stock.quant.package` here): https://github.com/odoo/odoo/pull/14694

This issue should not be relevant anymore in 11.0 as the `child_of/parent_of`
mechanism has been refactored (https://github.com/odoo/odoo/pull/22558)
This commit is contained in:
sebalix
2018-08-28 14:59:32 +02:00
parent d19c9f1c2b
commit b2e47e27ac

View File

@@ -7,9 +7,6 @@ from odoo import api, fields, models, _
class MrpProduction(models.Model):
_inherit = 'mrp.production'
_parent_name = "parent_id"
_parent_store = True
_parent_order = 'name'
root_id = fields.Many2one(
'mrp.production', u"Root order",
@@ -20,8 +17,6 @@ class MrpProduction(models.Model):
child_ids = fields.One2many(
'mrp.production', 'parent_id', u"Child orders",
domain=[('state', '!=', 'cancel')])
parent_left = fields.Integer('Left Parent', index=True)
parent_right = fields.Integer('Right Parent', index=True)
@api.multi
def _generate_moves(self):