Skip to content

Commit 952b92e

Browse files
authored
Merge pull request #7 from fleetbase/feature/ledger-invoice-revision-handling
Add invoice revision handling for repriced orders
2 parents 776398b + 3e159fa commit 952b92e

6 files changed

Lines changed: 686 additions & 42 deletions

File tree

addon/components/order-invoice.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,12 @@ export default class OrderInvoiceComponent extends Component {
9292
const results = yield this.store.query('ledger-invoice', {
9393
order_uuid: order.id,
9494
with: 'items',
95-
limit: 1,
95+
sort: '-created_at',
96+
limit: 10,
9697
});
9798

98-
this.invoice = results.firstObject ?? null;
99+
const invoices = results.toArray();
100+
this.invoice = invoices.find((invoice) => !['void', 'cancelled'].includes(invoice.status)) ?? invoices[0] ?? null;
99101
} catch {
100102
this.invoice = null;
101103
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fleetbase/ledger-api",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "Accounting & Invoicing Extension for Fleetbase",
55
"keywords": [
66
"fleetbase",

extension.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Ledger",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "Accounting & Invoicing Extension for Fleetbase",
55
"repository": "https://github.com/fleetbase/ledger",
66
"license": "AGPL-3.0-or-later",

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fleetbase/ledger-engine",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "Accounting & Invoicing Extension for Fleetbase",
55
"keywords": [
66
"fleetbase-extension",
@@ -46,7 +46,7 @@
4646
"@babel/core": "^7.23.2",
4747
"@fleetbase/ember-core": "^0.3.17",
4848
"@fleetbase/ember-ui": "^0.3.25",
49-
"@fleetbase/fleetops-data": "^0.1.25",
49+
"@fleetbase/fleetops-data": "^0.1.30",
5050
"@fortawesome/ember-fontawesome": "^2.0.0",
5151
"@fortawesome/fontawesome-svg-core": "6.4.0",
5252
"@fortawesome/free-brands-svg-icons": "6.4.0",

0 commit comments

Comments
 (0)