Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: delivery trip driver is only required on submit #35876

Conversation

blaggacao
Copy link
Collaborator

This allows drafting trips and stops without yet deciding on the
assignable driver which, in real life, may well be decided on after
preparing and planning the trip.

@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label Jun 24, 2023
@blaggacao blaggacao force-pushed the fix-delivery-trip-driver-must-be-set-on-submit branch from 08234f8 to 228084b Compare June 24, 2023 19:13
@blaggacao
Copy link
Collaborator Author

blaggacao commented Jun 24, 2023

Something seems to be flaky with this test. In the previous run it was Reserved != Delivered, now it's Partially Delivered != Delivered. I have no knowledge of what makes this test proven flaky and whether this PR surfaces it (and if so: how?) ...

======================================================================
 FAIL  test_stock_reservation_against_sales_order (erpnext.selling.doctype.sales_order.test_sales_order.TestSalesOrder.test_stock_reservation_against_sales_order)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
    args = (<erpnext.selling.doctype.sales_order.test_sales_order.TestSalesOrder testMethod=test_stock_reservation_against_sales_order>,)
    func = <function TestSalesOrder.test_stock_reservation_against_sales_order at 0x7f243fe756c0>
    kwds = {}
    self = <contextlib._GeneratorContextManager object at 0x7f244050bdd0>
  File "/home/runner/frappe-bench/apps/erpnext/erpnext/selling/doctype/sales_order/test_sales_order.py", line 1912, in test_stock_reservation_against_sales_order
    self.assertEqual(sre_detail.status, "Delivered")
    cancel_stock_reservation_entries = <function cancel_stock_reservation_entries at 0x7f2442d7cae0>
    create_items = <function create_items at 0x7f243fa05c60>
    create_material_receipt = <function create_material_receipt at 0x7f243fa84360>
    dn1 = <DeliveryNote: MAT-DN-2023-00017 docstatus=1>
    dn2 = <DeliveryNote: MAT-DN-2023-00018 docstatus=1>
    get_sre_reserved_qty_details_for_voucher = <function get_sre_reserved_qty_details_for_voucher at 0x7f2442d7c720>
    get_stock_reservation_entries_for_voucher = <function get_stock_reservation_entries_for_voucher at 0x7f2442d7c540>
    has_reserved_stock = <function has_reserved_stock at 0x7f2442d7c860>
    item = <SalesOrderItem: 8df442e336 docstatus=1 parent=SAL-ORD-2023-00054>
    item_code = 'SR Batch and Serial Item 1'
    item_list = [{'item_code': 'SR Item 1', 'warehouse': '_Test Warehouse - _TC', 'qty': 17.0, 'uom': 'Nos', 'rate': 21, 'doctype': 'Sales Order Item'}, {'item_code': 'SR Item 2', 'warehouse': '_Test Warehouse - _TC', 'qty': 46.54, 'uom': 'Kg', 'rate': 68, 'doctype': 'Sales Order Item'}, {'item_code': 'SR Batch Item 1', 'warehouse': '_Test Warehouse - _TC', 'qty': 58.0, 'uom': 'Nos', 'rate': 111, 'doctype': 'Sales Order Item'}, {'item_code': 'SR Batch Item 2', 'warehouse': '_Test Warehouse - _TC', 'qty': 90.127, 'uom': 'Kg', 'rate': 20, 'doctype': 'Sales Order Item'}, {'item_code': 'SR Serial Item 1', 'warehouse': '_Test Warehouse - _TC', 'qty': 84.0, 'uom': 'Nos', 'rate': 117, 'doctype': 'Sales Order Item'}, {'item_code': 'SR Batch and Serial Item 1', 'warehouse': '_Test Warehouse - _TC', 'qty': 98.0, 'uom': 'Nos', 'rate': 56, 'doctype': 'Sales Order Item'}]
    items_details = {'SR Item 1': <Item: SR Item 1>, 'SR Item 2': <Item: SR Item 2>, 'SR Batch Item 1': <Item: SR Batch Item 1>, 'SR Batch Item 2': <Item: SR Batch Item 2>, 'SR Serial Item 1': <Item: SR Serial Item 1>, 'SR Batch and Serial Item 1': <Item: SR Batch and Serial Item 1>}
    properties = <Item: SR Batch and Serial Item 1>
    randint = <bound method Random.randint of <random.Random object at 0x5631698d9c40>>
    reserved_qty = 98.0
    reserved_qty_details = {'4c908125b1': 17.0, '5c1a9bd7d9': 90.127, '631d625a0f': 46.54, '752ad9a5ec': 98.0, '8d20bb9b63': 58.0, 'bb6c07cf84': 84.0}
    se = <StockEntry: MAT-STE-2023-00018 docstatus=2>
    self = <erpnext.selling.doctype.sales_order.test_sales_order.TestSalesOrder testMethod=test_stock_reservation_against_sales_order>
    so = <SalesOrder: SAL-ORD-2023-00054 docstatus=1>
    sre_detail = {'status': 'Partially Delivered', 'reserved_qty': 46.54, 'delivered_qty': 46.54}
    sre_details = [{'status': 'Partially Delivered', 'reserved_qty': 46.54, 'delivered_qty': 46.54}]
    stock_uom = 'Nos'
    uniform = <bound method Random.uniform of <random.Random object at 0x5631698d9c40>>
    warehouse = '_Test Warehouse - _TC'
