From 01ff7d4f9d41da3641031fd4782f1b770f60dfe3 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Sat, 2 Feb 2013 19:20:35 +0530 Subject: [PATCH] fixes in alter table and updated listviews for delivery note and purchase receipt --- webnotes/model/db_schema.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/webnotes/model/db_schema.py b/webnotes/model/db_schema.py index 97d40252ec..8ba3a57629 100644 --- a/webnotes/model/db_schema.py +++ b/webnotes/model/db_schema.py @@ -34,7 +34,7 @@ type_map = { 'currency': ('decimal', '18,6') ,'int': ('int', '11') ,'float': ('decimal', '18,6') - ,'percent': ('decimal', '9,6') + ,'percent': ('decimal', '18,6') ,'check': ('int', '1') ,'small text': ('text', '') ,'long text': ('longtext', '') @@ -264,10 +264,16 @@ class DbColumn: self.table.add_index.append(self) # default - if (self.default and (current_def['default'] != self.default) and (self.default not in default_shortcuts) and not (column_def in ['text','blob'])): + if (self.default and self.default_changed(current_def) and (self.default not in default_shortcuts) and not (column_def in ['text','blob'])): self.table.set_default.append(self) + def default_changed(self, current_def): + if "decimal" in current_def['type']: + return float(current_def['default'])!=float(self.default) + else: + return current_def['default'] != self.default + class DbManager: """ Basically, a wrapper for oft-used mysql commands. like show tables,databases, variables etc...