Esempio n. 1
0
	def before_rename(self, olddn, newdn, merge=False):
		if merge:
			if not webnotes.conn.exists("Warehouse", newdn):
				webnotes.throw(_("Warehouse ") + newdn +_(" does not exists"))
				
			if self.doc.company != webnotes.conn.get_value("Warehouse", newdn, "company"):
				webnotes.throw(_("Both Warehouse must belong to same Company"))
				
			webnotes.conn.sql("delete from `tabBin` where warehouse=%s", olddn)
			
		from accounts.utils import rename_account_for
		rename_account_for("Warehouse", olddn, newdn, merge)

		return newdn
Esempio n. 2
0
    def before_rename(self, olddn, newdn, merge=False):
        if merge:
            if not webnotes.conn.exists("Warehouse", newdn):
                webnotes.throw(_("Warehouse ") + newdn + _(" does not exists"))

            if self.doc.company != webnotes.conn.get_value(
                    "Warehouse", newdn, "company"):
                webnotes.throw(_("Both Warehouse must belong to same Company"))

            webnotes.conn.sql("delete from `tabBin` where warehouse=%s", olddn)

        from accounts.utils import rename_account_for
        rename_account_for("Warehouse", olddn, newdn, merge)

        return newdn
Esempio n. 3
0
	def before_rename(self, olddn, newdn, merge=False):
		# Add company abbr if not provided
		from setup.doctype.company.company import get_name_with_abbr
		new_warehouse = get_name_with_abbr(newdn, self.doc.company)

		if merge:
			if self.doc.company != webnotes.conn.get_value("Warehouse", new_warehouse, "company"):
				webnotes.throw(_("Both Warehouse must belong to same Company"))
				
			webnotes.conn.sql("delete from `tabBin` where warehouse=%s", olddn)
			
		from accounts.utils import rename_account_for
		rename_account_for("Warehouse", olddn, new_warehouse, merge)

		return new_warehouse
Esempio n. 4
0
    def before_rename(self, olddn, newdn, merge=False):
        # Add company abbr if not provided
        from setup.doctype.company.company import get_name_with_abbr
        new_warehouse = get_name_with_abbr(newdn, self.doc.company)

        if merge:
            if self.doc.company != webnotes.conn.get_value(
                    "Warehouse", new_warehouse, "company"):
                webnotes.throw(_("Both Warehouse must belong to same Company"))

            webnotes.conn.sql("delete from `tabBin` where warehouse=%s", olddn)

        from accounts.utils import rename_account_for
        rename_account_for("Warehouse", olddn, new_warehouse, merge)

        return new_warehouse
Esempio n. 5
0
	def before_rename(self, olddn, newdn, merge=False):
		from accounts.utils import rename_account_for
		rename_account_for("Customer", olddn, newdn, merge, self.doc.company)
Esempio n. 6
0
 def before_rename(self, olddn, newdn, merge=False):
     from accounts.utils import rename_account_for
     rename_account_for("Supplier", olddn, newdn, merge)
Esempio n. 7
0
 def before_rename(self, olddn, newdn, merge=False):
     from accounts.utils import rename_account_for
     rename_account_for("Customer", olddn, newdn, merge, self.doc.company)
Esempio n. 8
0
	def before_rename(self, olddn, newdn, merge=False):
		from accounts.utils import rename_account_for
		rename_account_for("Supplier", olddn, newdn, merge)