Skip to content

Commit

Permalink
Merge c76025c into e300e05
Browse files Browse the repository at this point in the history
  • Loading branch information
hrwX committed Oct 6, 2020
2 parents e300e05 + c76025c commit 575972a
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 6 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']
}
]
}
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

0 comments on commit 575972a

Please sign in to comment.