2
0
mirror of https://github.com/frappe/books.git synced 2025-01-03 07:12:21 +00:00

feat: save invoice and allow selection for later use

This commit is contained in:
AbleKSaju 2024-10-14 10:50:52 +05:30
parent 14be1a0af3
commit 9e81a39cf7

View File

@ -154,5 +154,39 @@ export default defineComponent({
sinvDoc: inject('sinvDoc') as SalesInvoice,
};
},
async mounted() {
await this.setSavedInvoices();
},
async activated() {
await this.setSavedInvoices();
},
watch: {
modalStatus(newVal) {
if (newVal) {
this.setSavedInvoices();
}
},
},
methods: {
async setSavedInvoices() {
this.savedInvoices = (await this.fyo.db.getAll(
ModelNameEnum.SalesInvoice,
{
fields: [],
filters: { isPOS: true, submitted: false },
}
)) as SalesInvoice[];
},
async selectedInvoice(row: SalesInvoice) {
let selectedInvoideDoc = (await this.fyo.doc.getDoc(
ModelNameEnum.SalesInvoice,
row.name
)) as SalesInvoice;
this.sinvDoc = selectedInvoideDoc;
this.$emit('toggleModal', 'SavedInvoice');
},
},
});
</script>