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))
示例#2
0
 def set_missing_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)
         self.address = party_details.customer_address
示例#3
0
	def set_missing_lead_customer_details(self):
		if self.doc.customer:
			from erpnext.accounts.party import _get_party_details
			self.doc.update_if_missing(_get_party_details(self.doc.customer,
				ignore_permissions=self.bean.ignore_permissions))
		
		elif self.doc.lead:
			from erpnext.selling.doctype.lead.lead import get_lead_details
			self.doc.update_if_missing(get_lead_details(self.doc.lead))
示例#4
0
	def set_missing_lead_customer_details(self):
		if getattr(self, "customer", None):
			from erpnext.accounts.party import _get_party_details
			self.update_if_missing(_get_party_details(self.customer,
				ignore_permissions=getattr(self, "ignore_permissions", None)))

		elif getattr(self, "lead", None):
			from erpnext.selling.doctype.lead.lead import get_lead_details
			self.update_if_missing(get_lead_details(self.lead))
示例#5
0
    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))
示例#7
0
	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))
示例#9
0
	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))
示例#10
0
	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))