2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 11:29:00 +00:00
books/models/baseModels/Party/Supplier.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: 'Supplier',
label: t`Supplier`,
basedOn: 'Party',
filters: {
supplier: 1,
},
actions: [
{
label: t`Create Bill`,
condition: (doc) => !doc.isNew(),
action: async (supplier) => {
let doc = await frappe.getEmptyDoc('PurchaseInvoice');
router.push({
path: `/edit/PurchaseInvoice/${doc.name}`,
query: {
doctype: 'PurchaseInvoice',
values: {
supplier: supplier.name,
},
},
});
},
},
{
label: t`View Bills`,
condition: (doc) => !doc.isNew(),
action: (supplier) => {
router.push({
name: 'ListView',
params: {
doctype: 'PurchaseInvoice',
filters: {
supplier: supplier.name,
},
},
});
},
},
],
quickEditWidget: (doc) => ({
render() {
return h(PartyWidget, {
doc,
});
},
}),
};