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...