[FIX] mrp: Add support for picking replenishment in MO Overview

When a reception picking was created to resupply a component (without
using a purchase order), the picking was correctly linked in the MO
Overview, but the date was set as "Not available" as the planned date of
the picking wasn't read.
Also adds the color scheme for pickings states for the Overview.

Part of task-3217757

closes odoo/odoo#118023

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
clesgow
2023-04-13 15:26:42 +02:00
parent d8648645e3
commit 8e2a293faf
2 changed files with 15 additions and 0 deletions
@@ -362,6 +362,9 @@ class ReportMoOverview(models.AbstractModel):
return currency.round(product.standard_price * uom_id._compute_quantity(quantity, product.uom_id))
def _get_replenishment_receipt(self, doc_in, components):
if doc_in._name == 'stock.picking':
return self._format_receipt_date('expected', doc_in.scheduled_date)
if doc_in._name == 'mrp.production':
max_date_start = doc_in.date_start
all_available = True
@@ -18,6 +18,15 @@ const PURCHASE_DECORATORS = {
cancel: "muted",
};
const PICKING_DECORATORS = {
draft: "muted",
waiting: "warning",
confirmed: "warning",
assigned: "info",
done: "success",
cancel: "danger",
};
const OPERATION_DECORATORS = {
pending: "info",
waiting: "info",
@@ -40,6 +49,9 @@ export function getStateDecorator(model, state) {
case "mrp.workorder":
decorators = OPERATION_DECORATORS;
break;
case "stock.picking":
decorators = PICKING_DECORATORS;
break;
case "purchase.order":
decorators = PURCHASE_DECORATORS;
break;