From 0cfca64491ad5549d2a41aa00632d8558d83b75f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 8 May 2010 17:55:21 +0200 Subject: [PATCH 01/97] Increase version number --- tryton/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/version.py b/tryton/version.py index dc1781dfc6..c5d85477d6 100644 --- a/tryton/version.py +++ b/tryton/version.py @@ -1,7 +1,7 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. PACKAGE = "tryton" -VERSION = "1.6.0" +VERSION = "1.6.1" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From 8f115955b9a1ce31912a2d10c9be971d549088dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 3 Jun 2010 08:22:24 +0200 Subject: [PATCH 02/97] Fix typo introduced during refactoring (transplanted from a763fd86d8cb2d333cd4a953ffd66b41f633bc88) --- tryton/gui/window/view_form/view/form_gtk/reference.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/reference.py b/tryton/gui/window/view_form/view/form_gtk/reference.py index 53443f646c..7a7ab60b3b 100644 --- a/tryton/gui/window/view_form/view/form_gtk/reference.py +++ b/tryton/gui/window/view_form/view/form_gtk/reference.py @@ -161,7 +161,7 @@ class Reference(WidgetInterface): if screen.save_current(): value = (screen.current_record.id, screen.current_record.rec_name()) - self.field(self.record, (model, value), + self.field.set_client(self.record, (model, value), force_change=True) break else: From ea9d83840600b97298a11176cd5824c821a29d9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 3 Jun 2010 19:50:50 +0200 Subject: [PATCH 03/97] get_eval must return a list of id for O2M for issue1572 (transplanted from 9b7dff6ee8ef230b63c42e38eaf01ab29bf4dc0e) --- tryton/gui/window/view_form/model/field.py | 6 ++++++ tryton/gui/window/view_form/model/record.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/model/field.py b/tryton/gui/window/view_form/model/field.py index 66363dc9d7..2840470e9b 100644 --- a/tryton/gui/window/view_form/model/field.py +++ b/tryton/gui/window/view_form/model/field.py @@ -76,6 +76,9 @@ class CharField(object): return self.get(record, check_load=check_load, readonly=True, modified=False) + def get_on_change_value(self, record, check_load=True): + return self.get_eval(record, check_load=check_load) + def set_client(self, record, value, force_change=False): internal = record.value.get(self.name, False) prev_modified = record.modified @@ -393,6 +396,9 @@ class O2MField(CharField): return result def get_eval(self, record, check_load=True): + return [x.id for x in record.value.get(self.name) or []] + + def get_on_change_value(self, record, check_load=True): result = [] if record.value.get(self.name) is None: return [] diff --git a/tryton/gui/window/view_form/model/record.py b/tryton/gui/window/view_form/model/record.py index 1c22746883..436e928ec4 100644 --- a/tryton/gui/window/view_form/model/record.py +++ b/tryton/gui/window/view_form/model/record.py @@ -366,7 +366,7 @@ class Record(SignalEvent): res = {} values = {} for name, field in self.group.fields.iteritems(): - values[name] = field.get_eval(self, check_load=False) + values[name] = field.get_on_change_value(self, check_load=False) if self.parent and self.parent_name: values['_parent_' + self.parent_name] = EvalEnvironment(self.parent, False) From 097e77004115fe04da689c619b346e631c978141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 3 Jun 2010 20:08:54 +0200 Subject: [PATCH 04/97] Process all pending events when calling main_iteration for issue1571 (transplanted from dac9e96ee7aa7579db1fe33c1f31e0092325da15) --- tryton/common/cellrendererbutton.py | 3 ++- tryton/common/common.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tryton/common/cellrendererbutton.py b/tryton/common/cellrendererbutton.py index 4ea797c3b5..f57f83b468 100644 --- a/tryton/common/cellrendererbutton.py +++ b/tryton/common/cellrendererbutton.py @@ -77,7 +77,8 @@ class CellRendererButton(gtk.GenericCellRenderer): and event.keyval == gtk.keysyms.space)): self.clicking = True widget.queue_draw() - gtk.main_iteration() + while gtk.events_pending(): + gtk.main_iteration() self.emit("clicked", path) def timeout(self, widget): self.clicking = False diff --git a/tryton/common/common.py b/tryton/common/common.py index 09347e69a7..adf3ea2fef 100644 --- a/tryton/common/common.py +++ b/tryton/common/common.py @@ -1009,10 +1009,12 @@ class RPCProgress(object): win.set_modal(True) win.show_all() progressbar.pulse() - gtk.main_iteration() + while gtk.events_pending(): + gtk.main_iteration() if win: win.destroy() - gtk.main_iteration() + while gtk.events_pending(): + gtk.main_iteration() if self.exception: raise self.exception return self.res From 6f7c8ba1b0e385102430b5122d54eadf87a67e6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 20 Jun 2010 22:30:21 +0200 Subject: [PATCH 05/97] Always add record for o2m even if it was modified for issue1594 It is not possible to know if the record is already linked to the parent so it must always be added. (transplanted from e2d8a230655c8b2ead695e31064f0ca31af5cb29) --- tryton/gui/window/view_form/model/field.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tryton/gui/window/view_form/model/field.py b/tryton/gui/window/view_form/model/field.py index 2840470e9b..2e5b460e12 100644 --- a/tryton/gui/window/view_form/model/field.py +++ b/tryton/gui/window/view_form/model/field.py @@ -372,8 +372,7 @@ class O2MField(CharField): get_modifiedonly=modified) if record2.is_modified() and values: result.append(('write', record2.id, values)) - else: - result[0][1].append(record2.id) + result[0][1].append(record2.id) else: result.append(('create', record2.get(check_load=check_load, get_readonly=readonly))) From 68b0236d94df2496716d9d4b94253ef7107ec21a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 18 Jul 2010 18:55:35 +0200 Subject: [PATCH 06/97] Fix fingerprint check when getpeercert doesn't work for issue1619 With Python < 2.6 and without ssl module, getting peer certificate doesn't work. (transplanted from 7ce317af16581ab63fafb5468d8facc646597ef3) --- tryton/pysocket.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tryton/pysocket.py b/tryton/pysocket.py index b502baf1d0..ddff32be42 100644 --- a/tryton/pysocket.py +++ b/tryton/pysocket.py @@ -98,6 +98,7 @@ class PySocket: except: pass self.sock.settimeout(TIMEOUT) + fingerprint = None if self.ssl: if ssl: self.ssl_sock = ssl.wrap_socket(self.sock, @@ -105,17 +106,18 @@ class PySocket: ssl.CERT_REQUIRED or ssl.CERT_NONE)) elif hasattr(socket, 'ssl'): self.ssl_sock = socket.ssl(self.sock, certfile=self.ca_certs) - peercert = self.ssl_sock.getpeercert(True) + try: + peercert = self.ssl_sock.getpeercert(True) + except Exception: + peercert = None def format_hash(value): return reduce(lambda x, (i, y): x + y.upper() + ((i % 2 and i + 1 < len(value)) and ':' or ''), enumerate(value), '') - if hashlib: + if peercert and hashlib: fingerprint = format_hash(hashlib.sha1(peercert).hexdigest()) - else: + elif peercert: fingerprint = format_hash(sha1.new(peercert).hexdigest()) - else: - fingerprint = None self.host = host self.hostname = hostname self.port = port From 07f07ba1a9dad86db189fbfb28e33909995aa9f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 22 Jul 2010 20:04:39 +0200 Subject: [PATCH 07/97] Add synchronization of missing attributes between field and view for issue1609 (transplanted from b57982ac70d24a9f333e33cbee95f96dcef51041) --- tryton/gui/window/view_form/view/form_gtk/parser.py | 2 +- tryton/gui/window/view_form/view/list_gtk/parser.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/parser.py b/tryton/gui/window/view_form/view/form_gtk/parser.py index e75f22dc8a..c203dfc9dc 100644 --- a/tryton/gui/window/view_form/view/form_gtk/parser.py +++ b/tryton/gui/window/view_form/view/form_gtk/parser.py @@ -518,7 +518,7 @@ class ParserForm(ParserInterface): continue for attr_name in ('relation', 'domain', 'selection', 'relation_field', 'string', 'views', 'invisible', - 'add_remove', 'sort'): + 'add_remove', 'sort', 'context'): if attr_name in fields[name].attrs and \ not attr_name in attrs: attrs[attr_name] = fields[name].attrs[attr_name] diff --git a/tryton/gui/window/view_form/view/list_gtk/parser.py b/tryton/gui/window/view_form/view/list_gtk/parser.py index 3334a67936..c5363c8ef1 100644 --- a/tryton/gui/window/view_form/view/list_gtk/parser.py +++ b/tryton/gui/window/view_form/view/list_gtk/parser.py @@ -100,8 +100,10 @@ class ParserTree(ParserInterface): if fname not in fields: continue for attr_name in ('relation', 'domain', 'selection', - 'sort'): - if attr_name in fields[fname].attrs: + 'relation_field', 'string', 'views', 'invisible', + 'add_remove', 'sort', 'context'): + if attr_name in fields[fname].attrs and \ + not attr_name in node_attrs: node_attrs[attr_name] = fields[fname].attrs[attr_name] cell = CELLTYPES.get(node_attrs.get('widget', fields[fname].attrs['type']))(fname, model_name, From 7912f2b3d8ba27ccda2e8068b03c4feaaf8b07f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 22 Jul 2010 20:05:27 +0200 Subject: [PATCH 08/97] Add missing context to pass to new call when switching view for issue1609 (transplanted from 6e20571014d26d1c56cfdb04f818684c5963723b) --- tryton/gui/window/view_form/screen/screen.py | 4 ++-- tryton/gui/window/win_form.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tryton/gui/window/view_form/screen/screen.py b/tryton/gui/window/view_form/screen/screen.py index d86b829bf6..88f03e626d 100644 --- a/tryton/gui/window/view_form/screen/screen.py +++ b/tryton/gui/window/view_form/screen/screen.py @@ -243,7 +243,7 @@ class Screen(SignalEvent): self.group.signal_unconnect(self) del self.views - def switch_view(self, view_type=None): + def switch_view(self, view_type=None, default=True, context=None): self.current_view.set_value() if self.current_record and self.current_record not in self.group: self.current_record = None @@ -267,7 +267,7 @@ class Screen(SignalEvent): self.current_record.validate_set() else: if self.current_view.view_type == 'form': - self.new() + self.new(default=default, context=context) self.current_view.cancel() self.display(set_cursor=True) diff --git a/tryton/gui/window/win_form.py b/tryton/gui/window/win_form.py index f55de179bc..89534cb9e6 100644 --- a/tryton/gui/window/win_form.py +++ b/tryton/gui/window/win_form.py @@ -27,7 +27,7 @@ class WinForm(object): view_type not in self.screen.view_to_load: self.screen.add_view_id(False, view_type, display=True) else: - self.screen.switch_view(view_type=view_type) + self.screen.switch_view(view_type=view_type, context=context) if new and not switch_new: self.screen.new(context=self.context) self.win = gtk.Dialog(_('Link'), parent, From 3a391830abb073edaf3dfba4296f3912b8bf019d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 22 Jul 2010 20:10:54 +0200 Subject: [PATCH 09/97] Fix typo when saving wizard size for issue1521 (transplanted from dc7b75fd798ae757079bebf2535e45d56a00b372) --- tryton/wizard/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/wizard/main.py b/tryton/wizard/main.py index c553872269..b3426c8b24 100644 --- a/tryton/wizard/main.py +++ b/tryton/wizard/main.py @@ -129,7 +129,7 @@ class Dialog(object): if (width, height) != (self.widget_width, self.widget_height): try: rpc.execute('model', 'ir.action.wizard_size', 'set_size', - self.action, self.screen.name, width, height, + self.action, self.screen.model_name, width, height, rpc.CONTEXT) except: pass From feb30729bdcdb19c4e9c52e2ea9d307ce6abee05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 23 Jul 2010 20:10:22 +0200 Subject: [PATCH 10/97] Fix typo in __setitem__ of model group (transplanted from f172fc39d027012896cf29409ac70f51e83a07ba) --- tryton/gui/window/view_form/model/group.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/model/group.py b/tryton/gui/window/view_form/model/group.py index 2f5824b4f4..5ec770b5e2 100644 --- a/tryton/gui/window/view_form/model/group.py +++ b/tryton/gui/window/view_form/model/group.py @@ -100,7 +100,7 @@ class Group(SignalEvent, list): def __setitem__(self, i, value): super(Group, self).__setitem__(i, value) if not self.lock_signal: - self.signal('group-list-changed', ('record-changed', key)) + self.signal('group-list-changed', ('record-changed', i)) def __repr__(self): return '' % (self.model_name, id(self)) From 679d841734aea8fbba569c5438a455f31f9c5778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 25 Jul 2010 15:52:42 +0200 Subject: [PATCH 11/97] Prepare release 1.6.1 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index d675bcc17e..f0ccabbc26 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 1.6.1 - 2010-07-25 +* Bug fixes (see mercurial logs for details) + Version 1.6.0 - 2010-05-08 * Bug fixes (see mercurial logs for details) * Don't stop wizard execution when exception occurs From 3d59c99ea2a7a50f3d6f26792dcecb447d21eb2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 25 Jul 2010 15:52:46 +0200 Subject: [PATCH 12/97] Added tag 1.6.1 for changeset 35ec9b3ff051 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 7d5d74114c..2480d717b5 100644 --- a/.hgtags +++ b/.hgtags @@ -2,3 +2,4 @@ 9a6434d63616f46520b6fa1b2be31906ff6f4f6a 1.2.0 de84c1443d4bad908eabb99c381578b988c2117f 1.4.0 3976912b23dfc5db2525d4c2e55d17f099d9492d 1.6.0 +35ec9b3ff051217fdc17b4a4f5d443cf53302d4b 1.6.1 From b7fd2225de64de48a15dcdefdc422e9425950f66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 25 Jul 2010 16:09:14 +0200 Subject: [PATCH 13/97] Increase version number --- tryton/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/version.py b/tryton/version.py index c5d85477d6..e7943ece7e 100644 --- a/tryton/version.py +++ b/tryton/version.py @@ -1,7 +1,7 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. PACKAGE = "tryton" -VERSION = "1.6.1" +VERSION = "1.6.2" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From c67a7ec871ad8cf2482ea4ef5cc45914622fab56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 24 Aug 2010 20:59:00 +0200 Subject: [PATCH 14/97] Fix recursion between validate and reload for issue1652 (transplanted from 0669944db78145ddc9776fed34f54137e9ef4cef) --- tryton/gui/window/view_form/model/record.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tryton/gui/window/view_form/model/record.py b/tryton/gui/window/view_form/model/record.py index 436e928ec4..2b9f5b3a73 100644 --- a/tryton/gui/window/view_form/model/record.py +++ b/tryton/gui/window/view_form/model/record.py @@ -260,8 +260,9 @@ class Record(SignalEvent): self.signal('record-changed') return change - def validate(self): - self._check_load() + def validate(self, check_load=True): + if check_load: + self._check_load() res = True for field in self.group.fields.itervalues(): if not field.validate(self): @@ -342,7 +343,7 @@ class Record(SignalEvent): if self.id < 0: return self['*'] - self.validate() + self.validate(check_load=False) def expr_eval(self, expr, check_load=False): if not isinstance(expr, basestring): From 7693e6fe3cc5de94f0e91fa82d312c148155541b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 19 Sep 2010 17:06:00 +0200 Subject: [PATCH 15/97] on_write should be called with list for issue1690 (transplanted from 84cfdd6a45c1e698af42b9e76a521e76bf2a100c) --- tryton/gui/window/view_form/screen/screen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/screen/screen.py b/tryton/gui/window/view_form/screen/screen.py index 88f03e626d..1feea02259 100644 --- a/tryton/gui/window/view_form/screen/screen.py +++ b/tryton/gui/window/view_form/screen/screen.py @@ -506,7 +506,7 @@ class Screen(SignalEvent): context.update(rpc.CONTEXT) context.update(self.context) context['_timestamp'] = self.current_record.get_timestamp() - reload_ids = self.group.on_write_ids(record_id) + reload_ids = self.group.on_write_ids([record_id]) if reload_ids and record_id in reload_ids: reload_ids.remove(record_id) args = ('model', self.model_name, 'delete', [record_id], From a430f9d8557630340189f1c20699d46e4507256a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 19 Sep 2010 18:49:12 +0200 Subject: [PATCH 16/97] Fix nested _parent_ evalutation for issue1697 check_load was not passed to the parent EvalEnvironment instance (transplanted from 4bf73d057f064bdbd05fcccd96ee03424fd223a3) --- tryton/gui/window/view_form/model/record.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/model/record.py b/tryton/gui/window/view_form/model/record.py index 2b9f5b3a73..d101f6d69e 100644 --- a/tryton/gui/window/view_form/model/record.py +++ b/tryton/gui/window/view_form/model/record.py @@ -19,7 +19,7 @@ class EvalEnvironment(dict): def __getitem__(self, item): if item == '_parent_' + self.parent.parent_name and self.parent.parent: - return EvalEnvironment(self.parent.parent) + return EvalEnvironment(self.parent.parent, self.check_load) return self.parent.get_eval(check_load=self.check_load)[item] def __getattr__(self, item): From c0ae02b8e5dfa2151d8644f77d86bda95336e7e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 19 Sep 2010 20:03:01 +0200 Subject: [PATCH 17/97] Remove unused code --- tryton/gui/window/view_tree/view_tree.py | 29 ------------------------ 1 file changed, 29 deletions(-) diff --git a/tryton/gui/window/view_tree/view_tree.py b/tryton/gui/window/view_tree/view_tree.py index 0a806669fa..ea94781ef0 100644 --- a/tryton/gui/window/view_tree/view_tree.py +++ b/tryton/gui/window/view_tree/view_tree.py @@ -293,35 +293,6 @@ class ViewTreeModel(gtk.GenericTreeModel, gtk.TreeSortable): return None return node[:-1] - def cus_refresh(self): - tree = self.tree - tree[0][2] = None - - def _cus_row_find(self, ids_res): - tree = self.tree - try: - ids = ids_res[:] - while len(ids)>0: - if ids[-1] in self.roots: - ids.pop() - break - ids.pop() - path = [] - while ids != []: - path.append(0) - val = ids.pop() - i = iter(tree) - while True: - node = i.next() - if node[0] == val: - break - path[-1] += 1 - if (node[2] is None) and (ids != []): - return None - tree = node[2] - return (tuple(path), node) - except: - return None class ViewTree(object): "View tree" From 10a760fb1221a996858c9e2a1485af227f538ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 25 Sep 2010 16:42:53 +0200 Subject: [PATCH 18/97] Fix DateTime widget on list view for issue1691 (transplanted from d06ae621962c3ceca4c957c32e08ebae20238f2e) --- tryton/gui/window/view_form/view/list_gtk/parser.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tryton/gui/window/view_form/view/list_gtk/parser.py b/tryton/gui/window/view_form/view/list_gtk/parser.py index c5363c8ef1..c8cafeaf92 100644 --- a/tryton/gui/window/view_form/view/list_gtk/parser.py +++ b/tryton/gui/window/view_form/view/list_gtk/parser.py @@ -386,6 +386,7 @@ class Datetime(Date): super(Datetime, self).__init__(field_name, model_name, treeview, window, attrs=attrs) self.display_format = date_format() + ' ' + HM_FORMAT + self.renderer.format = self.display_format def get_textual_value(self, record): value = record[self.field_name].get_client(record) From 6ee8986bdac3a0fab55c422518eeab78a1afa763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 26 Sep 2010 18:28:31 +0200 Subject: [PATCH 19/97] Fix wrong login by setting _USER to None instead of root for issue1702 (transplanted from b5d732315dcd772077b68e7a07f56f4db01c53a1) --- tryton/rpc.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tryton/rpc.py b/tryton/rpc.py index 3899fcdae8..bb627d207b 100644 --- a/tryton/rpc.py +++ b/tryton/rpc.py @@ -9,7 +9,7 @@ from tryton.fingerprints import Fingerprints from tryton.config import get_config_dir _SOCK = None -_USER = 0 +_USER = None _USERNAME = '' _SESSION = '' _DATABASE = '' @@ -141,11 +141,11 @@ def login(username, password, host, port, database): _SOCK.reconnect() except (socket.error, RuntimeError): pass - _USER = 0 + _USER = None _SESSION = '' return -1 if not res: - _USER = 0 + _USER = None _SESSION = '' return -2 _USER = res[0] @@ -174,7 +174,7 @@ def logout(): pass _SOCK.disconnect() _SOCK = None - _USER = 0 + _USER = None _USERNAME = '' _SESSION = '' _DATABASE = '' From 67ac4cce772bae1b6e3498cd5d7d051ecbe23cc7 Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Tue, 2 Nov 2010 21:13:35 +0100 Subject: [PATCH 20/97] Prepare release 1.6.2 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index f0ccabbc26..6a9c5ef285 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 1.6.2 - 2010-11-02 +* Bug fixes (see mercurial logs for details) + Version 1.6.1 - 2010-07-25 * Bug fixes (see mercurial logs for details) From 74829088e82dca8dac411b324806b893c6aa9bb0 Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Tue, 2 Nov 2010 21:13:35 +0100 Subject: [PATCH 21/97] Added tag 1.6.2 for changeset a0a5789e2683 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 2480d717b5..88485730bb 100644 --- a/.hgtags +++ b/.hgtags @@ -3,3 +3,4 @@ de84c1443d4bad908eabb99c381578b988c2117f 1.4.0 3976912b23dfc5db2525d4c2e55d17f099d9492d 1.6.0 35ec9b3ff051217fdc17b4a4f5d443cf53302d4b 1.6.1 +a0a5789e26833bfe4998cac477f90438a96c344a 1.6.2 From f0990f02aa9281168a9e5e351d13e8756e32b2e1 Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Tue, 2 Nov 2010 21:13:38 +0100 Subject: [PATCH 22/97] Increase version number --- tryton/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/version.py b/tryton/version.py index e7943ece7e..fb130f0db9 100644 --- a/tryton/version.py +++ b/tryton/version.py @@ -1,7 +1,7 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. PACKAGE = "tryton" -VERSION = "1.6.2" +VERSION = "1.6.3" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From db72f35e887e69f3fef0232736f692ff4a04fee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 2 Dec 2010 22:41:30 +0100 Subject: [PATCH 23/97] Fix D&D as field is defined on group no more on record (transplanted from 23eabfd945b827b5583a09ad0b77308554d23378) --- tryton/gui/window/view_form/view/list.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/view/list.py b/tryton/gui/window/view_form/view/list.py index 86d802f85a..650ff98846 100644 --- a/tryton/gui/window/view_form/view/list.py +++ b/tryton/gui/window/view_form/view/list.py @@ -368,8 +368,9 @@ class ViewList(ParserView): info, etime): treeview.emit_stop_by_name('drag-data-received') if treeview.sequence: + field = self.screen.group.fields[treeview.sequence] for record in self.screen.group: - if record[treeview.sequence].get_state_attrs( + if field.get_state_attrs( record).get('readonly', False): return if not selection.data: From 34ae8836aaf0abdb5a99d787b196643537b10be0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 27 Dec 2010 16:51:59 +0100 Subject: [PATCH 24/97] view could be closed during action execution for issue1791 (transplanted from 19de7633e9acb14b8c87d606daaca944bf9121a8) --- tryton/gui/window/view_form/view/form.py | 3 ++- tryton/gui/window/view_form/view/list.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tryton/gui/window/view_form/view/form.py b/tryton/gui/window/view_form/view/form.py index 3250d357fc..a8cbe2d03d 100644 --- a/tryton/gui/window/view_form/view/form.py +++ b/tryton/gui/window/view_form/view/form.py @@ -143,7 +143,8 @@ class ViewForm(ParserView): } value = Action._exec_action(act, self.window, data, {}) if atype in ('print', 'action'): - self.screen.reload(writen=True) + if self.screen: + self.screen.reload(writen=True) return value def __getitem__(self, name): diff --git a/tryton/gui/window/view_form/view/list.py b/tryton/gui/window/view_form/view/list.py index 650ff98846..fb3ba86bef 100644 --- a/tryton/gui/window/view_form/view/list.py +++ b/tryton/gui/window/view_form/view/list.py @@ -281,7 +281,8 @@ class ViewList(ParserView): 'ids': obj_ids, } value = Action._exec_action(act, self.window, data, {}) - self.screen.reload(writen=True) + if self.screen: + self.screen.reload(writen=True) return value From e3c7c7ee949cbe1bfb26ffd2a57be2071c0c50eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 31 Dec 2010 12:33:22 +0100 Subject: [PATCH 25/97] Prevent popups of many password windows for issue1768 (transplanted from f533cc8bac7cd585a888e1f74a2a05ff95146ec4) --- tryton/common/common.py | 48 ++++++++++++--------- tryton/gui/window/view_form/model/record.py | 2 - 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/tryton/common/common.py b/tryton/common/common.py index adf3ea2fef..398694d67f 100644 --- a/tryton/common/common.py +++ b/tryton/common/common.py @@ -31,6 +31,7 @@ try: except ImportError: ssl = None import dis +from threading import Lock _ = gettext.gettext @@ -799,6 +800,8 @@ This record has been modified while you were editing it. parent, context, ['form', 'tree']) return False +PLOCK = Lock() + def process_exception(exception, parent, *args): global _USERNAME, _DATABASE, _SOCK if str(exception.args[0]) == 'BadFingerprint': @@ -813,28 +816,33 @@ def process_exception(exception, parent, *args): message(_('Connection error!\n' \ 'Unable to connect to the server!'), parent) return False + if not PLOCK.acquire(False): + return False hostname = rpc._SOCK.hostname port = rpc._SOCK.port - while True: - password = ask(_('Password:'), parent, visibility=False) - if password is None: - raise Exception('NotLogged') - res = rpc.login(rpc._USERNAME, password, hostname, port, - rpc._DATABASE) - from tryton.gui.main import Main - Main.get_main().refresh_ssl() - if res == -1: - message(_('Connection error!\n' \ - 'Unable to connect to the server!'), parent) - return False - if res < 0: - continue - if args: - try: - return rpc.execute(*args) - except Exception, exception: - return process_exception(exception, parent, *args) - return True + try: + while True: + password = ask(_('Password:'), parent, visibility=False) + if password is None: + raise Exception('NotLogged') + res = rpc.login(rpc._USERNAME, password, hostname, port, + rpc._DATABASE) + from tryton.gui.main import Main + Main.get_main().refresh_ssl() + if res == -1: + message(_('Connection error!\n' \ + 'Unable to connect to the server!'), parent) + return False + if res < 0: + continue + if args: + try: + return rpc.execute(*args) + except Exception, exception: + return process_exception(exception, parent, *args) + return True + finally: + PLOCK.release() if exception.args[0] == 'ConcurrencyException': if len(args) >= 6: diff --git a/tryton/gui/window/view_form/model/record.py b/tryton/gui/window/view_form/model/record.py index d101f6d69e..944dcb9f0b 100644 --- a/tryton/gui/window/view_form/model/record.py +++ b/tryton/gui/window/view_form/model/record.py @@ -108,8 +108,6 @@ class Record(SignalEvent): except Exception, exception: values = common.process_exception(exception, self.window, *args) if not values: - log = logging.getLogger('record') - log.error('%s' % exception.args[-1]) values = [{'id': x} for x in ids] id2value = dict((value['id'], value) for value in values) if ids != [self.id]: From 811c2e7417860d69ef03bb8107cd62c751571b69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 9 Jan 2011 22:15:03 +0100 Subject: [PATCH 26/97] Add synchronization of missing size attribute between field and view for issue1801 (transplanted from 9367c61d106a647de01fff9a8f2e7be878dc7cfc) --- tryton/gui/window/view_form/view/form_gtk/parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/parser.py b/tryton/gui/window/view_form/view/form_gtk/parser.py index c203dfc9dc..8a7405fff8 100644 --- a/tryton/gui/window/view_form/view/form_gtk/parser.py +++ b/tryton/gui/window/view_form/view/form_gtk/parser.py @@ -518,7 +518,7 @@ class ParserForm(ParserInterface): continue for attr_name in ('relation', 'domain', 'selection', 'relation_field', 'string', 'views', 'invisible', - 'add_remove', 'sort', 'context'): + 'add_remove', 'sort', 'context', 'size'): if attr_name in fields[name].attrs and \ not attr_name in attrs: attrs[attr_name] = fields[name].attrs[attr_name] From 814d32ac28a6fa6b751b14796a11a7ffa29bf594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 13 Jan 2011 11:33:58 +0100 Subject: [PATCH 27/97] Add missing context to default_get call for issue1819 (transplanted from 3814ab387ce8799bebb881578879d331907a2b82) --- tryton/gui/window/view_form/view/form_gtk/interface.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/interface.py b/tryton/gui/window/view_form/view/form_gtk/interface.py index 87cde9e68c..c2b104e9c8 100644 --- a/tryton/gui/window/view_form/view/form_gtk/interface.py +++ b/tryton/gui/window/view_form/view/form_gtk/interface.py @@ -108,7 +108,8 @@ class WidgetInterface(object): if self.field.get_state_attrs(self.record).get('readonly', False): return False model_name = self.field.parent.model_name - args = ('model', model_name, 'default_get', [self.attrs['name']]) + args = ('model', model_name, 'default_get', [self.attrs['name']], + rpc.CONTEXT) try: res = rpc.execute(*args) except Exception, exception: From e7b3c88c7365fbfa2ec3058629b80fbea75d4b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 16 Jan 2011 22:18:27 +0100 Subject: [PATCH 28/97] Return Decimal value for numeric search for issue1805 (transplanted from 6dcc64647e04d84180e7db50e4e86f99335c3fb8) --- .../window/view_form/widget_search/float.py | 21 +++++++++++++++++++ .../window/view_form/widget_search/form.py | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/widget_search/float.py b/tryton/gui/window/view_form/widget_search/float.py index 73144a8885..ee6004ddfb 100644 --- a/tryton/gui/window/view_form/widget_search/float.py +++ b/tryton/gui/window/view_form/widget_search/float.py @@ -1,6 +1,7 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. import locale +from decimal import Decimal from integer import Integer import gettext @@ -64,3 +65,23 @@ class Float(Integer): widget.stop_emission('insert-text') except: widget.stop_emission('insert-text') + + +class Numeric(Float): + + def _value_get(self): + try: + value1 = Decimal(str(locale.atof(self.entry1.get_text()))) + except Exception: + value1 = False + try: + value2 = Decimal(str(locale.atof(self.entry2.get_text()))) + except Exception: + value2 = False + res = self._get_clause(value1, value2) + return res + + def _value_set(self, value): + super(Numeric, self)._value_set(value) + + value = property(_value_get, _value_set) diff --git a/tryton/gui/window/view_form/widget_search/form.py b/tryton/gui/window/view_form/widget_search/form.py index 4651dc9e44..7d4185eeb9 100644 --- a/tryton/gui/window/view_form/widget_search/form.py +++ b/tryton/gui/window/view_form/widget_search/form.py @@ -284,7 +284,7 @@ WIDGETS_TYPE = { 'date': (calendar.Calendar, 2), 'datetime': (calendar.Calendar, 2), 'float': (float.Float, 2), - 'numeric': (float.Float, 2), + 'numeric': (float.Numeric, 2), 'integer': (integer.Integer, 2), 'biginteger': (integer.Integer, 2), 'selection': (selection.Selection, 2), From cd4294249b1583c862789a51a1c7db2ac87eb3c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 28 Jan 2011 10:52:53 +0100 Subject: [PATCH 29/97] Destroy the dialog after reading value of the widget for issue1837 And call present on the parent window (transplanted from 9ccf31fb4b4350d418a55ba08f1811610da9aa4d) --- tryton/gui/window/form.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tryton/gui/window/form.py b/tryton/gui/window/form.py index 8cdedf3889..c4c1e7d432 100644 --- a/tryton/gui/window/form.py +++ b/tryton/gui/window/form.py @@ -193,9 +193,10 @@ class Form(SignalEvent): win.show_all() response = win.run() - win.destroy() if response == gtk.RESPONSE_OK: self.screen.display(locale.atoi(entry.get_text()), set_cursor=True) + win.destroy() + self.window.present() def destroy(self): self.screen.signal_unconnect(self) From 7010a3bd67f078a0a88fe0766aa8f01a2d946206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Thu, 27 Jan 2011 15:59:32 +0100 Subject: [PATCH 30/97] Fix typo (transplanted from 5e25e07e4764fb581dbce29beb6b942e8bd19cc2) --- tryton/gui/window/view_form/view/list_gtk/parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/view/list_gtk/parser.py b/tryton/gui/window/view_form/view/list_gtk/parser.py index c8cafeaf92..a8dc824660 100644 --- a/tryton/gui/window/view_form/view/list_gtk/parser.py +++ b/tryton/gui/window/view_form/view/list_gtk/parser.py @@ -823,7 +823,7 @@ class ProgressBar(object): class Button(object): - def __init__(self, treeview, windown, screen, attrs=None): + def __init__(self, treeview, window, screen, attrs=None): super(Button, self).__init__() self.attrs = attrs or {} self.renderer = CellRendererButton(attrs.get('string', _('Unknown'))) From 08d16855b4e6d54562a0331deaa99837658aaeba Mon Sep 17 00:00:00 2001 From: Korbinian Preisler Date: Fri, 28 Jan 2011 09:56:39 +0100 Subject: [PATCH 31/97] add missing context in rpc call of window wizard creation for issue1842 (transplanted from 8deb3010f9a00331384e0effbcdc2bb234ce6838) --- tryton/gui/window/wizard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/wizard.py b/tryton/gui/window/wizard.py index 25cf1aa0f4..148dd6671c 100644 --- a/tryton/gui/window/wizard.py +++ b/tryton/gui/window/wizard.py @@ -48,7 +48,7 @@ class Wizard(SignalEvent): self.context = context if not 'form' in datas: datas['form'] = {} - args = ('wizard', action, 'create') + args = ('wizard', action, 'create', rpc.CONTEXT) try: self.wiz_id = rpc.execute(*args) except Exception, exception: From 72b727bb21dcf8bae90a0673b5796086e169d49d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 7 Feb 2011 12:37:10 +0100 Subject: [PATCH 32/97] Backed out changeset fb7b14c085e3 --- tryton/gui/window/wizard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/wizard.py b/tryton/gui/window/wizard.py index 148dd6671c..25cf1aa0f4 100644 --- a/tryton/gui/window/wizard.py +++ b/tryton/gui/window/wizard.py @@ -48,7 +48,7 @@ class Wizard(SignalEvent): self.context = context if not 'form' in datas: datas['form'] = {} - args = ('wizard', action, 'create', rpc.CONTEXT) + args = ('wizard', action, 'create') try: self.wiz_id = rpc.execute(*args) except Exception, exception: From 9c28b9022bcd23675b2500f9401a48f0f0387c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 7 Feb 2011 23:22:24 +0100 Subject: [PATCH 33/97] Fix typo for issue1853 (transplanted from 4b7ca6a18fd84c5e6b5cfe1ef739dc826f5e326e) --- tryton/gui/window/view_form/model/record.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/model/record.py b/tryton/gui/window/view_form/model/record.py index 944dcb9f0b..562a9c4a6b 100644 --- a/tryton/gui/window/view_form/model/record.py +++ b/tryton/gui/window/view_form/model/record.py @@ -405,7 +405,7 @@ class Record(SignalEvent): elif isinstance(self.group.fields[fieldname], field.ReferenceField): if value: - ref_mode, ref_id = value.split(',', 1) + ref_model, ref_id = value.split(',', 1) if fieldname + '.rec_name' in res: value = ref_model, (ref_id, res[fieldname + '.rec_name']) From b8f1c13fce7eb9629792c078b712dab3a6d0d657 Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Sun, 13 Feb 2011 16:33:38 +0100 Subject: [PATCH 34/97] Update COPYRIGHT --- COPYRIGHT | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/COPYRIGHT b/COPYRIGHT index 1a619f1e33..f98ae5c521 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,8 +1,8 @@ -Copyright (C) 2007-2010 Cédric Krier. -Copyright (C) 2007-2010 Bertrand Chenal. -Copyright (C) 2008-2010 B2CK SPRL. -Copyright (C) 2008-2010 Udo Spallek. -Copyright (C) 2008-2010 virtual things - Preisler & Spallek GbR. +Copyright (C) 2007-2011 Cédric Krier. +Copyright (C) 2007-2011 Bertrand Chenal. +Copyright (C) 2008-2011 B2CK SPRL. +Copyright (C) 2008-2011 Udo Spallek. +Copyright (C) 2008-2011 virtual things - Preisler & Spallek GbR. Copyright (C) 2004-2008 Tiny SPRL. This program is free software: you can redistribute it and/or modify From 67e1a5a60daf3eac0cd75c7546c99e4488c6a95a Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Sun, 13 Feb 2011 17:30:54 +0100 Subject: [PATCH 35/97] Prepare release 1.6.3 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 6a9c5ef285..2baeda3317 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 1.6.3 - 2011-02-13 +* Bug fixes (see mercurial logs for details) + Version 1.6.2 - 2010-11-02 * Bug fixes (see mercurial logs for details) From 0eda9aa983b4e6ad853dc2afece517a30f8df300 Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Sun, 13 Feb 2011 17:30:54 +0100 Subject: [PATCH 36/97] Added tag 1.6.3 for changeset c807c9f30a09 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 88485730bb..3f78c1da06 100644 --- a/.hgtags +++ b/.hgtags @@ -4,3 +4,4 @@ de84c1443d4bad908eabb99c381578b988c2117f 1.4.0 3976912b23dfc5db2525d4c2e55d17f099d9492d 1.6.0 35ec9b3ff051217fdc17b4a4f5d443cf53302d4b 1.6.1 a0a5789e26833bfe4998cac477f90438a96c344a 1.6.2 +c807c9f30a09a7afb8e8f6b1aca7ad79f66f580d 1.6.3 From 978153ddf0c3d9abdf6a699e37af88495e43873e Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Sun, 13 Feb 2011 17:31:24 +0100 Subject: [PATCH 37/97] Increase version number --- tryton/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/version.py b/tryton/version.py index fb130f0db9..78c24340e0 100644 --- a/tryton/version.py +++ b/tryton/version.py @@ -1,7 +1,7 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. PACKAGE = "tryton" -VERSION = "1.6.3" +VERSION = "1.6.4" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From d30bb552b443ab89db19cbaa3aa096b0d7b19b6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 10 Feb 2011 11:04:10 +0100 Subject: [PATCH 38/97] Domain in selection must be PYSON decoded (transplanted from 9c544ce5e67e28ff9571b985b289ef01c5b80af0) --- tryton/gui/window/view_form/view/list_gtk/parser.py | 8 ++++++-- .../gui/window/view_form/widget_search/selection.py | 12 ++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/tryton/gui/window/view_form/view/list_gtk/parser.py b/tryton/gui/window/view_form/view/list_gtk/parser.py index a8dc824660..481bd6a6aa 100644 --- a/tryton/gui/window/view_form/view/list_gtk/parser.py +++ b/tryton/gui/window/view_form/view/list_gtk/parser.py @@ -677,9 +677,13 @@ class Selection(Char): selection_data = gtk.ListStore(str, str) selection = self.attrs.get('selection', [])[:] self.selection = selection[:] + if not self.attrs.get('domain'): + domain = [] + else: + domain = PYSONDecoder(rpc.CONTEXT).decode(self.attrs['domain']) if 'relation' in self.attrs: args = ('model', self.attrs['relation'], 'search_read', - self.attrs.get('domain', []), 0, None, None, rpc.CONTEXT, + domain, 0, None, None, rpc.CONTEXT, ['rec_name']) try: result = rpc.execute(*args) @@ -699,7 +703,7 @@ class Selection(Char): selection = [] self.selection = selection[:] - for dom in common.filter_domain(self.attrs.get('domain', [])): + for dom in common.filter_domain(domain): if dom[1] in ('=', '!='): todel = [] for i in xrange(len(selection)): diff --git a/tryton/gui/window/view_form/widget_search/selection.py b/tryton/gui/window/view_form/widget_search/selection.py index 4a223e56ab..3737065e8d 100644 --- a/tryton/gui/window/view_form/widget_search/selection.py +++ b/tryton/gui/window/view_form/widget_search/selection.py @@ -6,6 +6,7 @@ import tryton.rpc as rpc import tryton.common as common import gobject import gettext +from tryton.pyson import PYSONDecoder _ = gettext.gettext @@ -37,11 +38,14 @@ class Selection(Interface): self._selection = {} selection = self.attrs.get('selection', []) if 'relation' in self.attrs: + if not self.attrs.get('domain'): + domain = [] + else: + domain = PYSONDecoder(rpc.CONTEXT).decode(self.attrs['domain']) try: - result = rpc.execute('model', - self.attrs['relation'], 'search_read', - self.attrs.get('domain', []), - 0, None, None, rpc.CONTEXT, ['rec_name']) + result = rpc.execute('model', self.attrs['relation'], + 'search_read', domain 0, None, None, + rpc.CONTEXT, ['rec_name']) selection = [(x['id'], x['rec_name']) for x in result] except Exception, exception: common.process_exception(exception, parent) From 97bc54adcd95e5352cc94b032577e5a87faa3d48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Mon, 7 Feb 2011 18:14:58 +0100 Subject: [PATCH 39/97] Fix set_client for ReferenceField to support basestring values (transplanted from 5bbbe0bfad08bce235bc96f871b5341a956bbf26) --- tryton/gui/window/view_form/model/field.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tryton/gui/window/view_form/model/field.py b/tryton/gui/window/view_form/model/field.py index 2e5b460e12..3414088e18 100644 --- a/tryton/gui/window/view_form/model/field.py +++ b/tryton/gui/window/view_form/model/field.py @@ -613,6 +613,9 @@ class ReferenceField(CharField): if not value: record.value[self.name] = False return + if isinstance(value, basestring): + model, ref_id = value.split(',') + value = model, (ref_id, record.value.get(self.name + '.rec_name')) ref_model, (ref_id, ref_str) = value if ref_model: ref_id = int(ref_id) From ac04779c9c07cfeb1ad2f47b38a4e3160f396995 Mon Sep 17 00:00:00 2001 From: Korbinian Preisler Date: Sat, 26 Feb 2011 10:03:17 +0100 Subject: [PATCH 40/97] fix typo --- tryton/gui/window/view_form/widget_search/selection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/widget_search/selection.py b/tryton/gui/window/view_form/widget_search/selection.py index 3737065e8d..a922e965df 100644 --- a/tryton/gui/window/view_form/widget_search/selection.py +++ b/tryton/gui/window/view_form/widget_search/selection.py @@ -44,7 +44,7 @@ class Selection(Interface): domain = PYSONDecoder(rpc.CONTEXT).decode(self.attrs['domain']) try: result = rpc.execute('model', self.attrs['relation'], - 'search_read', domain 0, None, None, + 'search_read', domain, 0, None, None, rpc.CONTEXT, ['rec_name']) selection = [(x['id'], x['rec_name']) for x in result] except Exception, exception: From 2346960f03b76e55ebf0ac74cafc5f931209aa89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 2 Mar 2011 11:33:09 +0100 Subject: [PATCH 41/97] Add missing return value test of sig_logout in sig_login for issue1882 (transplanted from 8b76ac28c7fb5cca569d82beb45cd987f2f4e2c1) --- tryton/gui/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tryton/gui/main.py b/tryton/gui/main.py index 75c18a3532..8b6f52b95c 100644 --- a/tryton/gui/main.py +++ b/tryton/gui/main.py @@ -1102,7 +1102,8 @@ class Main(object): return ([], []) def sig_login(self, widget=None, dbname=False, res=None): - self.sig_logout(widget, disconnect=False) + if not self.sig_logout(widget, disconnect=False): + return if not res: try: dblogin = DBLogin(self.window) From 28cccb666e2a58c4628026485f3c905f3d3886b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 23 Mar 2011 14:56:54 +0100 Subject: [PATCH 42/97] gdk.pixbuf_new_from_file requires an unicode on windows (transplanted from 349b635edbec9f934cdc44842127c024ad054290) --- tryton/common/common.py | 3 ++- tryton/config.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tryton/common/common.py b/tryton/common/common.py index 398694d67f..1678e7b06f 100644 --- a/tryton/common/common.py +++ b/tryton/common/common.py @@ -241,7 +241,8 @@ def file_selection(title, filename='', parent=None, def update_preview_cb(win, img): filename = win.get_preview_filename() try: - pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(filename, 128, 128) + pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(filename.encode('utf-8'), + 128, 128) img.set_from_pixbuf(pixbuf) have_preview = True except: diff --git a/tryton/config.py b/tryton/config.py index c825927510..6fa0b7f29c 100644 --- a/tryton/config.py +++ b/tryton/config.py @@ -179,7 +179,7 @@ if not os.path.isdir(PIXMAPS_DIR): PIXMAPS_DIR = os.path.join(PREFIX, 'share', 'pixmaps', 'tryton') TRYTON_ICON = gtk.gdk.pixbuf_new_from_file( - os.path.join(PIXMAPS_DIR, 'tryton-icon.png')) + os.path.join(PIXMAPS_DIR, 'tryton-icon.png').encode('utf-8')) def _data_dir(): data_dir = os.path.join(CURRENT_DIR, 'share', 'tryton') From 9260318b0654fbeadc35dfa0f5e758d0d291174e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 27 Mar 2011 23:24:58 +0200 Subject: [PATCH 43/97] Add missing copyright owner (transplanted from cc5d9200889cfc3a5658743f193ca04f57f5a229) --- COPYRIGHT | 1 + 1 file changed, 1 insertion(+) diff --git a/COPYRIGHT b/COPYRIGHT index f98ae5c521..a5466e753e 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -3,6 +3,7 @@ Copyright (C) 2007-2011 Bertrand Chenal. Copyright (C) 2008-2011 B2CK SPRL. Copyright (C) 2008-2011 Udo Spallek. Copyright (C) 2008-2011 virtual things - Preisler & Spallek GbR. +Copyright (C) 2007-2009 Lorenzo Gil Sanchez. Copyright (C) 2004-2008 Tiny SPRL. This program is free software: you can redistribute it and/or modify From 9d3109f369c6240a3a75005e62ec49f47eb2d81b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 4 Apr 2011 15:21:48 +0200 Subject: [PATCH 44/97] Fix set_value on empty column for issue1925 (transplanted from 582fa55c13f17a3a7cb14e7415ccb29bf8e66b6a) --- tryton/gui/window/view_form/view/list_gtk/editabletree.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/view/list_gtk/editabletree.py b/tryton/gui/window/view_form/view/list_gtk/editabletree.py index b7f13cf3e7..c33ef26d6f 100644 --- a/tryton/gui/window/view_form/view/list_gtk/editabletree.py +++ b/tryton/gui/window/view_form/view/list_gtk/editabletree.py @@ -113,7 +113,7 @@ class EditableTreeView(gtk.TreeView): def set_value(self): path, column = self.get_cursor() model = self.get_model() - if not path or not column: + if not path or not column or not column.name: return True record = model.get_value(model.get_iter(path), 0) field = record[column.name] From 1a894ffa8e449e4678b8c25c3dbb8fbe60955b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 16 Apr 2011 19:38:29 +0200 Subject: [PATCH 45/97] Fix sig_plugin_execute when there is no tabs for issue1956 (transplanted from 5373514b47f645ff6941d66f181d3bcda0e75128) --- tryton/gui/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tryton/gui/main.py b/tryton/gui/main.py index 8b6f52b95c..3d682eef5e 100644 --- a/tryton/gui/main.py +++ b/tryton/gui/main.py @@ -1264,6 +1264,8 @@ class Main(object): def sig_plugin_execute(self, widget): page = self.notebook.get_current_page() + if page == -1: + return datas = { 'model': self.pages[page].model, 'ids': self.pages[page].ids_get(), From 44b0bd218daf5681f8c6e29e4918ec5169142516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 20 Apr 2011 10:58:42 +0200 Subject: [PATCH 46/97] Ensure record is selected for button action in list view for issue1974 (transplanted from d92b0dcc34e9d8d5664ed9bd974bfd9a3b5c6bf1) --- tryton/gui/window/view_form/view/list.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/view/list.py b/tryton/gui/window/view_form/view/list.py index fb3ba86bef..bf1bc32d13 100644 --- a/tryton/gui/window/view_form/view/list.py +++ b/tryton/gui/window/view_form/view/list.py @@ -265,7 +265,7 @@ class ViewList(ParserView): act = action.copy() obj_ids = self.screen.sel_ids_get() obj_id = self.screen.id_get() - if not obj_ids and not obj_id: + if not obj_ids or not obj_id: message(_('No record selected!'), self.window) return False email = {} From dc2cdad68f5ab2d2b084866ed5001f070507c6b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 21 Apr 2011 17:51:51 +0200 Subject: [PATCH 47/97] Fix tuple typo for states (transplanted from ef4998b6dca5d23a95cc6f7465bc4c37052c983b) --- tryton/gui/window/view_form/view/list_gtk/parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/view/list_gtk/parser.py b/tryton/gui/window/view_form/view/list_gtk/parser.py index 481bd6a6aa..aba0568f7d 100644 --- a/tryton/gui/window/view_form/view/list_gtk/parser.py +++ b/tryton/gui/window/view_form/view/list_gtk/parser.py @@ -267,7 +267,7 @@ class Char(object): else: align = 0 - states = ('invisible') + states = ('invisible',) if hasattr(self.treeview, 'editable') \ and self.treeview.editable: states = ('readonly', 'required', 'invisible') From 022f907f1b69f89e722fb23a98c2421f9cf4df10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 16 May 2011 12:58:06 +0200 Subject: [PATCH 48/97] Fix activate event of many2one when search is required for issue1993 (transplanted from cc6afc5c180f04f7ccceaafde3f43c59700a794d) --- tryton/gui/window/view_form/view/form_gtk/many2one.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/many2one.py b/tryton/gui/window/view_form/view/form_gtk/many2one.py index ffae49f613..d4e6cceeb9 100644 --- a/tryton/gui/window/view_form/view/form_gtk/many2one.py +++ b/tryton/gui/window/view_form/view/form_gtk/many2one.py @@ -36,7 +36,7 @@ class Many2One(WidgetInterface): self.wid_text.connect('populate-popup', self._populate_popup) self.wid_text.connect_after('changed', self.sig_changed) self.changed = True - self.wid_text.connect_after('activate', self.sig_activate) + self.wid_text.connect('activate', self.sig_activate) self.wid_text.connect_after('focus-out-event', self.sig_activate) self.focus_out = True @@ -127,6 +127,8 @@ class Many2One(WidgetInterface): self.focus_out = False if not value: + if not key_press and not event: + widget.emit_stop_by_name('activate') if not self._readonly and (self.wid_text.get_text() or \ (self.field.get_state_attrs( self.record)['required']) and key_press): From 30a74ae72ec1e5de6affe06a5a9d53a74e32e903 Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Sun, 29 May 2011 14:17:29 +0200 Subject: [PATCH 49/97] Prepare release 1.6.4 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 2baeda3317..9210548b21 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 1.6.4 - 2011-05-29 +* Bug fixes (see mercurial logs for details) + Version 1.6.3 - 2011-02-13 * Bug fixes (see mercurial logs for details) From 57f1557148cda7aa84f988f1a0300edad7275992 Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Sun, 29 May 2011 14:17:30 +0200 Subject: [PATCH 50/97] Added tag 1.6.4 for changeset 65a7920dc851 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 3f78c1da06..5c70792317 100644 --- a/.hgtags +++ b/.hgtags @@ -5,3 +5,4 @@ de84c1443d4bad908eabb99c381578b988c2117f 1.4.0 35ec9b3ff051217fdc17b4a4f5d443cf53302d4b 1.6.1 a0a5789e26833bfe4998cac477f90438a96c344a 1.6.2 c807c9f30a09a7afb8e8f6b1aca7ad79f66f580d 1.6.3 +65a7920dc851c5f5185c73e9a1c166f90e9f0b73 1.6.4 From e0c73e8bb8ab1721702815e2406f4605ae4e805d Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Sun, 29 May 2011 14:17:58 +0200 Subject: [PATCH 51/97] Increase version number --- tryton/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/version.py b/tryton/version.py index 78c24340e0..ce3b066787 100644 --- a/tryton/version.py +++ b/tryton/version.py @@ -1,7 +1,7 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. PACKAGE = "tryton" -VERSION = "1.6.4" +VERSION = "1.6.5" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From c874d9dc34158aaedd5afeb7ca2ab96ef11bb0a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 30 May 2011 17:33:23 +0200 Subject: [PATCH 52/97] Fix float_time_to_text with Python 2.7 for issue2032 (transplanted from ee26ae500b83f2001371d0e05b83f1049c09ed5d) --- tryton/common/common.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tryton/common/common.py b/tryton/common/common.py index 1678e7b06f..7d7598d0cb 100644 --- a/tryton/common/common.py +++ b/tryton/common/common.py @@ -1149,17 +1149,13 @@ def float_time_to_text(val, conv=None): val = val - hours mins = int((val% 1 + 0.01) / conv['m']) if years: - value += ' ' + locale.format('%d' + FLOAT_TIME_SEPS['Y'], - years, True) + value += ' ' + locale.format('%d', years, True) + FLOAT_TIME_SEPS['Y'] if months: - value += ' ' + locale.format('%d' + FLOAT_TIME_SEPS['M'], - months, True) + value += ' ' + locale.format('%d', months, True) + FLOAT_TIME_SEPS['M'] if weeks: - value += ' ' + locale.format('%d' + FLOAT_TIME_SEPS['w'], - weeks, True) + value += ' ' + locale.format('%d', weeks, True) + FLOAT_TIME_SEPS['w'] if days: - value += ' ' + locale.format('%d' + FLOAT_TIME_SEPS['d'], - days, True) + value += ' ' + locale.format('%d', days, True) + FLOAT_TIME_SEPS['d'] if hours or mins: value += ' %02d:%02d' % (hours, mins) value = value.strip() From c147ca3dc3e8909474743ccabfda6a7aba0f82ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 24 Jun 2011 16:07:08 +0200 Subject: [PATCH 53/97] Add missing import of WinSearch in WinForm (transplanted from 4cbbde98a309d4ad31acb77b007254565b6adc07) --- tryton/gui/window/win_form.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tryton/gui/window/win_form.py b/tryton/gui/window/win_form.py index 89534cb9e6..554597c55d 100644 --- a/tryton/gui/window/win_form.py +++ b/tryton/gui/window/win_form.py @@ -235,6 +235,7 @@ class WinForm(object): self.wid_text.grab_focus() def _sig_add(self, *args): + from tryton.gui.window.win_search import WinSearch domain = [] context = rpc.CONTEXT.copy() From c429e82e899df4e860fbe2d46126c80714b7470d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 28 Jun 2011 23:34:32 +0200 Subject: [PATCH 54/97] Ensure that parent_name is always a string (transplanted from f399f9288753fc0916ecb4f85d41d6a3b01ba422) --- tryton/gui/window/view_form/model/group.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/model/group.py b/tryton/gui/window/view_form/model/group.py index 5ec770b5e2..4930fb8714 100644 --- a/tryton/gui/window/view_form/model/group.py +++ b/tryton/gui/window/view_form/model/group.py @@ -16,7 +16,7 @@ class Group(SignalEvent, list): self.lock_signal = False self.__window = window self.parent = parent - self.parent_name = parent_name + self.parent_name = parent_name or '' self.parent_datetime_field = parent_datetime_field self._context = context or {} self.model_name = model_name From 6fac457db378add99a943c03688ca9de891c3205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 30 Jun 2011 13:17:29 +0200 Subject: [PATCH 55/97] Remove old parent parameter in progressbar (transplanted from 206f28cc49a147db59a32e91e338e44f82906ad4) --- tryton/gui/window/view_form/view/form_gtk/progressbar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/progressbar.py b/tryton/gui/window/view_form/view/form_gtk/progressbar.py index 1734f5f659..79e2b00f03 100644 --- a/tryton/gui/window/view_form/view/form_gtk/progressbar.py +++ b/tryton/gui/window/view_form/view/form_gtk/progressbar.py @@ -16,7 +16,7 @@ class ProgressBar(WidgetInterface): def __init__(self, field_name, model_name, window, attrs=None): super(ProgressBar, self).__init__(field_name, model_name, window, - parent, attrs=attrs) + attrs=attrs) self.widget = gtk.ProgressBar() orientation = self.orientations.get(attrs.get('orientation', 'left_to_right'), gtk.PROGRESS_LEFT_TO_RIGHT) From 08ed2080740792b7528266b6e091a0d3daa266b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 15 Jul 2011 18:15:12 +0200 Subject: [PATCH 56/97] Close every PixbufLoader (transplanted from 23939a938789dcc9914e898298647bae0531bb2a) --- tryton/gui/window/view_form/view/form_gtk/image.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/image.py b/tryton/gui/window/view_form/view/form_gtk/image.py index 2abc75f4fe..6b5f3d46f4 100644 --- a/tryton/gui/window/view_form/view/form_gtk/image.py +++ b/tryton/gui/window/view_form/view/form_gtk/image.py @@ -161,14 +161,14 @@ class Image(WidgetInterface): except: continue pixbuf = loader.get_pixbuf() + loader.close() if pixbuf: break if not pixbuf: loader = gtk.gdk.PixbufLoader('png') loader.write(NOIMAGE, len(NOIMAGE)) pixbuf = loader.get_pixbuf() - - loader.close() + loader.close() img_height = pixbuf.get_height() if img_height > self.height: From f9201f12a2ee29dbf89375f5b55c90cbd508511f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 15 Jul 2011 18:16:55 +0200 Subject: [PATCH 57/97] Remove spreading active_id(s) in board action review49009 (transplanted from ca470354201defe937abd164b5fc962a29371301) --- tryton/gui/window/view_board/action.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_board/action.py b/tryton/gui/window/view_board/action.py index 27a9be3028..ceddcfcefe 100644 --- a/tryton/gui/window/view_board/action.py +++ b/tryton/gui/window/view_board/action.py @@ -43,7 +43,7 @@ class Action(object): self.action['view_mode'] = attrs['view_mode'] self.action.setdefault('pyson_domain', '[]') - self.context = {'active_id': False, 'active_ids': []} + self.context = {} self.context.update(PYSONDecoder(self.context).decode( self.action.get('pyson_context', '{}'))) From a94d1bdb92d2771da76ee6cd751856c2edf4bd5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 20 Jul 2011 21:54:36 +0200 Subject: [PATCH 58/97] Test if any column has width before saving it otherwise list is hidden and there is no width review48004 (transplanted from 223e96d3b08f76519fe935089d346242e9e9e522) --- tryton/gui/window/view_form/view/list.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/view/list.py b/tryton/gui/window/view_form/view/list.py index bf1bc32d13..e144d0bc3f 100644 --- a/tryton/gui/window/view_form/view/list.py +++ b/tryton/gui/window/view_form/view/list.py @@ -510,7 +510,7 @@ class ViewList(ParserView): if last_col and last_col.name in fields: del fields[last_col.name] - if fields: + if fields and any(fields.itervalues()): try: rpc.execute('model', 'ir.ui.view_tree_width', 'set_width', self.screen.model_name, fields, rpc.CONTEXT) From 1996e0020fba4094466529ac8584f930df69000a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 22 Jul 2011 15:42:56 +0200 Subject: [PATCH 59/97] Fix typo filepath -> filename when saving graph (transplanted from 3fd018519880c72ecbab5747587c11939adfbca6) --- tryton/gui/window/view_form/view/graph_gtk/parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/view/graph_gtk/parser.py b/tryton/gui/window/view_form/view/graph_gtk/parser.py index 6af17904bf..2a62fd25eb 100644 --- a/tryton/gui/window/view_form/view/graph_gtk/parser.py +++ b/tryton/gui/window/view_form/view/graph_gtk/parser.py @@ -77,7 +77,7 @@ def save(widget, graph, window): filename = filename.decode('utf-8') try: CONFIG['client.default_path'] = \ - os.path.dirname(filepath) + os.path.dirname(filename) CONFIG.save() except: pass From 47e8e51027e72244d2b88c4fd743a9b68f5e7b0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 22 Jul 2011 15:54:49 +0200 Subject: [PATCH 60/97] Use str for cairo.Surface.write_to_png Old version doesn't support unicode (transplanted from 45368348fad448334fe324e5fb0ec729c63d0ebe) --- tryton/gui/window/view_form/view/graph_gtk/graph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/view/graph_gtk/graph.py b/tryton/gui/window/view_form/view/graph_gtk/graph.py index ec1fbb4d60..0dcd6cf155 100644 --- a/tryton/gui/window/view_form/view/graph_gtk/graph.py +++ b/tryton/gui/window/view_form/view/graph_gtk/graph.py @@ -122,7 +122,7 @@ class Graph(gtk.DrawingArea): self.drawGraph(cx, width, height) self.drawAxis(cx, width, height) self.drawLegend(cx, width, height) - surface.write_to_png(filename) + surface.write_to_png(filename.encode('utf-8')) self.queue_draw() From 166d4015a3d456863a3ccf12e10d0ce3186e9283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 4 Aug 2011 11:33:37 +0200 Subject: [PATCH 61/97] Fix load of predefined export without lines issue2124 (transplanted from 4b3a3808b0d11ad2de119bdefaec9e34e93bc2a8) --- tryton/gui/window/win_export.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/win_export.py b/tryton/gui/window/win_export.py index fee597f4e3..4d1afe18a8 100644 --- a/tryton/gui/window/win_export.py +++ b/tryton/gui/window/win_export.py @@ -304,7 +304,7 @@ class WinExport(object): for export in exports: self.predef_model.append(( export['id'], - [x['name'] for x in id2lines[export['id']]], + [x['name'] for x in id2lines.get(export['id'], [])], export['name'])) self.pref_export.set_model(self.predef_model) From b8088abf251fdea65ec361b997079050f6393cf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Mon, 22 Aug 2011 19:21:55 +0200 Subject: [PATCH 62/97] Ensure environment variable are str issue87001 (transplanted from 75fb228ad8ad7cd412d27af5ae511dae2b9b9518) --- tryton/translate.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tryton/translate.py b/tryton/translate.py index 31590f8f8b..044b1db597 100644 --- a/tryton/translate.py +++ b/tryton/translate.py @@ -172,11 +172,13 @@ def setlang(lang=None, locale_dict=None): elif os.name == 'mac' or \ (hasattr(os, 'uname') and os.uname()[0] == 'Darwin'): encoding = 'UTF-8' + # ensure environment variable are str + lang, lang2, encoding = str(lang), str(lang2), str(encoding) os.environ['LANGUAGE'] = lang os.environ['LC_ALL'] = lang2 + '.' + encoding os.environ['LC_MESSAGES'] = lang2 + '.' + encoding os.environ['LANG'] = lang + '.' + encoding - locale.setlocale(locale.LC_ALL, str(lang2 + '.' + encoding)) + locale.setlocale(locale.LC_ALL, lang2 + '.' + encoding) except: logging.getLogger('translate').info( _('Unable to set locale %s') % lang2 + '.' + encoding) From 867356bccc9a96977ad42b239b3f653e2bdbfd94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 12 Sep 2011 12:39:52 +0200 Subject: [PATCH 63/97] Catch all GError exception when using PixbufLoader issue2144 (transplanted from 216ea2f5406ab8fc60d596c7fddfd7db90ad0964) --- tryton/gui/window/view_form/view/form_gtk/image.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/image.py b/tryton/gui/window/view_form/view/form_gtk/image.py index 6b5f3d46f4..8277de2691 100644 --- a/tryton/gui/window/view_form/view/form_gtk/image.py +++ b/tryton/gui/window/view_form/view/form_gtk/image.py @@ -158,10 +158,10 @@ class Image(WidgetInterface): try: loader = gtk.gdk.PixbufLoader(ftype) loader.write(data, len(data)) + pixbuf = loader.get_pixbuf() + loader.close() except: continue - pixbuf = loader.get_pixbuf() - loader.close() if pixbuf: break if not pixbuf: From 8f056fa6179a9d6bcdfee79d43cfe6296bb2e6f9 Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Sat, 1 Oct 2011 14:15:19 +0200 Subject: [PATCH 64/97] Prepare release 1.6.5 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 9210548b21..39215e1e97 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 1.6.5 - 2011-10-01 +* Bug fixes (see mercurial logs for details) + Version 1.6.4 - 2011-05-29 * Bug fixes (see mercurial logs for details) From cc64a319565c0c8280c77ebc28f86683e4ec9c07 Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Sat, 1 Oct 2011 14:15:20 +0200 Subject: [PATCH 65/97] Added tag 1.6.5 for changeset a5fa88c62699 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 5c70792317..1a02a383cf 100644 --- a/.hgtags +++ b/.hgtags @@ -6,3 +6,4 @@ de84c1443d4bad908eabb99c381578b988c2117f 1.4.0 a0a5789e26833bfe4998cac477f90438a96c344a 1.6.2 c807c9f30a09a7afb8e8f6b1aca7ad79f66f580d 1.6.3 65a7920dc851c5f5185c73e9a1c166f90e9f0b73 1.6.4 +a5fa88c626993fc0c1bb89e0562920d09bf79ed2 1.6.5 From f6d3940b80923e38329d748819ffb7dc73fbf77f Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Sat, 1 Oct 2011 14:15:50 +0200 Subject: [PATCH 66/97] Increase version number --- tryton/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/version.py b/tryton/version.py index ce3b066787..0ec1fe733a 100644 --- a/tryton/version.py +++ b/tryton/version.py @@ -1,7 +1,7 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. PACKAGE = "tryton" -VERSION = "1.6.5" +VERSION = "1.6.6" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From 5d33138b610c1058ddc4b4f641499be9199601f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 19 Oct 2011 13:14:06 +0200 Subject: [PATCH 67/97] Set default view_ids to None instead of False issue2213 review158002 (transplanted from c5efff6a74778ebe78169375c7eec290c844404e) --- tryton/gui/window/view_board/action.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_board/action.py b/tryton/gui/window/view_board/action.py index ceddcfcefe..427a364dc0 100644 --- a/tryton/gui/window/view_board/action.py +++ b/tryton/gui/window/view_board/action.py @@ -31,7 +31,7 @@ class Action(object): common.process_exception(exception, self._window) raise - view_ids = False + view_ids = None self.action['view_mode'] = None if self.action.get('views', []): view_ids = [x[0] for x in self.action['views']] From 91914cf413eff900cbc0b943b24c19d6aa763f60 Mon Sep 17 00:00:00 2001 From: Max Holtzberg Date: Wed, 19 Oct 2011 13:06:49 +0200 Subject: [PATCH 68/97] Fix handling of dates < 1900 issue2040 review113002 (transplanted from 38a62d96a6ef13b53e285db64c2ff0fcad198a10) --- tryton/common/date_widget.py | 9 +------ tryton/common/datetime_strftime.py | 2 +- .../view_form/view/form_gtk/calendar.py | 27 +++---------------- 3 files changed, 5 insertions(+), 33 deletions(-) diff --git a/tryton/common/date_widget.py b/tryton/common/date_widget.py index 4ad676a2dc..3f569350f4 100644 --- a/tryton/common/date_widget.py +++ b/tryton/common/date_widget.py @@ -132,14 +132,7 @@ class DateEntry(gtk.Entry): def date_set(self, dt): if dt: - format = self.format - if dt.year < 10: - format = format.replace('%Y', '000%Y') - elif dt.year < 100: - format = format.replace('%Y', '00%Y') - elif dt.year < 1000: - format = format.replace('%Y', '0%Y') - self.set_text(datetime_strftime(dt, format)) + self.set_text(datetime_strftime(dt, self.format)) else: if self.is_focus(): self.set_text(self.initial_value) diff --git a/tryton/common/datetime_strftime.py b/tryton/common/datetime_strftime.py index 65f6fa50f4..d125d8d204 100644 --- a/tryton/common/datetime_strftime.py +++ b/tryton/common/datetime_strftime.py @@ -44,7 +44,7 @@ def datetime_strftime(dt, fmt): sites.append(site) s = s1 - syear = "%4d" % (dt.year,) + syear = "%04d" % (dt.year,) for site in sites: s = s[:site] + syear + s[site+4:] return s diff --git a/tryton/gui/window/view_form/view/form_gtk/calendar.py b/tryton/gui/window/view_form/view/form_gtk/calendar.py index 4328de9b01..b77ae67e39 100644 --- a/tryton/gui/window/view_form/view/form_gtk/calendar.py +++ b/tryton/gui/window/view_form/view/form_gtk/calendar.py @@ -93,14 +93,7 @@ class Calendar(WidgetInterface): if len(value)>10: value = value[:10] date = datetime.date(*time.strptime(value, DT_FORMAT)[:3]) - format = self.format - if date.year < 10: - format = format.replace('%Y', '000%Y') - elif date.year < 100: - format = format.replace('%Y', '00%Y') - elif date.year < 1000: - format = format.replace('%Y', '0%Y') - value = datetime_strftime(date, format) + value = datetime_strftime(date, self.format) if len(value) > self.entry.get_width_chars(): self.entry.set_width_chars(len(value)) self.entry.set_text(value) @@ -139,14 +132,7 @@ class Calendar(WidgetInterface): if response == gtk.RESPONSE_OK: year, month, day = cal.get_date() date = datetime.date(year, month + 1, day) - format = self.format - if date.year < 10: - format = format.replace('%Y', '000%Y') - elif date.year < 100: - format = format.replace('%Y', '00%Y') - elif date.year < 1000: - format = format.replace('%Y', '0%Y') - self.entry.set_text(datetime_strftime(date, format)) + self.entry.set_text(datetime_strftime(date, self.format)) self._focus_out() self.window.present() win.destroy() @@ -248,14 +234,7 @@ class DateTime(WidgetInterface): date = ldt except: pass - format = self.format - if date.year < 10: - format = format.replace('%Y', '000%Y') - elif date.year < 100: - format = format.replace('%Y', '00%Y') - elif date.year < 1000: - format = format.replace('%Y', '0%Y') - value = datetime_strftime(date, format) + value = datetime_strftime(date, self.format) if len(value) > self.entry.get_width_chars(): self.entry.set_width_chars(len(value)) self.entry.set_text(value) From ff291148a2448c190fbe991b15c4a0d7fcc23a32 Mon Sep 17 00:00:00 2001 From: Udo Spallek Date: Wed, 2 Nov 2011 11:12:56 +0100 Subject: [PATCH 69/97] Do not use PYSONDecoder() to eval states of button in list view issue2244 (transplanted from a5609b61695b8a7bdb6f7b21a96054b04a5d047a) --- tryton/gui/window/view_form/view/list_gtk/parser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tryton/gui/window/view_form/view/list_gtk/parser.py b/tryton/gui/window/view_form/view/list_gtk/parser.py index aba0568f7d..d97c1fce47 100644 --- a/tryton/gui/window/view_form/view/list_gtk/parser.py +++ b/tryton/gui/window/view_form/view/list_gtk/parser.py @@ -843,8 +843,8 @@ class Button(object): store = self.treeview.get_model() record = store.get_value(store.get_iter(path), 0) - state_changes = PYSONDecoder().decode(record.expr_eval( - self.attrs.get('states', {}), check_load=False)) + state_changes = record.expr_eval( + self.attrs.get('states', {}), check_load=False) if state_changes.get('invisible') \ or state_changes.get('readonly'): return True From f3152f8c6e7502533cbf33624076106c6da2613f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 14 Nov 2011 18:01:15 +0100 Subject: [PATCH 70/97] Add allowed ops in safe_eval for Python 2.7 (transplanted from 886cd06d78838bfca94095d8d6fc3e5809dd2f1f) --- tryton/common/common.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tryton/common/common.py b/tryton/common/common.py index 7d7598d0cb..420ec35dd7 100644 --- a/tryton/common/common.py +++ b/tryton/common/common.py @@ -1190,6 +1190,7 @@ _ALLOWED_CODES = set(dis.opmap[x] for x in [ 'STORE_MAP', 'LOAD_NAME', 'CALL_FUNCTION', 'COMPARE_OP', 'LOAD_ATTR', 'STORE_NAME', 'GET_ITER', 'FOR_ITER', 'LIST_APPEND', 'JUMP_ABSOLUTE', 'DELETE_NAME', 'JUMP_IF_TRUE', 'JUMP_IF_FALSE', 'JUMP_IF_FALSE_OR_POP', + 'JUMP_IF_TRUE_OR_POP', 'POP_JUMP_IF_FALSE', 'POP_JUMP_IF_TRUE', 'BINARY_SUBSCR', ] if x in dis.opmap) From f41e9c7b0775b2362b5c61c88d1a278094ccc5db Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Mon, 26 Dec 2011 10:35:18 +0100 Subject: [PATCH 71/97] Prepare release 1.6.6 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 39215e1e97..c30f900cea 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 1.6.6 - 2011-12-26 +* Bug fixes (see mercurial logs for details) + Version 1.6.5 - 2011-10-01 * Bug fixes (see mercurial logs for details) From ebabb4e1f65adcf20b13a0e5cd15200d7a3af3d0 Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Mon, 26 Dec 2011 10:35:18 +0100 Subject: [PATCH 72/97] Added tag 1.6.6 for changeset 222c956df77f --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 1a02a383cf..9b817557bb 100644 --- a/.hgtags +++ b/.hgtags @@ -7,3 +7,4 @@ a0a5789e26833bfe4998cac477f90438a96c344a 1.6.2 c807c9f30a09a7afb8e8f6b1aca7ad79f66f580d 1.6.3 65a7920dc851c5f5185c73e9a1c166f90e9f0b73 1.6.4 a5fa88c626993fc0c1bb89e0562920d09bf79ed2 1.6.5 +222c956df77f22ca0cbbb8f772dd9d8040a63312 1.6.6 From ff3a2072f5bcc974ef67ea34a96d54b977c7422b Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Mon, 26 Dec 2011 10:35:48 +0100 Subject: [PATCH 73/97] Increase version number --- tryton/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/version.py b/tryton/version.py index 0ec1fe733a..91a43df495 100644 --- a/tryton/version.py +++ b/tryton/version.py @@ -1,7 +1,7 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. PACKAGE = "tryton" -VERSION = "1.6.6" +VERSION = "1.6.7" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From 05fb879117c6bc36c6619590df5da4d7118c33f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 2 Jan 2012 18:50:01 +0100 Subject: [PATCH 74/97] Remove entry added to combobox in win_import review210009 (transplanted from 40d5157e9d58f50a00464d280de36a4a0af4a876) --- tryton/gui/window/win_import.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tryton/gui/window/win_import.py b/tryton/gui/window/win_import.py index 74c59b3882..8353b70958 100644 --- a/tryton/gui/window/win_import.py +++ b/tryton/gui/window/win_import.py @@ -143,9 +143,6 @@ class WinImport(object): self.import_csv_enc = gtk.combo_box_new_text() self.import_csv_enc.append_text("UTF-8") self.import_csv_enc.append_text("Latin1") - cboxent_import_csv_enc = gtk.Entry() - cboxent_import_csv_enc.unset_flags(gtk.CAN_FOCUS) - self.import_csv_enc.add(cboxent_import_csv_enc) table.attach(self.import_csv_enc, 1, 2, 1, 2) label_import_csv_skip = gtk.Label(_("Lines to Skip:")) From a3da9b600f4f1fc116bfcafb9d421e36fafb5eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 17 Jan 2012 13:56:50 +0100 Subject: [PATCH 75/97] Fix float_time widget to round value according to digits review222007 (transplanted from 2aa50bbdde4d89b314fd85b24ec4dcf7f4f0a56d) --- tryton/gui/window/view_form/view/form_gtk/float_time.py | 3 ++- tryton/gui/window/view_form/view/list_gtk/parser.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/float_time.py b/tryton/gui/window/view_form/view/form_gtk/float_time.py index 738b09eae6..ad78523752 100644 --- a/tryton/gui/window/view_form/view/form_gtk/float_time.py +++ b/tryton/gui/window/view_form/view/form_gtk/float_time.py @@ -37,8 +37,9 @@ class FloatTime(WidgetInterface): value = self.entry.get_text() if not value: return field.set_client(record, 0.0) + digits = record.expr_eval(field.attrs.get('digits', (16, 2))) return field.set_client(record, - common.text_to_float_time(value, self.conv)) + round(common.text_to_float_time(value, self.conv), digits[1])) def display(self, record, field): super(FloatTime, self).display(record, field) diff --git a/tryton/gui/window/view_form/view/list_gtk/parser.py b/tryton/gui/window/view_form/view/list_gtk/parser.py index d97c1fce47..59c6967d8e 100644 --- a/tryton/gui/window/view_form/view/list_gtk/parser.py +++ b/tryton/gui/window/view_form/view/list_gtk/parser.py @@ -474,7 +474,9 @@ class FloatTime(Char): return common.float_time_to_text(val, self.conv) def value_from_text(self, record, text): - return common.text_to_float_time(text, self.conv) + field = record[self.field_name] + digits = record.expr_eval(field.attrs.get('digits', (16, 2))) + return round(common.text_to_float_time(text, self.conv), digits[1]) class M2O(Char): From 4dfc0d54768554af8f646c06fa7322089a606964 Mon Sep 17 00:00:00 2001 From: Oscar Alvarez Date: Mon, 30 Jan 2012 22:06:29 -0500 Subject: [PATCH 76/97] Fix the export wizard for load all predef fields saved It modified using method iter_children issue2383 review219002 (transplanted from 232508536908ca64d4f8380896e884d6d1093acf) --- tryton/gui/window/win_export.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tryton/gui/window/win_export.py b/tryton/gui/window/win_export.py index 4d1afe18a8..271d1d6dc3 100644 --- a/tryton/gui/window/win_export.py +++ b/tryton/gui/window/win_export.py @@ -369,9 +369,12 @@ class WinExport(object): (prefix + parent): self.on_row_expanded(self.view1, iter, self.model1.get_path(iter)) + iter = self.model1.iter_children(iter) + prefix = parent + '/' break - iter = self.model1.iter_next(iter) - prefix = parent + '/' + else: + iter = self.model1.iter_next(iter) + if field not in self.fields_data: continue self.model2.append((self.fields_data[field]['string'], field)) From c02b832b76ceb4978e1e55b8e257ca4063332867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 21 Feb 2012 16:19:03 +0100 Subject: [PATCH 77/97] Remove trailing space (transplanted from af3e207f00156b9388eb124ce13cb3380e81b670) --- tryton/gui/window/win_export.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/win_export.py b/tryton/gui/window/win_export.py index 271d1d6dc3..e1ea9aa4ef 100644 --- a/tryton/gui/window/win_export.py +++ b/tryton/gui/window/win_export.py @@ -374,7 +374,7 @@ class WinExport(object): break else: iter = self.model1.iter_next(iter) - + if field not in self.fields_data: continue self.model2.append((self.fields_data[field]['string'], field)) From cf4d09de9946eb03e25ea380e390a8308ca05e8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 1 Mar 2012 10:18:31 +0100 Subject: [PATCH 78/97] Return empty list when calling O2M.get if empty Test on required state except to have a value evaluated to False in case of empty O2M. issue2382 review258002 (transplanted from 9364d03b9467364498b3f0e97b0fd2e0e85dfa10) --- tryton/gui/window/view_form/model/field.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tryton/gui/window/view_form/model/field.py b/tryton/gui/window/view_form/model/field.py index 3414088e18..f482aef0f1 100644 --- a/tryton/gui/window/view_form/model/field.py +++ b/tryton/gui/window/view_form/model/field.py @@ -376,6 +376,8 @@ class O2MField(CharField): else: result.append(('create', record2.get(check_load=check_load, get_readonly=readonly))) + if not result[0][1]: + del result[0] if record.value[self.name].record_removed: result.append(('unlink', [x.id for x in \ record.value[self.name].record_removed])) From ffe2483b52a9363685aa2777aded3b318a4cf23f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 5 Mar 2012 10:15:53 +0100 Subject: [PATCH 79/97] Use relativedelta to make all the datetime computation issue2469 (transplanted from 9516267d90bd89a0c49c225d639380cbc991e928) --- tryton/pyson.py | 59 ++++++++++++++++++++++--------------------------- 1 file changed, 26 insertions(+), 33 deletions(-) diff --git a/tryton/pyson.py b/tryton/pyson.py index b3d375bb30..eaead71f2c 100644 --- a/tryton/pyson.py +++ b/tryton/pyson.py @@ -6,6 +6,7 @@ if sys.version_info < (2, 6): else: import json import datetime +from dateutil.relativedelta import relativedelta class PYSON(object): @@ -394,23 +395,14 @@ class Date(PYSON): @staticmethod def eval(dct, context): - date = datetime.date.today() - replace = {} - for i, j in (('y', 'year'), ('M', 'month'), ('d', 'day')): - if dct[i] is not None: - replace[j] = dct[i] - date = date.replace(**replace) - if dct['dy']: - year = date.year + dct['dy'] - date = date.replace(year=year) - if dct['dM']: - month = date.month + dct['dM'] - year = date.year + month / 12 - month = month % 12 - date = date.replace(year=year, month=month) - if dct['dd']: - date += datetime.timedelta(days=dct['dd']) - return date + return datetime.date.today() + relativedelta( + year=dct['y'], + month=dct['M'], + day=dct['d'], + years=dct['dy'], + months=dct['dM'], + days=dct['dd'], + ) class DateTime(Date): @@ -458,22 +450,23 @@ class DateTime(Date): @staticmethod def eval(dct, context): - date = Date.eval(dct, context) - datetime_ = datetime.datetime.combine(date, - datetime.datetime.now().time()) - replace = {} - for i, j in (('h', 'hour'), ('m', 'minute'), ('s', 'second'), - ('ms', 'microsecond')): - if dct[i] is not None: - replace[j] = dct[i] - datetime_ = datetime_.replace(**replace) - delta = {} - for i, j in (('dh', 'hours'), ('dm', 'minutes'), ('ds', 'seconds'), - ('dms', 'microseconds')): - if dct[i]: - delta[j] = dct[i] - datetime_ += datetime.timedelta(**delta) - return datetime_ + return datetime.datetime.now() + relativedelta( + year=dct['y'], + month=dct['M'], + day=dct['d'], + hour=dct['h'], + minute=dct['m'], + second=dct['s'], + microsecond=dct['ms'], + years=dct['dy'], + months=dct['dM'], + days=dct['dd'], + hours=dct['dh'], + minutes=dct['dm'], + seconds=dct['ds'], + microseconds=dct['dms'], + ) + CONTEXT = { 'Eval': Eval, From d385af4c1d1c68529a223a5543ad4485bb56372a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 7 Mar 2012 16:17:19 +0100 Subject: [PATCH 80/97] Use field.context_get instead of evaluating the context attribute (transplanted from 676c65f18b1142f3d97df308a0b1253a44775973) --- tryton/gui/window/view_form/view/form_gtk/one2many.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/one2many.py b/tryton/gui/window/view_form/view/form_gtk/one2many.py index d41cbef0af..4897fecfb8 100644 --- a/tryton/gui/window/view_form/view/form_gtk/one2many.py +++ b/tryton/gui/window/view_form/view/form_gtk/one2many.py @@ -219,7 +219,7 @@ class One2Many(WidgetInterface): self.screen.display() return ctx = {} - ctx.update(self.record.expr_eval(self.attrs.get('context', {}))) + ctx.update(self.field.context_get(self.record)) sequence = None if self.screen.current_view.view_type == 'tree': sequence = self.screen.current_view.widget_tree.sequence From a09fce544cb594124beb5890d9c3367f71a3840b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 13 Apr 2012 14:24:08 +0200 Subject: [PATCH 81/97] PixbufLoader must be closed before getting pixbuf On windows, jpeg loader needs to be closed to return correct pixbuf. issue2482 (transplanted from 726bb7cfc5e424cdc919ce9cdc37b4fa5f553cf0) --- tryton/gui/window/view_form/view/form_gtk/image.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/image.py b/tryton/gui/window/view_form/view/form_gtk/image.py index 8277de2691..aaeac3e24a 100644 --- a/tryton/gui/window/view_form/view/form_gtk/image.py +++ b/tryton/gui/window/view_form/view/form_gtk/image.py @@ -158,8 +158,8 @@ class Image(WidgetInterface): try: loader = gtk.gdk.PixbufLoader(ftype) loader.write(data, len(data)) - pixbuf = loader.get_pixbuf() loader.close() + pixbuf = loader.get_pixbuf() except: continue if pixbuf: @@ -167,8 +167,8 @@ class Image(WidgetInterface): if not pixbuf: loader = gtk.gdk.PixbufLoader('png') loader.write(NOIMAGE, len(NOIMAGE)) - pixbuf = loader.get_pixbuf() loader.close() + pixbuf = loader.get_pixbuf() img_height = pixbuf.get_height() if img_height > self.height: From e2401788a5f166edf0fa4f2aaf932bea2ebb757c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 18 Apr 2012 20:00:06 +0200 Subject: [PATCH 82/97] Reset current_record before clearing group (transplanted from 6c8591e020f818a25b62925a3e4eccd4e49a057f) --- tryton/gui/window/view_form/screen/screen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/screen/screen.py b/tryton/gui/window/view_form/screen/screen.py index 1feea02259..d04d511c1d 100644 --- a/tryton/gui/window/view_form/screen/screen.py +++ b/tryton/gui/window/view_form/screen/screen.py @@ -675,8 +675,8 @@ class Screen(SignalEvent): return [x.id for x in self.group if x.id] def clear(self): - self.group.clear() self.current_record = None + self.group.clear() def on_change(self, fieldname, attr): self.current_record.on_change(fieldname, attr) From 8b1d8bfca387dccdc7d62b4ec38eccc9aeb3b368 Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Mon, 7 May 2012 11:04:37 +0200 Subject: [PATCH 83/97] Prepare release 1.6.7 --- CHANGELOG | 3 +++ COPYRIGHT | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c30f900cea..ec4384a2fa 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 1.6.7 - 2012-05-07 +* Bug fixes (see mercurial logs for details) + Version 1.6.6 - 2011-12-26 * Bug fixes (see mercurial logs for details) diff --git a/COPYRIGHT b/COPYRIGHT index a5466e753e..42e7347f4f 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,6 +1,6 @@ -Copyright (C) 2007-2011 Cédric Krier. +Copyright (C) 2007-2012 Cédric Krier. Copyright (C) 2007-2011 Bertrand Chenal. -Copyright (C) 2008-2011 B2CK SPRL. +Copyright (C) 2008-2012 B2CK SPRL. Copyright (C) 2008-2011 Udo Spallek. Copyright (C) 2008-2011 virtual things - Preisler & Spallek GbR. Copyright (C) 2007-2009 Lorenzo Gil Sanchez. From e6fd07d99f98e6edf969a24015da0556169e0910 Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Mon, 7 May 2012 11:04:38 +0200 Subject: [PATCH 84/97] Added tag 1.6.7 for changeset f67966bbcf63 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 9b817557bb..fd30e8708c 100644 --- a/.hgtags +++ b/.hgtags @@ -8,3 +8,4 @@ c807c9f30a09a7afb8e8f6b1aca7ad79f66f580d 1.6.3 65a7920dc851c5f5185c73e9a1c166f90e9f0b73 1.6.4 a5fa88c626993fc0c1bb89e0562920d09bf79ed2 1.6.5 222c956df77f22ca0cbbb8f772dd9d8040a63312 1.6.6 +f67966bbcf632c3a1a9898a0cbcd033448ef75f5 1.6.7 From 08a2a7024c47fd51985ab220a63f3f72ab0ea446 Mon Sep 17 00:00:00 2001 From: Mathias Behrle Date: Mon, 7 May 2012 11:05:08 +0200 Subject: [PATCH 85/97] Increase version number --- tryton/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/version.py b/tryton/version.py index 91a43df495..be6eec7ef2 100644 --- a/tryton/version.py +++ b/tryton/version.py @@ -1,7 +1,7 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. PACKAGE = "tryton" -VERSION = "1.6.7" +VERSION = "1.6.8" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From e85a07b8d91d4889e48c71be65ec86f8b75accae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 22 Jun 2012 17:53:35 +0200 Subject: [PATCH 86/97] Fix name of fields loaded from predefined export issue2648 review404001 (transplanted from 481bf839727a0a1afff30fb963e46afa368b4306) --- tryton/gui/window/win_export.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tryton/gui/window/win_export.py b/tryton/gui/window/win_export.py index e1ea9aa4ef..142ca62e56 100644 --- a/tryton/gui/window/win_export.py +++ b/tryton/gui/window/win_export.py @@ -246,7 +246,8 @@ class WinExport(object): child = self.model1.iter_children(iter) if self.model1.get_value(child, 0) is None: prefix_field = self.model1.get_value(iter, 1) - name, model = self.fields[prefix_field] + _, model = self.fields[prefix_field] + name = self.fields_data[prefix_field]['string'] self.model_populate(self._get_fields(model), iter, prefix_field + '/', name + '/') self.model1.remove(child) From fc7e34bbfd925ac727ed5176716c49214d370eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 28 Jun 2012 15:11:17 +0200 Subject: [PATCH 87/97] set_value of M2O must simulate a focus-out in case it did not yet occur issue2624 review408001 (transplanted from a07d90df4d9e6b98778260ec684b6f1317a4cb8b) --- tryton/gui/window/view_form/view/form_gtk/many2one.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tryton/gui/window/view_form/view/form_gtk/many2one.py b/tryton/gui/window/view_form/view/form_gtk/many2one.py index d4e6cceeb9..0576edf88a 100644 --- a/tryton/gui/window/view_form/view/form_gtk/many2one.py +++ b/tryton/gui/window/view_form/view/form_gtk/many2one.py @@ -117,7 +117,7 @@ class Many2One(WidgetInterface): def _color_widget(self): return self.wid_text - def sig_activate(self, widget, event=None, key_press=False): + def sig_activate(self, widget=None, event=None, key_press=False): if not self.focus_out: return if not self.field: @@ -127,7 +127,7 @@ class Many2One(WidgetInterface): self.focus_out = False if not value: - if not key_press and not event: + if not key_press and not event and widget: widget.emit_stop_by_name('activate') if not self._readonly and (self.wid_text.get_text() or \ (self.field.get_state_attrs( @@ -278,7 +278,8 @@ class Many2One(WidgetInterface): return False def set_value(self, record, field): - pass # No update of the model, the model is updated in real time ! + # Simulate a focus-out + self.sig_activate() def display(self, record, field): self.changed = False From 1cbd32d6b2bbe3d867215d8411a38924632bdea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 25 Jul 2012 20:31:56 +0200 Subject: [PATCH 88/97] Fix test on legend graph attribute review421001 (transplanted from 883480d210a7b3361afc69df26e766c62a4e76dc) --- tryton/gui/window/view_form/view/graph_gtk/graph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/gui/window/view_form/view/graph_gtk/graph.py b/tryton/gui/window/view_form/view/graph_gtk/graph.py index 0dcd6cf155..ae02977611 100644 --- a/tryton/gui/window/view_form/view/graph_gtk/graph.py +++ b/tryton/gui/window/view_form/view/graph_gtk/graph.py @@ -268,7 +268,7 @@ class Graph(gtk.DrawingArea): cr.restore() def drawLegend(self, cr, width, height): - if not self.attrs.get('legend', True): + if not int(self.attrs.get('legend', 1)): return padding = 4 From 9412983102328962518357e965e2194109561e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 1 Sep 2012 19:05:38 +0200 Subject: [PATCH 89/97] Prepare release 1.6.8 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index ec4384a2fa..4ac0a1d62e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 1.6.8 - 2012-09-01 +* Bug fixes (see mercurial logs for details) + Version 1.6.7 - 2012-05-07 * Bug fixes (see mercurial logs for details) From fe0378a3c59daf7490f49fef33fe399e17970690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 1 Sep 2012 19:05:39 +0200 Subject: [PATCH 90/97] Added tag 1.6.8 for changeset 3d0ec6d0f68d --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index fd30e8708c..d75b9abae2 100644 --- a/.hgtags +++ b/.hgtags @@ -9,3 +9,4 @@ c807c9f30a09a7afb8e8f6b1aca7ad79f66f580d 1.6.3 a5fa88c626993fc0c1bb89e0562920d09bf79ed2 1.6.5 222c956df77f22ca0cbbb8f772dd9d8040a63312 1.6.6 f67966bbcf632c3a1a9898a0cbcd033448ef75f5 1.6.7 +3d0ec6d0f68d293443a199e00bfb6999250fd172 1.6.8 From 6f5e4ec7628b5aff73c755e6eda791a87036e2e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 1 Sep 2012 19:06:19 +0200 Subject: [PATCH 91/97] Increase version number --- tryton/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/version.py b/tryton/version.py index be6eec7ef2..43805f5e86 100644 --- a/tryton/version.py +++ b/tryton/version.py @@ -1,7 +1,7 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. PACKAGE = "tryton" -VERSION = "1.6.8" +VERSION = "1.6.9" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/" From 9238d244753c9bcc8e6d83b8286aab2063710571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 1 Oct 2012 16:07:19 +0200 Subject: [PATCH 92/97] Don't store interger as current record Use inline if/else instead of and issue2701 (transplanted from 33f9f70a701fb253463297e173345e8d08cc58f3) --- tryton/gui/window/view_form/screen/screen.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tryton/gui/window/view_form/screen/screen.py b/tryton/gui/window/view_form/screen/screen.py index d04d511c1d..976f0e7162 100644 --- a/tryton/gui/window/view_form/screen/screen.py +++ b/tryton/gui/window/view_form/screen/screen.py @@ -627,8 +627,7 @@ class Screen(SignalEvent): idx = len(self.group) - 1 self.current_record = self.group[idx] else: - self.current_record = len(self.group) \ - and self.group[0] + self.current_record = self.group[0] if len(self.group) else None self.current_view.set_cursor(reset_view=False) if self.current_record: self.current_record.validate_set() @@ -656,8 +655,7 @@ class Screen(SignalEvent): idx = 0 self.current_record = self.group[idx] else: - self.current_record = len(self.group) \ - and self.group[-1] + self.current_record = self.group[-1] if len(self.group) else None self.current_view.set_cursor(reset_view=False) if self.current_record: self.current_record.validate_set() From 8be480b75ebdd4c0ea63c251dd74dce83f4e2727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 17 Oct 2012 21:19:22 +0200 Subject: [PATCH 93/97] Fix calls to sig_db_dump/restore issue2814 (transplanted from 2105a3798a43a68f2813a0258597c20d653c87a0) --- tryton/gui/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tryton/gui/main.py b/tryton/gui/main.py index 3d682eef5e..fba3225cef 100644 --- a/tryton/gui/main.py +++ b/tryton/gui/main.py @@ -1489,7 +1489,7 @@ class Main(object): common.message(_("Database dropped successfully!"), \ parent=self.window) - def sig_db_restore(self, widget): + def sig_db_restore(self, widget=None): if not self.sig_logout(widget): return False filename = common.file_selection(_('Open Backup File to Restore...'), \ @@ -1534,7 +1534,7 @@ class Main(object): common.message(_('Database restore failed!'), \ parent=self.window) - def sig_db_dump(self, widget): + def sig_db_dump(self, widget=None): if not self.sig_logout(widget): return False dialog = DBBackupDrop(self.window, function='backup') From 25317947006e1851f082856bf689edc4fe6b482d Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Sat, 20 Oct 2012 13:46:07 +0200 Subject: [PATCH 94/97] avoid markup on unknown strings issue2843 review576002 (transplanted from ee1eeb93e98c8a82678b6cf37fa44fbc1b41fd55) --- tryton/gui/window/win_form.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tryton/gui/window/win_form.py b/tryton/gui/window/win_form.py index 554597c55d..38ad1c91a0 100644 --- a/tryton/gui/window/win_form.py +++ b/tryton/gui/window/win_form.py @@ -57,9 +57,8 @@ class WinForm(object): self.win.set_title(self.screen.current_view.title) title = gtk.Label() - title.set_use_markup(True) - title.modify_font(pango.FontDescription("12")) - title.set_label('' + self.screen.current_view.title + '') + title.modify_font(pango.FontDescription("bold 12")) + title.set_label(self.screen.current_view.title) title.set_padding(20, 3) title.set_alignment(0.0, 0.5) title.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse("#000000")) From 92c8b7f1b7fc68e6a536366aaf9e6d897e6f3d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 5 Nov 2012 17:37:54 +0100 Subject: [PATCH 95/97] Prepare release 1.6.9 --- CHANGELOG | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 4ac0a1d62e..5e1b25a661 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +Version 1.6.9 - 2012-11-05 +* Bug fixes (see mercurial logs for details) + Version 1.6.8 - 2012-09-01 * Bug fixes (see mercurial logs for details) From df9f0308f7f7c45b887d43cb0ef377da95f51260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 5 Nov 2012 17:37:55 +0100 Subject: [PATCH 96/97] Added tag 1.6.9 for changeset 6c2d1a00f2c8 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index d75b9abae2..2b2cd455a9 100644 --- a/.hgtags +++ b/.hgtags @@ -10,3 +10,4 @@ a5fa88c626993fc0c1bb89e0562920d09bf79ed2 1.6.5 222c956df77f22ca0cbbb8f772dd9d8040a63312 1.6.6 f67966bbcf632c3a1a9898a0cbcd033448ef75f5 1.6.7 3d0ec6d0f68d293443a199e00bfb6999250fd172 1.6.8 +6c2d1a00f2c86f8cdbf45448ed1f67a97c2a76b0 1.6.9 From 0addeddfd67a1bec1d7e66c4a467aac219b6ba4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 5 Nov 2012 17:38:29 +0100 Subject: [PATCH 97/97] Increase version number --- tryton/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tryton/version.py b/tryton/version.py index 43805f5e86..c702b524b4 100644 --- a/tryton/version.py +++ b/tryton/version.py @@ -1,7 +1,7 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. PACKAGE = "tryton" -VERSION = "1.6.9" +VERSION = "1.6.10" LICENSE = "GPL-3" WEBSITE = "http://www.tryton.org/"