Merge lp:~christophe-chauvet/openobject-client/trunk-save-readonly-field into lp:openobject-client

Proposed by Christophe CHAUVET
Status: Rejected
Rejected by: tfr (Openerp)
Proposed branch: lp:~christophe-chauvet/openobject-client/trunk-save-readonly-field
Merge into: lp:openobject-client
Diff against target: 62 lines (+11/-4)
2 files modified
bin/options.py (+7/-2)
bin/widget/model/record.py (+4/-2)
To merge this branch: bzr merge lp:~christophe-chauvet/openobject-client/trunk-save-readonly-field
Reviewer Review Type Date Requested Status
Christophe Simonis (OpenERP) Disapprove
Christophe CHAUVET (community) Needs Resubmitting
Nhomar - Vauxoo (community) Needs Resubmitting
Review via email: mp+30989@code.launchpad.net

Description of the change

Hi

I implement a great feature that all integrators wants, the possibility to save a readonly field, specialy when a result is return by a on_change.

I keep a backward compatibility (not activate by default)

if argument --save-readonly (or -r) is called, the readonly file can be save.

this argument can be save on the .openerprc file on cient section

[client]
save_readonly = True

Regards,

To post a comment you must log in.
Revision history for this message
Nhomar - Vauxoo (nhomar) wrote :

I didn't try it yet but is a great feature!!!!....

And I think is not a big improve, i think is a bug, it should be merged.... approved for me... ;-)

I will try and i will give some information......

Revision history for this message
Nhomar - Vauxoo (nhomar) wrote :
Download full text (8.3 KiB)

Hello.....

I try to make the merge..... but some conflicts are present...

can you please make the improvement in only the especific files needed and use the last revno please...

Thanks.

SHELL: ~/proyectos_bazaar/client_new$ bzr merge lp:~christophe-chauvet/openobject-client/trunk-save-readonly-field

LOG_:

+N bin/icons/accessories-archiver+.png
+N bin/icons/accessories-archiver-minus.png
+N bin/icons/accessories-archiver.png
+N bin/icons/call-start.png
+N bin/icons/camera_test.png
+N bin/icons/check.png
+N bin/icons/dialog-close.png
+N bin/icons/document-new.png
+N bin/icons/dolar.png
+N bin/icons/dolar_ok!.png
+N bin/icons/emblem-important.png
+N bin/icons/face-plain.png
+N bin/icons/folder-blue.png
+N bin/icons/folder-green.png
+N bin/icons/folder-orange.png
+N bin/icons/folder-yellow.png
+N bin/icons/gdu-smart-failing.png
+N bin/icons/gnome-cpu-frequency-applet+.png
+N bin/icons/go-home.png
+N bin/icons/go-month.png
+N bin/icons/go-today.png
+N bin/icons/go-week.png
+N bin/icons/go-year.png
+N bin/icons/gtk-go-back-ltr.png
+N bin/icons/gtk-go-back-rtl.png
+N bin/icons/gtk-jump-to-ltr.png
+N bin/icons/gtk-jump-to-rtl.png
+N bin/icons/gtk-media-pause.png
+N bin/icons/gtk-select-all.png
+N bin/icons/gtk-stop.png
+N bin/icons/idea.png
+N bin/icons/locked.png
+N bin/icons/mail-.png
+N bin/icons/mail-forward.png
+N bin/icons/mail-message-new.png
+N bin/icons/mail-replied.png
+N bin/icons/mail_delete.png
+N bin/icons/personal+.png
+N bin/icons/personal-.png
+N bin/icons/personal.png
+N bin/icons/rating-rated.png
+N bin/icons/stage.png
+N bin/icons/stock_align_left_24.png
+N bin/icons/stock_effects-object-colorize.png
+N bin/icons/stock_format-default.png
+N bin/icons/stock_format-scientific.png
+N bin/icons/stock_symbol-selection.png
+N bin/icons/stock_zoom.png
+N bin/po/be.po
+N bin/po/en_GB.po
+N bin/po/es_EC.po
+N bin/po/fa.po
+N bin/po/gl.po
+N bin/po/he.po
+N bin/po/hr.po
+N bin/po/is.po
+N bin/po/iu.po
+N bin/po/ja.po
+N bin/po/ko.po
+N bin/po/lv.po
+N bin/po/mk.po
+N bin/po/mn.po
+N bin/po/oc.po
+N bin/po/rom.po
+N bin/po/sk.po
+N bin/po/ta.po
+N bin/po/th.po
+N bin/po/vi.po
+N bin/po/zh_TW.po
+N bin/widget/view/calendar_gtk/calendar_dummy.py
+N bin/widget/view/diagram.py
+N bin/widget/view/diagram_gtk/
+N bin/widget/view/diagram_gtk/__init__.py
+N bin/widget/view/diagram_gtk/parser.py
+N bin/widget/view/diagram_gtk/xdot.py
+N bin/widget/view/form_gtk/pager.py
+N bin/widget_search/custom_filter.py
+N bin/widget_search/filter.py
 M bin/SpiffGtkWidgets/Calendar/Calendar.py
 M bin/SpiffGtkWidgets/Calendar/CanvasDay.py
 M bin/SpiffGtkWidgets/Calendar/CanvasDayRange.py
 M bin/SpiffGtkWidgets/Calendar/CanvasEvent.py
 M bin/SpiffGtkWidgets/Calendar/CanvasEventView.py
 M bin/SpiffGtkWidgets/Calendar/CanvasGrid.py
 M bin/SpiffGtkWidgets/Calendar/CanvasHEventView.py
 M bin/SpiffGtkWidgets/Calendar/CanvasMagnetTable.py
 M bin/SpiffGtkWidgets/Calendar/CanvasRectangle.py
 M bin/SpiffGtkWidgets/Calendar/CanvasTable.py
 M bin/SpiffGtkWidgets/Calendar/CanvasTimeline.py
 M bin/SpiffGtkWidgets/Calendar/CanvasVEventVi...

