2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00
books/models/baseModels/Party/Customer.js

54 lines
1.1 KiB
JavaScript

import router from '@/router';
import frappe, { t } from 'frappe';
import { h } from 'vue';
import PartyWidget from './PartyWidget.vue';
export default {
name: 'Customer',
label: t`Customer`,
basedOn: 'Party',
filters: {
customer: 1,
},
actions: [
{
label: t`Create Invoice`,
condition: (doc) => !doc.isNew(),
action: async (customer) => {
let doc = await frappe.getEmptyDoc('SalesInvoice');
router.push({
path: `/edit/SalesInvoice/${doc.name}`,
query: {
doctype: 'SalesInvoice',
values: {
customer: customer.name,
},
},
});
},
},
{
label: t`View Invoices`,
condition: (doc) => !doc.isNew(),
action: (customer) => {
router.push({
name: 'ListView',
params: {
doctype: 'SalesInvoice',
filters: {
customer: customer.name,
},
},
});
},
},
],
quickEditWidget: (doc) => ({
render() {
return h(PartyWidget, {
doc,
});
},
}),
};