[11.0][REW/IMP] mrp_multi_level:

* Extract concept of planned orders from mrp.move.
* Fix error grouping demand when there is no supply for a the first day of grouping.
* Adapt tests.
This commit is contained in:
Lois Rilo
2019-05-21 12:51:37 +02:00
committed by JasminSForgeFlow
parent 4baa262471
commit 68a7cb40cb
18 changed files with 467 additions and 348 deletions

View File

@@ -11,56 +11,41 @@ class MrpMove(models.Model):
# TODO: too many indexes...
product_mrp_area_id = fields.Many2one(
comodel_name="product.mrp.area",
string="Product", index=True,
)
mrp_area_id = fields.Many2one(
comodel_name='mrp.area',
related='product_mrp_area_id.mrp_area_id',
string='MRP Area',
comodel_name="mrp.area",
related="product_mrp_area_id.mrp_area_id",
string="MRP Area",
store=True,
index=True,
)
product_id = fields.Many2one(
comodel_name='product.product',
related='product_mrp_area_id.product_id',
store=True,
)
current_date = fields.Date(string='Current Date')
current_qty = fields.Float(string='Current Qty')
# TODO: cancel is not needed I think...
mrp_action = fields.Selection(
selection=[('mo', 'Manufacturing Order'),
('po', 'Purchase Order'),
('cancel', 'Cancel'),
('none', 'None')],
string='Action',
)
mrp_action_date = fields.Date(string='MRP Action Date')
mrp_date = fields.Date(string='MRP Date')
mrp_move_down_ids = fields.Many2many(
comodel_name='mrp.move',
relation='mrp_move_rel',
column1='move_up_id',
column2='move_down_id',
string='MRP Move DOWN',
)
mrp_move_up_ids = fields.Many2many(
comodel_name='mrp.move',
relation='mrp_move_rel',
column1='move_down_id',
column2='move_up_id',
string='MRP Move UP',
)
mrp_minimum_stock = fields.Float(
string='Minimum Stock',
related='product_mrp_area_id.mrp_minimum_stock',
planned_order_up_ids = fields.Many2many(
comodel_name="mrp.planned.order",
relation="mrp_move_planned_order_rel",
column1="move_down_id",
column2="order_id",
string="Planned Orders UP",
)
mrp_order_number = fields.Char(string='Order Number')
# TODO: replace by a char origin?
mrp_origin = fields.Selection(
selection=[('mo', 'Manufacturing Order'),
('po', 'Purchase Order'),
('mv', 'Move'),
('fc', 'Forecast'), ('mrp', 'MRP')],
('fc', 'Forecast'),
('mrp', 'MRP')],
string='Origin')
mrp_processed = fields.Boolean(string='Processed')
product_mrp_area_id = fields.Many2one(
comodel_name='product.mrp.area',
string='Product', index=True,
)
mrp_qty = fields.Float(string='MRP Quantity')
mrp_type = fields.Selection(
selection=[('s', 'Supply'), ('d', 'Demand')],
@@ -68,12 +53,8 @@ class MrpMove(models.Model):
)
name = fields.Char(string='Description')
parent_product_id = fields.Many2one(
comodel_name='product.product',
string='Parent Product', index=True,
)
product_id = fields.Many2one(
comodel_name='product.product',
string='Product', index=True,
comodel_name="product.product",
string="Parent Product", index=True,
)
production_id = fields.Many2one(
comodel_name='mrp.production',
@@ -87,7 +68,6 @@ class MrpMove(models.Model):
comodel_name='purchase.order',
string='Purchase Order', index=True,
)
running_availability = fields.Float(string='Running Availability')
state = fields.Selection(
selection=[('draft', 'Draft'),
('assigned', 'Assigned'),