[FIX] purchase: Don't plan PO line at the middle of the day

No longer converts the date_planned of a purchase_order_line to the
middle of the day. In case of multi-steps receipts, this caused a
discrepancy between the actual receipt and the later internal transfers.

Let's say a reordering rule is triggered :
- The date is set to midnight for the procurement, so the internal
transfer's date is set to midnight as well.
- The date is increased to noon for the PO line, which define the PO
planned_date, which define the linked receipt picking.
- So in the end :
  - Receipt is planned to day X at noon.
  - Transfer from Input -> Stock is planned to day X at midnight.

Task-2656397

closes odoo/odoo#79523

Signed-off-by: Arnold Moyaux <arm@odoo.com>
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
clesgow
2021-11-09 14:46:14 +00:00
parent a2e706edf7
commit aefd5f7d64
+2 -3
View File
@@ -1068,10 +1068,9 @@ class PurchaseOrderLine(models.Model):
"""
date_order = po.date_order if po else self.order_id.date_order
if date_order:
date_planned = date_order + relativedelta(days=seller.delay if seller else 0)
return date_order + relativedelta(days=seller.delay if seller else 0)
else:
date_planned = datetime.today() + relativedelta(days=seller.delay if seller else 0)
return self._convert_to_middle_of_day(date_planned)
return datetime.today() + relativedelta(days=seller.delay if seller else 0)
@api.depends('product_id', 'date_order')
def _compute_analytic_id_and_tag_ids(self):