Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add non standard field in dashboard #620

Merged
merged 7 commits into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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']
}
]
}
10 changes: 7 additions & 3 deletions erpnext/selling/doctype/customer/customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +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: frm
})
}

Expand Down
13 changes: 13 additions & 0 deletions erpnext/selling/doctype/customer/customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,19 @@ def make_contract(source_name, target_doc=None):

return target_doc

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

return target_doc

def _set_missing_values(source, target):
address = frappe.get_all('Dynamic Link', {
'link_doctype': source.doctype,
Expand Down