2021-11-04 10:31:26 +00:00
|
|
|
import router from '@/router';
|
2022-02-10 06:41:51 +00:00
|
|
|
import frappe, { t } from 'frappe';
|
|
|
|
import { h } from 'vue';
|
2021-11-04 10:31:26 +00:00
|
|
|
import PartyWidget from './PartyWidget.vue';
|
2019-12-12 19:34:37 +00:00
|
|
|
|
2021-11-04 10:31:26 +00:00
|
|
|
export default {
|
2019-10-05 21:42:08 +00:00
|
|
|
name: 'Supplier',
|
2022-02-16 06:19:16 +00:00
|
|
|
label: t`Supplier`,
|
2019-10-05 21:42:08 +00:00
|
|
|
basedOn: 'Party',
|
|
|
|
filters: {
|
2022-01-20 20:57:29 +00:00
|
|
|
supplier: 1,
|
2019-12-12 19:34:37 +00:00
|
|
|
},
|
|
|
|
actions: [
|
|
|
|
{
|
2022-02-09 06:59:41 +00:00
|
|
|
label: t`Create Bill`,
|
2022-01-20 20:57:29 +00:00
|
|
|
condition: (doc) => !doc.isNew(),
|
|
|
|
action: async (supplier) => {
|
2022-03-22 06:00:33 +00:00
|
|
|
let doc = await frappe.getEmptyDoc('PurchaseInvoice');
|
2019-12-12 19:34:37 +00:00
|
|
|
router.push({
|
|
|
|
path: `/edit/PurchaseInvoice/${doc.name}`,
|
|
|
|
query: {
|
|
|
|
doctype: 'PurchaseInvoice',
|
|
|
|
values: {
|
2022-01-20 20:57:29 +00:00
|
|
|
supplier: supplier.name,
|
|
|
|
},
|
|
|
|
},
|
2019-12-12 19:34:37 +00:00
|
|
|
});
|
2022-01-20 20:57:29 +00:00
|
|
|
},
|
2019-12-12 19:34:37 +00:00
|
|
|
},
|
|
|
|
{
|
2022-02-09 06:59:41 +00:00
|
|
|
label: t`View Bills`,
|
2022-01-20 20:57:29 +00:00
|
|
|
condition: (doc) => !doc.isNew(),
|
|
|
|
action: (supplier) => {
|
2019-12-12 19:34:37 +00:00
|
|
|
router.push({
|
|
|
|
name: 'ListView',
|
|
|
|
params: {
|
|
|
|
doctype: 'PurchaseInvoice',
|
|
|
|
filters: {
|
2022-01-20 20:57:29 +00:00
|
|
|
supplier: supplier.name,
|
|
|
|
},
|
|
|
|
},
|
2019-12-12 19:34:37 +00:00
|
|
|
});
|
2022-01-20 20:57:29 +00:00
|
|
|
},
|
|
|
|
},
|
2019-12-26 13:45:41 +00:00
|
|
|
],
|
2022-01-20 20:57:29 +00:00
|
|
|
quickEditWidget: (doc) => ({
|
2022-02-10 06:41:51 +00:00
|
|
|
render() {
|
2019-12-26 13:45:41 +00:00
|
|
|
return h(PartyWidget, {
|
2022-02-10 06:41:51 +00:00
|
|
|
doc,
|
2019-12-26 13:45:41 +00:00
|
|
|
});
|
2022-01-20 20:57:29 +00:00
|
|
|
},
|
|
|
|
}),
|
2019-10-05 21:42:08 +00:00
|
|
|
};
|