diff options
| author | Rémy Voet (ryv) <ryv@odoo.com> | 2020-08-06 06:03:01 +0000 |
|---|---|---|
| committer | Rémy Voet (ryv) <ryv@odoo.com> | 2020-08-18 07:48:27 +0000 |
| commit | 8d62eacfff5f94f692661c221c7b43f39bd3b891 (patch) | |
| tree | de330591caabad93d9abc7a48e28d505da1ad83b /addons/purchase_stock/tests | |
| parent | 57f805f71e9357870dfc2498c5ef72ebd8ab7273 (diff) | |
[FIX] *stock*, mrp: fix effective_date
- Avoid to truncate the hour/min/sec in the computation of the
effective date which is related to the `date_done`
of the first incoming picking.
- With manufacturing in 3-step (pbm_sam), the store picking
had a source document == "New". It was the case because
the `_get_move_finished_values` was call before the create
and the name is set only on create.
To fix this issue, during the `create` set the origin of all move.
- To avoid to maintain old views unused,
remove unused view of stock move.
- The computation of the products_availability json is too expensive
to be in tree view (2.5 times long with it) of picking.
It will be hard to optimize because the half the time
is due to _get_report_lines method - already in batch (on 80 records).
- Review buttons of the replenishment list to be more Odooer.
- In some cases the delay alert date was wrongly compute:
- If we new dest_move_ids of a existant move, the delay alert date
won't be compute.
- If the state (to done) and the date are save in same write call
the alert date of next move won't be reset.
To avoids these issues, refactor the alert date to be a compute stored
fields.
- To avoid any confusion between date expected in the replenishement
(in date) and the purchase order receipt date (datetime),
we put the receipt date at the middle of the day.
Also On-Time Delivery Rate computation counts
only when date are bigger effective date trunced to date.
Also used the timezone of the company by default (if not user timezone)
task-2246665
closes odoo/odoo#55379
Related: odoo/upgrade#1586
Related: odoo/enterprise#12309
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Diffstat (limited to 'addons/purchase_stock/tests')
| -rw-r--r-- | addons/purchase_stock/tests/test_purchase_lead_time.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/addons/purchase_stock/tests/test_purchase_lead_time.py b/addons/purchase_stock/tests/test_purchase_lead_time.py index 89773f52041..fb71d87dfec 100644 --- a/addons/purchase_stock/tests/test_purchase_lead_time.py +++ b/addons/purchase_stock/tests/test_purchase_lead_time.py @@ -33,7 +33,7 @@ class TestPurchaseLeadTime(PurchaseTestCommon): self.assertEqual(purchase.date_order, order_date, 'Order date should be equal to: Date of the procurement order - Purchase Lead Time - Delivery Lead Time.') # Check scheduled date of purchase order - schedule_date = datetime.combine(order_date + timedelta(days=self.product_1.seller_ids.delay), time.max).replace(microsecond=0, second=0) + schedule_date = datetime.combine(order_date + timedelta(days=self.product_1.seller_ids.delay), time.min).replace(tzinfo=None, hour=12) self.assertEqual(purchase.order_line.date_planned, schedule_date, 'Schedule date should be equal to: Order date of Purchase order + Delivery Lead Time.') # check the picking created or not @@ -71,11 +71,11 @@ class TestPurchaseLeadTime(PurchaseTestCommon): self.assertEqual(purchase2.date_order, order_date, 'Order date should be equal to: Date of the procurement order - Delivery Lead Time.') # Check scheduled date of purchase order line for product_1 - schedule_date_1 = datetime.combine(order_date + timedelta(days=self.product_1.seller_ids.delay), time.max).replace(microsecond=0, second=0) + schedule_date_1 = datetime.combine(order_date + timedelta(days=self.product_1.seller_ids.delay), time.min).replace(tzinfo=None, hour=12) self.assertEqual(order_line_pro_1.date_planned, schedule_date_1, 'Schedule date of purchase order line for product_1 should be equal to: Order date of purchase order + Delivery Lead Time of product_1.') # Check scheduled date of purchase order line for product_2 - schedule_date_2 = datetime.combine(order_date + timedelta(days=self.product_2.seller_ids.delay), time.max).replace(microsecond=0, second=0) + schedule_date_2 = datetime.combine(order_date + timedelta(days=self.product_2.seller_ids.delay), time.min).replace(tzinfo=None, hour=12) self.assertEqual(order_line_pro_2.date_planned, schedule_date_2, 'Schedule date of purchase order line for product_2 should be equal to: Order date of purchase order + Delivery Lead Time of product_2.') # Check scheduled date of purchase order |
