From 21b854b7cc46723ad44464b61250ea20e864fbff Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 9 May 2013 13:21:13 +0530 Subject: [PATCH] [rename] [fix] merge related fixes --- setup/doctype/company/company.py | 4 ++++ stock/doctype/serial_no/serial_no.py | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/setup/doctype/company/company.py b/setup/doctype/company/company.py index e383fb1bc8..9863d7d28b 100644 --- a/setup/doctype/company/company.py +++ b/setup/doctype/company/company.py @@ -16,6 +16,7 @@ from __future__ import unicode_literals import webnotes +from webnotes import _, msgprint from webnotes.utils import cstr from webnotes.model.doc import Document @@ -288,6 +289,9 @@ class DocType: and value=%s""", self.doc.name) def on_rename(self,newdn,olddn, merge=False): + if merge: + msgprint(_("Sorry. Companies cannot be merged"), raise_exception=True) + webnotes.conn.sql("""update `tabCompany` set company_name=%s where name=%s""", (newdn, olddn)) diff --git a/stock/doctype/serial_no/serial_no.py b/stock/doctype/serial_no/serial_no.py index e85a947899..501b535c6e 100644 --- a/stock/doctype/serial_no/serial_no.py +++ b/stock/doctype/serial_no/serial_no.py @@ -19,7 +19,7 @@ import webnotes from webnotes.utils import cint, getdate, nowdate import datetime -from webnotes import msgprint +from webnotes import msgprint, _ from controllers.stock_controller import StockController @@ -119,6 +119,9 @@ class DocType(StockController): def on_rename(self, new, old, merge=False): """rename serial_no text fields""" + if merge: + msgprint(_("Sorry. Serial Nos. cannot be merged"), raise_exception=True) + for dt in webnotes.conn.sql("""select parent from tabDocField where fieldname='serial_no' and fieldtype='Text'"""):