Read more...

review: Needs Fixing (propose again and modify _only_ the needed files.)
Revision history for this message
Nhomar - Vauxoo (nhomar) wrote :

I used like base to try:

<email address hidden>

Revision history for this message
Nhomar - Vauxoo (nhomar) wrote :

I correct.....

I was trying to merge in stable...... Sorry...

I think it should be done in stable too.... we will try to make the change....

Sorry again....

review: Needs Resubmitting
Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

Hi

This patch work in stable (5.0) but you must use patch instead of bzr merge.

Regards,

Revision history for this message
Christophe Simonis (OpenERP) (kangol) wrote :

I don't think this is the way to go for this feature.
It's better if you add a option "always_save" on fields that need to be saved even if they are readonly (and changed, of course).

review: Disapprove
1431. By Christophe CHAUVET

[IMP] Rename option as suggested, use --always-save instead of --savee-readonly

1432. By Christophe CHAUVET

[IMP] use the new option name to save all fields

Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

Hi Christophe

I change the option name as you suggest,

Regards,

review: Needs Resubmitting
Revision history for this message
Christophe Simonis (OpenERP) (kangol) wrote :

It is not the change I have in mind.
I was talking about the fields on server side.

_columns = {
  'blah': fields.char('Blah', size=37, readonly=True, always_save=True),
}

And on client side, the value is get via fields_get (and fields_view_get).

review: Disapprove

Unmerged revisions

1432. By Christophe CHAUVET

[IMP] use the new option name to save all fields

1431. By Christophe CHAUVET

[IMP] Rename option as suggested, use --always-save instead of --savee-readonly

1430. By Christophe CHAUVET

[ADD] New options can save the readonly field or if field have an attrs readonly enable
      now on_change return result on a readonly field can be saved

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/options.py'
2--- bin/options.py 2010-07-22 09:16:49 +0000
3+++ bin/options.py 2010-07-28 17:19:44 +0000
4@@ -104,6 +104,7 @@
5 'help.context': 'http://doc.openerp.com/index.php?model=%(model)s&lang=%(lang)s',
6 'client.timeout': 300,
7 'client.form_text_spellcheck': True,
8+ 'client.always_save': False,
9 }
10 loglevels = ('critical', 'error', 'warning', 'info', 'debug', 'debug_rpc', 'debug_rpc_answer', 'notset')
11 parser = optparse.OptionParser(version=_("OpenERP Client %s" % openerp_version))
12@@ -113,6 +114,7 @@
13 parser.add_option("-u", "--user", dest="login", help=_("specify the user login"))
14 parser.add_option("-p", "--port", dest="port", help=_("specify the server port"))
15 parser.add_option("-s", "--server", dest="server", help=_("specify the server ip/name"))
16+ parser.add_option("-a", "--always-save", dest="always_save", action='store_true', help=_("Enable to save all modified fields (eg: reaonly)"))
17 (opt, args) = parser.parse_args()
18
19 self.rcfile = self._get_rcfile(fname, opt.config)
20@@ -120,9 +122,12 @@
21
22 self.options['logging.level'] = opt.log_level
23
24- for arg in ('login', 'port', 'server'):
25+ for arg in ('login', 'port', 'server', 'always_save'):
26 if getattr(opt, arg):
27- self.options['login.'+arg] = getattr(opt, arg)
28+ if arg in ('login', 'port', 'server'):
29+ self.options['login.'+arg] = getattr(opt, arg)
30+ elif arg in ('always_save'):
31+ self.options['client.'+arg] = getattr(opt, arg)
32
33 def _get_rcfile(self, fname, optconfigfile):
34 rcfile = fname or optconfigfile or os.environ.get('OPENERPRC') or os.path.join(get_home_dir(), '.openerprc')
35
36=== modified file 'bin/widget/model/record.py'
37--- bin/widget/model/record.py 2010-07-27 06:52:02 +0000
38+++ bin/widget/model/record.py 2010-07-28 17:19:44 +0000
39@@ -33,6 +33,7 @@
40 from gtk import glade
41 import tools
42 from field import O2MField
43+import options
44
45 class EvalEnvironment(object):
46 def __init__(self, parent):
47@@ -130,12 +131,13 @@
48 self._check_load()
49 try:
50 if not self.id:
51- value = self.get(get_readonly=False)
52+ value = self.get(get_readonly=options.options.get('client.always_save', False))
53 self.id = self.rpc.create(value, self.context_get())
54 else:
55 if not self.is_modified():
56 return self.id
57- value = self.get(get_readonly=False, get_modifiedonly=True)
58+ value = self.get(get_readonly=options.options.get('client.always_save', False),
59+ get_modifiedonly=True)
60 context = self.context_get().copy()
61 res = self.rpc.write([self.id], value, context)
62 #if type(res) in (int, long):