Skip to content

Commit

Permalink
fix: add subscription to supplier too
Browse files Browse the repository at this point in the history
  • Loading branch information
Himanshu committed Oct 2, 2020
1 parent b27ef21 commit 2969834
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
6 changes: 5 additions & 1 deletion erpnext/buying/doctype/supplier/supplier.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ frappe.ui.form.on("Supplier", {
frm.make_methods = {
'Contract': () => frappe.model.open_mapped_doc({
method: 'erpnext.buying.doctype.supplier.supplier.make_contract',
frm: cur_frm
frm: frm
}),
'Subscription': () => frappe.model.open_mapped_doc({
method: 'erpnext.buying.doctype.supplier.supplier.make_subscription',
frm: frm
})
}

Expand Down
15 changes: 14 additions & 1 deletion erpnext/buying/doctype/supplier/supplier.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,17 @@ def make_contract(source_name, target_doc=None):
}
}}, target_doc)

return target_doc
return target_doc

@frappe.whitelist()
def make_subscription(source_name, target_doc=None):
target_doc = get_mapped_doc("Supplier", source_name,
{"Supplier": {
"doctype": "Subscription",
"field_map": {
"doctype": "party_type",
"name": "party"
}
}}, target_doc)

return target_doc
7 changes: 6 additions & 1 deletion erpnext/buying/doctype/supplier/supplier_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ def get_data():
'non_standard_fieldnames': {
'Payment Entry': 'party_name',
'Bank Account': 'party',
'Contract': 'party_name'
'Contract': 'party_name',
'Subscription': 'party'
},
'transactions': [
{
Expand All @@ -37,6 +38,10 @@ def get_data():
{
'label': _('Contracts'),
'items': ['Contract']
},
{
'label': _('Subscriptions'),
'items': ['Subscription']
}
]
}
8 changes: 4 additions & 4 deletions erpnext/selling/doctype/customer/customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ frappe.ui.form.on("Customer", {
frm.make_methods = {
'Quotation': () => frappe.model.open_mapped_doc({
method: 'erpnext.selling.doctype.customer.customer.make_quotation',
frm: cur_frm
frm: frm
}),
'Opportunity': () => frappe.model.open_mapped_doc({
method: 'erpnext.selling.doctype.customer.customer.make_opportunity',
frm: cur_frm
frm: frm
}),
'Contract': () => frappe.model.open_mapped_doc({
method: 'erpnext.selling.doctype.customer.customer.make_contract',
frm: cur_frm
frm: frm
}),
'Subscription': () => frappe.model.open_mapped_doc({
method: 'erpnext.selling.doctype.customer.customer.make_subscription',
frm: cur_frm
frm: frm
})
}

Expand Down

0 comments on commit 2969834

Please sign in to comment.