mirror of
https://github.com/frappe/books.git
synced 2024-11-08 23:00:56 +00:00
incr: complete quick payment function
- fix quick view display update
This commit is contained in:
parent
bc909f630a
commit
759bedf764
@ -129,6 +129,13 @@ export abstract class Invoice extends Transactional {
|
||||
|
||||
const party = (await this.fyo.doc.getDoc('Party', this.party!)) as Party;
|
||||
await party.updateOutstandingAmount();
|
||||
|
||||
if (this.makeQuickPayment && this.quickPaymentAccount) {
|
||||
const payment = this.getPayment();
|
||||
await payment?.sync();
|
||||
await payment?.submit();
|
||||
await this.load();
|
||||
}
|
||||
}
|
||||
|
||||
async afterCancel() {
|
||||
@ -556,6 +563,11 @@ export abstract class Invoice extends Transactional {
|
||||
],
|
||||
};
|
||||
|
||||
if (this.makeQuickPayment && this.quickPaymentAccount) {
|
||||
const quickPaymentAccount = this.isSales ? 'paymentAccount' : 'account';
|
||||
data[quickPaymentAccount] = this.quickPaymentAccount;
|
||||
}
|
||||
|
||||
return this.fyo.doc.getNewDoc(ModelNameEnum.Payment, data) as Payment;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,20 @@ export default defineComponent({
|
||||
data() {
|
||||
return { values: [] } as { values: { label: string; value: string }[] };
|
||||
},
|
||||
watch: {
|
||||
async name(v1, v2) {
|
||||
if (v1 === v2) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.setValues();
|
||||
},
|
||||
},
|
||||
async mounted() {
|
||||
await this.setValues();
|
||||
},
|
||||
methods: {
|
||||
async setValues() {
|
||||
const fields: Field[] = (this.schema?.fields ?? []).filter(
|
||||
(f) =>
|
||||
f &&
|
||||
@ -45,7 +58,8 @@ export default defineComponent({
|
||||
f.fieldname !== 'name' &&
|
||||
!f.hidden &&
|
||||
!f.meta &&
|
||||
!f.abstract
|
||||
!f.abstract &&
|
||||
!f.computed
|
||||
);
|
||||
|
||||
const data = (
|
||||
@ -62,10 +76,14 @@ export default defineComponent({
|
||||
return { value: '', label: '' };
|
||||
}
|
||||
|
||||
return { value: this.fyo.format(data[f.fieldname], f), label: f.label };
|
||||
return {
|
||||
value: this.fyo.format(data[f.fieldname], f),
|
||||
label: f.label,
|
||||
};
|
||||
})
|
||||
.filter((i) => !!i.value);
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
schema() {
|
||||
return this.fyo.schemaMap[this.schemaName];
|
||||
|
Loading…
Reference in New Issue
Block a user