AssertionError: 'Partially Delivered' != 'Delivered'
- Partially Delivered
+ Delivered

@codecov
Copy link

codecov bot commented Jun 25, 2023

Codecov Report

Merging #35876 (5ea4c47) into develop (a90fe25) will decrease coverage by 0.01%.
The diff coverage is 50.00%.

❗ Current head 5ea4c47 differs from pull request most recent head 85155d5. Consider uploading reports for the commit 85155d5 to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #35876      +/-   ##
===========================================
- Coverage    64.20%   64.20%   -0.01%     
===========================================
  Files          811      811              
  Lines        62142    62144       +2     
===========================================
  Hits         39901    39901              
- Misses       22241    22243       +2     
Impacted Files Coverage Δ
...pnext/stock/doctype/delivery_trip/delivery_trip.py 62.08% <50.00%> (-0.14%) ⬇️

... and 1 file with indirect coverage changes

@blaggacao blaggacao force-pushed the fix-delivery-trip-driver-must-be-set-on-submit branch from 228084b to 5ea4c47 Compare June 26, 2023 02:45
This allows drafting trips and stops without yet deciding on the
assignable driver which, in real life, may well be decided on after
preparing and planning the trip.
@s-aga-r s-aga-r force-pushed the fix-delivery-trip-driver-must-be-set-on-submit branch from 5ea4c47 to 85155d5 Compare June 27, 2023 05:55
@s-aga-r s-aga-r added the backport version-14-hotfix backport to version 14 label Jun 27, 2023
@s-aga-r s-aga-r merged commit 742df8a into frappe:develop Jun 27, 2023
mergify bot pushed a commit that referenced this pull request Jun 27, 2023
This allows drafting trips and stops without yet deciding on the
assignable driver which, in real life, may well be decided on after
preparing and planning the trip.

(cherry picked from commit 742df8a)
s-aga-r pushed a commit that referenced this pull request Jun 27, 2023
#35893)

fix: delivery trip driver is only required on submit (#35876)

This allows drafting trips and stops without yet deciding on the
assignable driver which, in real life, may well be decided on after
preparing and planning the trip.

(cherry picked from commit 742df8a)

Co-authored-by: David Arnold <david.arnold@iohk.io>
@blaggacao blaggacao deleted the fix-delivery-trip-driver-must-be-set-on-submit branch June 27, 2023 07:08
frappe-pr-bot pushed a commit that referenced this pull request Jun 28, 2023
# [14.28.0](v14.27.14...v14.28.0) (2023-06-28)

### Bug Fixes

* asset capitalization ([#35832](#35832)) ([fb823b5](fb823b5))
* asset movement ([#35918](#35918)) ([e16c148](e16c148))
* delivery trip driver is only required on submit (backport [#35876](#35876)) ([#35893](#35893)) ([fc051d1](fc051d1))
* don't allow to make reposting entry for closing stock balance period ([e68b088](e68b088))
* filter parent warehouses not showing (backport [#35897](#35897)) ([#35899](#35899)) ([87ba196](87ba196))
* incorrect cost center error in bank reconciliation ([cacb0f6](cacb0f6))
* issue of asset value_after_depreciation field getting updated twice if workflow is enabled in Journal Entry (backport [#35821](#35821)) ([#35827](#35827)) ([20f2bef](20f2bef))
* make credit note and debit note exclusive ([#35781](#35781)) ([fafb46e](fafb46e))
* multiple Work Orders agaist same production plan ([8ddfc34](8ddfc34))
* no permission for accounts settings on payment reconciliation ([200ddbf](200ddbf))
* Payment Term must be mandatory if `Allocate Payment based on ..` is checked ([#35798](#35798)) ([3dd3935](3dd3935))
* POS Closing Entry load all invoices with one request on save ([#35819](#35819)) ([8ecca2a](8ecca2a))
* reconcile invoice against credit note. ([#35604](#35604)) ([5c388a1](5c388a1))
* Remove special treatment for P&L Accounts ([#35602](#35602)) ([b023448](b023448))
* Set Asset cost center default as PR or PI Item Cost Center while auto creating ([#35844](#35844)) ([4a7d75b](4a7d75b))
* show non-depreciable assets in fixed asset register ([#35858](#35858)) ([42d0944](42d0944))
* TDS amount calculation post LDC breach ([851b887](851b887))
* use correct fieldname for purchase receipt column in item_wise_purchase_register report ([#35828](#35828)) ([8f13b48](8f13b48))
* **ux:** PO Get Items From Open Material Requests (backport [#35894](#35894)) ([#35895](#35895)) ([2ef2057](2ef2057))

### Features

* Auto set Party in Bank Transaction ([#34675](#34675)) ([d53b197](d53b197))
* Provision to send Accounts Receivable Reports using Process SOA ([#35789](#35789)) ([21d560c](21d560c)), closes [#35707](#35707)

### Performance Improvements

* improve item wise register reports ([#35908](#35908)) ([33ee011](33ee011))
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport version-14-hotfix backport to version 14 needs-tests This PR needs automated unit-tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants