def set_missing_lead_customer_details(self): if getattr(self, "customer", None): from erpnext.accounts.party import _get_party_details fetch_payment_terms_template = False if (self.get("__islocal") or self.company != frappe.db.get_value( self.doctype, self.name, 'company')): fetch_payment_terms_template = True party_details = _get_party_details( self.customer, ignore_permissions=self.flags.ignore_permissions, doctype=self.doctype, company=self.company, fetch_payment_terms_template=fetch_payment_terms_template, party_address=self.customer_address, shipping_address=self.shipping_address_name) if not self.meta.get_field("sales_team"): party_details.pop("sales_team") self.update_if_missing(party_details) elif getattr(self, "lead", None): from erpnext.crm.doctype.lead.lead import get_lead_details self.update_if_missing( get_lead_details(self.lead, posting_date=self.get('transaction_date') or self.get('posting_date'), company=self.company))
def set_missing_lead_customer_details(self, for_validate=False): customer, lead = None, None if getattr(self, "customer", None): customer = self.customer elif self.doctype == "Opportunity" and self.party_name: if self.opportunity_from == "Customer": customer = self.party_name else: lead = self.party_name elif self.doctype == "Quotation" and self.party_name: if self.quotation_to == "Customer": customer = self.party_name else: lead = self.party_name if customer: from erpnext.accounts.party import _get_party_details fetch_payment_terms_template = False if self.get("__islocal") or self.company != frappe.db.get_value( self.doctype, self.name, "company"): fetch_payment_terms_template = True party_details = _get_party_details( customer, ignore_permissions=self.flags.ignore_permissions, doctype=self.doctype, company=self.company, posting_date=self.get("posting_date"), fetch_payment_terms_template=fetch_payment_terms_template, party_address=self.customer_address, shipping_address=self.shipping_address_name, company_address=self.get("company_address"), ) if not self.meta.get_field("sales_team"): party_details.pop("sales_team") self.update_if_missing(party_details) elif lead: from erpnext.crm.doctype.lead.lead import get_lead_details self.update_if_missing( get_lead_details( lead, posting_date=self.get("transaction_date") or self.get("posting_date"), company=self.company, )) if self.get("taxes_and_charges" ) and not self.get("taxes") and not for_validate: taxes = get_taxes_and_charges("Sales Taxes and Charges Template", self.taxes_and_charges) for tax in taxes: self.append("taxes", tax)
def set_missing_lead_customer_details(self): if getattr(self, "customer", None): from erpnext.accounts.party import _get_party_details party_details = _get_party_details(self.customer, ignore_permissions=self.flags.ignore_permissions) if not self.meta.get_field("sales_team"): party_details.pop("sales_team") self.update_if_missing(party_details) elif getattr(self, "lead", None): from erpnext.crm.doctype.lead.lead import get_lead_details self.update_if_missing(get_lead_details(self.lead))
def set_missing_lead_customer_details(self): if getattr(self, "customer", None): from erpnext.accounts.party import _get_party_details party_details = _get_party_details(self.customer, ignore_permissions=self.flags.ignore_permissions) if not self.meta.get_field("sales_team"): party_details.pop("sales_team") self.update_if_missing(party_details) elif getattr(self, "lead", None): from erpnext.crm.doctype.lead.lead import get_lead_details self.update_if_missing(get_lead_details(self.lead))
def set_missing_lead_customer_details(self): if getattr(self, "customer", None): from erpnext.accounts.party import _get_party_details party_details = _get_party_details(self.customer, ignore_permissions=self.flags.ignore_permissions, doctype=self.doctype, company=self.company) if not self.meta.get_field("sales_team"): party_details.pop("sales_team") self.update_if_missing(party_details) elif getattr(self, "lead", None): from erpnext.crm.doctype.lead.lead import get_lead_details self.update_if_missing(get_lead_details( self.lead, posting_date=self.get('transaction_date') or self.get('posting_date'), company=self.company))
def set_missing_lead_customer_details(self): if getattr(self, "customer", None): from erpnext.accounts.party import _get_party_details party_details = _get_party_details(self.customer, ignore_permissions=self.flags.ignore_permissions, doctype=self.doctype, company=self.company) if not self.meta.get_field("sales_team"): party_details.pop("sales_team") self.update_if_missing(party_details) elif getattr(self, "lead", None): from erpnext.crm.doctype.lead.lead import get_lead_details self.update_if_missing(get_lead_details( self.lead, posting_date=self.get('transaction_date') or self.get('posting_date'), company=self.company))
def set_missing_lead_customer_details(self): if getattr(self, "customer", None): from erpnext.accounts.party import _get_party_details fetch_payment_terms_template = False if (self.get("__islocal") or self.company != frappe.db.get_value(self.doctype, self.name, 'company')): fetch_payment_terms_template = True party_details = _get_party_details(self.customer, ignore_permissions=self.flags.ignore_permissions, doctype=self.doctype, company=self.company, fetch_payment_terms_template=fetch_payment_terms_template) if not self.meta.get_field("sales_team"): party_details.pop("sales_team") self.update_if_missing(party_details) elif getattr(self, "lead", None): from erpnext.crm.doctype.lead.lead import get_lead_details self.update_if_missing(get_lead_details( self.lead, posting_date=self.get('transaction_date') or self.get('posting_date'), company=self.company))