Reviewers: ,


Please review this at http://codereview.tryton.org/647002/

Affected files:
  M tryton/gui/window/win_form.py


Index: tryton/gui/window/win_form.py
===================================================================

--- a/tryton/gui/window/win_form.py
+++ b/tryton/gui/window/win_form.py
@@ -53,10 +53,8 @@
         self.but_cancel = None
         self.but_ok = None
         self.but_new = None
-        if new or self.save_current:
-            icon_cancel = gtk.STOCK_CANCEL
-            self.but_cancel = self.win.add_button(icon_cancel,
-                    gtk.RESPONSE_CANCEL)
+        self.but_cancel = self.win.add_button(gtk.STOCK_CANCEL,
+            gtk.RESPONSE_CANCEL)

         if new and self.many:
             self.but_new = self.win.add_button(gtk.STOCK_NEW,
@@ -427,7 +425,14 @@
         if (self.but_cancel
                 and self.screen.current_record
                 and response_id in cancel_responses):
- self.screen.group.remove(self.screen.current_record, remove=True)
+            if (self.screen.current_record.id < 0
+                    or self.save_current):
+                self.screen.group.remove(self.screen.current_record,
+                    remove=True)
+            elif self.screen.current_record.modified:
+                self.screen.current_record.cancel()
+                self.screen.current_record.reload()
+                self.screen.current_record.signal('record-changed')
             result = False
         else:
             result = response_id not in cancel_responses



--
--
[email protected] mailing list



Reply via email to