From b2c5eeb61841cd7cb5b3fb64149cebf9ca292fce Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Wed, 20 Nov 2019 00:46:16 +0530 Subject: [PATCH] fix: Create Invoice action from Customer --- models/doctype/Party/Customer.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/models/doctype/Party/Customer.js b/models/doctype/Party/Customer.js index cd0ef17c..ba76bac8 100644 --- a/models/doctype/Party/Customer.js +++ b/models/doctype/Party/Customer.js @@ -1,8 +1,32 @@ +const { _ } = require('frappejs/utils'); +const router = require('@/router').default; +const frappe = require('frappejs'); + module.exports = { name: 'Customer', label: 'Customer', basedOn: 'Party', filters: { customer: 1 - } + }, + actions: [ + { + label: _('Create Invoice'), + action: async customer => { + let doc = await frappe.getNewDoc('SalesInvoice'); + router.push({ + path: `/edit/SalesInvoice/${doc.name}`, + query: { + values: { + customer: customer.name + } + } + }); + } + }, + // { + // label: _('View Invoices'), + // action: console.log + // } + ] };