Skip to content

5535 Exclude requisition made from web entries in mSupply #5536

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

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

raviSussol
Copy link
Collaborator

@raviSussol raviSussol commented Apr 7, 2025

Fixes #5535

Change summary

  • Removed wp and wf statuses from requisition schema and its related method to stop processing incoming requisitions made from web entries in the mSupply.
  • Fixed data linkage between Transaction & 'Requisiton` objects they have been broken from #5406 don't create blank supplier requisitions #5407

Testing

Steps to reproduce or otherwise test the changes of this PR:

  • Use the built apk and install on the tablet and use the mSupply installers to setup central server.
  • For developers the PR is here : https://github.com/msupply-foundation/msupply/pull/16410
    Brand new mobile setup
  • Setup any mobile site of Fiji moh with mSupply central server (i.e. use Fiji moh datafile)
  • Note copy Fiji moh mSupply data before you proceed below test cases - you'll need it for other variety of test cases
  • I used Samabula_pharm store's site
  • Initialize sync from mSupply to mobile
  • Login to the tablet and goto the supplier requisition and follow test 1
    Mobile upgrade setup
  • Use you Fiji moh mSupply data from second copy
  • Have a mobile apk version setup lower than v8.6.8
  • Setup sync with msupply central server with the above store's site
  • Login to the app and in the Supplier requisition you can now see some blank requisitions
  • Now upgrade the mobile app to v8.7.0
  • Login to the app after upgrade and do force sync
  • In the mSupply central server goto the scheduler dashboard window and force run scheduler_processMessages scheduler
  • Now in the mobile app again do force sync and follow test 2
  • Now export mobile data. You'll need admin pass thisisnepal123 enter that and click Export Data
  • Open that realm file in realm studio and follow test 3

Tests

  • Test 1

  • Should not display blank or having serial number 0 requisition

  • Also check the customer requisition - should not have any blank or having serial number 0 requisition

  • Please do regression tests related requisitions (both customer and supplier)

    • Setup 2 mobile apps and 1 oms site (i.e 1 oms central server with 1 oms remote) and 1 mSupply central server and 1 mSupply remote desktop site
    • Try creating some invoices (i.e from internal order or supplier requisition or request requisition -> response requisition or customer requisition -> customer invoice or outbound shipment (then via stock transfer) -> supplier invoice or inbound shipment
    • Do thorough tests on these workflow among OG mobile, oms site, msupply sites and see if there anything gets broken - should be working flawlessly
  • Test 2

  • All blank requisitions will be gone in the mobile and requisitions having wp status will also be gone from the mSupply

  • Test 3

  • In the Requisition object goto the linkedTransaction field where you can see linked transaction records in it

  • Similarly, in the Transaction object goto the linkedRequisition field where you can see linked requisition records in there

Copilot

This comment was marked as resolved.

@raviSussol raviSussol marked this pull request as draft April 8, 2025 03:23
no migration code need for cleaning blank requisition since we need to re-initialize mobile app from the sync server anyway so all of those blank requisitions will be handled there
@raviSussol raviSussol marked this pull request as ready for review April 9, 2025 06:28
@AnushaUp
Copy link

AnushaUp commented Apr 9, 2025

Testing

Tested in given APK
Steps to reproduce or otherwise test the changes of this PR:

  • Use the built apk and install on the tablet
  • Setup any mobile site of Fiji moh with mSupply central server (i.e. use Fiji moh datafile)
  • I used Samabula_pharm store's site
  • Initialize sync from mSupply to mobile
  • Login to the tablet and goto the supplier requisition and follow test 1

Tests

  • Should not display blank or having serial number 0 requisition
  • Also check the customer requisition - should not have any blank or having serial number 0 requisition
  • Please do regression tests related requisitions (both customer and supplier)
    • Setup 2 mobile apps and 1 oms site (i.e 1 oms central server with 1 oms remote) and 1 mSupply central server and 1 mSupply remote desktop site
    • Try creating some invoices (i.e from internal order or supplier requisition or request requisition -> response requisition or customer requisition -> customer invoice or outbound shipment (then via stock transfer) -> supplier invoice or inbound shipment
    • Do thorough tests on these workflow among OG mobile, oms site, msupply sites and see if there anything gets broken - should be working flawlessly

@raviSussol raviSussol added the Bug: production Bug was found or believed to be in a live release label Apr 14, 2025
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense so updating transaction so we dont create any blank requisiton in future and also updating requisition and deleting that too...

if (record.store_ID !== settings.get(THIS_STORE_ID)) break; // Not for this store

const status = REQUISITION_STATUSES.translate(record.status, EXTERNAL_TO_INTERNAL);
if (!status) break; // Must be a requisition status, either 'suggested' or 'finalised'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice so we will not proceed if desired status is not received.

@@ -142,12 +142,11 @@ export const NAME_TYPES = new SyncTranslator({
*/
class RequisitionStatusTranslator extends SyncTranslator {
translate(status, direction) {
if (['cn', 'wf'].includes(status)) return 'finalised';
if (status === 'cn') return 'finalised';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Copy link
Contributor

@anildahalsussol anildahalsussol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Over all looks good to me.

@@ -286,6 +286,45 @@ const dataMigrations = [
clearNumberSequences(database);
},
},
{
version: '8.7.0',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raviSussol : I was thinking still WP is mysterious but we are known with another case of creating blank requisition. Is there a place where it can check blank so we dont need to make everytime migrate code?

@anildahalsussol
Copy link
Contributor

As seen while testing wp status requisition seems valid requisition with status fn and also can see linked response requisition and related requisition lines. So not sure should we deleted or if its valid then improve it looking at the response requisition?

@ujwalSussol
Copy link
Contributor

ujwalSussol commented Apr 23, 2025

update : was able to set up the Master mobile...
Now tomorrow will aim to build mobile via this PR.

I am using Node V14.21.3 ( think this is the best that we can do for now )

@ujwalSussol
Copy link
Contributor

@raviSussol : The testing I have done, looks positive...

Now I think what we need is a big Group test from @santoshkhanal12 and @AnushaUp and perhaps a few one of of us.

Copy link
Contributor

@ujwalSussol ujwalSussol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved : But we do need to do a group test to make sure that daily activities are not messed up.

@raviSussol
Copy link
Collaborator Author

approved : But we do need to do a group test to make sure that daily activities are not messed up.

Yes that would be great to have other functional or regression tests before releasing the new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: production Bug was found or believed to be in a live release tester: Anusha
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid Requisition appears to be created due to Finalised Supplier Invoice
4 participants