Skip to content

(fix) O3-5422: Give BillLineItems their own BillLineItemStatus - #154

Open
EDSONZ-WASSWA wants to merge 2 commits into
openmrs:mainfrom
EDSONZ-WASSWA:fix-5422-BillLineItems-should-have-its-own-BillLineItemStatus
Open

(fix) O3-5422: Give BillLineItems their own BillLineItemStatus#154
EDSONZ-WASSWA wants to merge 2 commits into
openmrs:mainfrom
EDSONZ-WASSWA:fix-5422-BillLineItems-should-have-its-own-BillLineItemStatus

Conversation

@EDSONZ-WASSWA

Copy link
Copy Markdown

Previously, line items were just reusing the main BillStatus enum. That with that a single line item can't be "POSTED" — only the parent bill can.

##To clean this up, I've split them apart:
Added a new BillLineItemStatus enum that includes all the standard statuses (PENDING, PAID, CANCELLED, ADJUSTED, EXEMPTED) but leaves out POSTED as the ticket required.
Swapped out the old enum for the new one in the BillLineItem model and updated the Hibernate mappings ( Bill.hbm.xml ).
Updated the order creation advices and the status synchronization logic in Bill.java to use the new types.
Updated the unit tests to make sure everything still passes.
Database safety: I also added a quick Liquibase migration. Just in case there are any legacy line items in the database currently marked as POSTED , this safely flips them to PENDING so Hibernate doesn't crash when it tries to map them.

This is a fix to https://openmrs.atlassian.net/issues?filter=-1&selectedIssue=O3-5422

@NethmiRodrigo please review this pr

Comment on lines 48 to 49
private BillLineItemStatus paymentStatus; // this should only be set to either
// pending or paid

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment is no longer needed

Suggested change
private BillLineItemStatus paymentStatus; // this should only be set to either
// pending or paid
private BillLineItemStatus paymentStatus;

Comment thread omod/src/main/resources/liquibase.xml Outdated
baseTableName="bill_exemption_rule" baseColumnNames="voided_by"
referencedTableName="users" referencedColumnNames="user_id"/>
</changeSet>
<changeSet id="openmrs.billing-004-20260320-migrate-line-item-payment-status" author="Wikum Weerakutti">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The author here should be your name I believe

Comment thread api/src/main/resources/Bill.hbm.xml
@EDSONZ-WASSWA
EDSONZ-WASSWA force-pushed the fix-5422-BillLineItems-should-have-its-own-BillLineItemStatus branch from 8fa8867 to 373f8e3 Compare March 21, 2026 19:16
@codecov-commenter

codecov-commenter commented Mar 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 27.14%. Comparing base (b52412a) to head (5737317).

Files with missing lines Patch % Lines
...le/billing/advice/GenerateBillFromOrderAdvice.java 0.00% 2 Missing ⚠️
...illing/advice/OrderCreationMethodBeforeAdvice.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #154      +/-   ##
============================================
+ Coverage     27.04%   27.14%   +0.10%     
- Complexity      497      498       +1     
============================================
  Files           190      191       +1     
  Lines          4337     4343       +6     
  Branches        492      492              
============================================
+ Hits           1173     1179       +6     
  Misses         3062     3062              
  Partials        102      102              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread api/src/main/java/org/openmrs/module/billing/api/model/BillLineItemStatus.java Outdated
Comment thread api/src/main/resources/Bill.hbm.xml
@EDSONZ-WASSWA
EDSONZ-WASSWA force-pushed the fix-5422-BillLineItems-should-have-its-own-BillLineItemStatus branch from 0e3472a to 8856dbc Compare March 31, 2026 15:42
Comment on lines 1114 to 1115
<changeSet id="openmrs.billing-004-20260320-add-provider-id-to-bill-payment" author="Nethmi Rodrigo">
<comment>Add cashier (provider) for each payment to track which cashier processed the payment</comment>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This needs to be inside the tags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants