mirror of
https://github.com/frappe/books.git
synced 2024-11-08 14:50:56 +00:00
fix: make payment flow
This commit is contained in:
parent
a829e23bda
commit
ef3f23bf2b
@ -758,6 +758,10 @@ export class Doc extends Observable<DocValue | Doc[]> {
|
||||
}
|
||||
}
|
||||
|
||||
async runFormulas() {
|
||||
await this._applyFormula();
|
||||
}
|
||||
|
||||
async _applyFormula(
|
||||
changedFieldname?: string,
|
||||
retriggerChildDocApplyChange?: boolean
|
||||
|
@ -61,20 +61,31 @@ export function getMakePaymentAction(fyo: Fyo): Action {
|
||||
group: fyo.t`Create`,
|
||||
condition: (doc: Doc) =>
|
||||
doc.isSubmitted && !(doc.outstandingAmount as Money).isZero(),
|
||||
action: async (doc: Doc) => {
|
||||
action: async (doc, router) => {
|
||||
const payment = (doc as Invoice).getPayment();
|
||||
if (!payment) {
|
||||
return;
|
||||
}
|
||||
|
||||
const currentRoute = router.currentRoute.value.fullPath;
|
||||
payment.once('afterSync', async () => {
|
||||
await payment.submit();
|
||||
await doc.load();
|
||||
await router.push(currentRoute);
|
||||
});
|
||||
|
||||
const hideFields = ['party', 'paymentType', 'for'];
|
||||
if (doc.schemaName === ModelNameEnum.SalesInvoice) {
|
||||
hideFields.push('account');
|
||||
} else {
|
||||
hideFields.push('paymentAccount');
|
||||
}
|
||||
|
||||
await payment.runFormulas();
|
||||
const { openQuickEdit } = await import('src/utils/ui');
|
||||
await openQuickEdit({
|
||||
doc: payment,
|
||||
hideFields: ['party', 'paymentType', 'for'],
|
||||
hideFields,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
@ -27,6 +27,7 @@
|
||||
overflow-auto
|
||||
mb-4
|
||||
bg-white
|
||||
mx-4
|
||||
"
|
||||
>
|
||||
<slot name="body" />
|
||||
|
Loading…
Reference in New Issue
Block a user