Skip to content

Commit

Permalink
Merge branch 'develop' into fix/primary-contact-and-address-buisness-…
Browse files Browse the repository at this point in the history
…flow
  • Loading branch information
deepeshgarg007 authored Nov 11, 2023
2 parents 669f272 + 59438ee commit f337bf5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
10 changes: 4 additions & 6 deletions erpnext/patches/v15_0/migrate_payment_request_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ def execute():
Change Inward Payment Requests from statut 'Initiated' to correct status 'Requested'.
Status 'Initiated' is reserved for Outward Payment Requests and was a semantic error in previour versions.
"""

if frappe.reload_doc("accounts", "doctype", "Payment Request"):
so = frappe.qb.DocType("Payment Request")
frappe.qb.update(so).set(so.status, "Requested").where(
so.payment_request_type == "Inward"
).where(so.status == "Initiated").run()
so = frappe.qb.DocType("Payment Request")
frappe.qb.update(so).set(so.status, "Requested").where(so.payment_request_type == "Inward").where(
so.status == "Initiated"
).run()
2 changes: 1 addition & 1 deletion erpnext/public/js/controllers/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -1772,7 +1772,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe
if(frappe.meta.has_field(me.frm.doc.doctype, fieldname) && !["Purchase Order","Purchase Invoice"].includes(me.frm.doc.doctype)) {
if (!me.frm.doc[fieldname]) {
frappe.msgprint(__("Please specify") + ": " +
frappe.meta.get_label(me.frm.doc.doctype, fieldname, me.frm.doc.name) +
__(frappe.meta.get_label(me.frm.doc.doctype, fieldname, me.frm.doc.name)) +
". " + __("It is needed to fetch Item Details."));
valid = false;
}
Expand Down
20 changes: 15 additions & 5 deletions erpnext/selling/doctype/customer/customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ def make_contact(args, is_primary_contact=1):
contact = frappe.get_doc(
{
"doctype": "Contact",
"first_name": args.get("name"),
"first_name": args.get("customer_name"),
"is_primary_contact": is_primary_contact,
"links": [{"link_doctype": args.get("doctype"), "link_name": args.get("name")}],
}
Expand All @@ -652,12 +652,16 @@ def make_contact(args, is_primary_contact=1):
contact.add_email(args.get("email_id"), is_primary=True)
if args.get("mobile_no"):
contact.add_phone(args.get("mobile_no"), is_primary_mobile_no=True)
contact.insert()

if flags := args.get("flags"):
contact.insert(ignore_permissions=flags.get("ignore_permissions"))
else:
contact.insert()

return contact


def make_address(args, is_primary_address=1):
def make_address(args, is_primary_address=1, is_shipping_address=1):
reqd_fields = []
for field in ["city", "country"]:
if not args.get(field):
Expand All @@ -673,17 +677,23 @@ def make_address(args, is_primary_address=1):
address = frappe.get_doc(
{
"doctype": "Address",
"address_title": args.get("name"),
"address_title": args.get("customer_name"),
"address_line1": args.get("address_line1"),
"address_line2": args.get("address_line2"),
"city": args.get("city"),
"state": args.get("state"),
"pincode": args.get("pincode"),
"country": args.get("country"),
"is_primary_address": is_primary_address,
"is_shipping_address": is_shipping_address,
"links": [{"link_doctype": args.get("doctype"), "link_name": args.get("name")}],
}
).insert()
)

if flags := args.get("flags"):
address.insert(ignore_permissions=flags.get("ignore_permissions"))
else:
address.insert()

return address

Expand Down

0 comments on commit f337bf5

Please sign in to comment.