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
=== modified file 'bin/options.py'
--- bin/options.py 2010-07-22 09:16:49 +0000
+++ bin/options.py 2010-07-28 17:19:44 +0000
@@ -104,6 +104,7 @@
104 'help.context': 'http://doc.openerp.com/index.php?model=%(model)s&lang=%(lang)s',104 'help.context': 'http://doc.openerp.com/index.php?model=%(model)s&lang=%(lang)s',
105 'client.timeout': 300,105 'client.timeout': 300,
106 'client.form_text_spellcheck': True,106 'client.form_text_spellcheck': True,
107 'client.always_save': False,
107 }108 }
108 loglevels = ('critical', 'error', 'warning', 'info', 'debug', 'debug_rpc', 'debug_rpc_answer', 'notset')109 loglevels = ('critical', 'error', 'warning', 'info', 'debug', 'debug_rpc', 'debug_rpc_answer', 'notset')
109 parser = optparse.OptionParser(version=_("OpenERP Client %s" % openerp_version))110 parser = optparse.OptionParser(version=_("OpenERP Client %s" % openerp_version))
@@ -113,6 +114,7 @@
113 parser.add_option("-u", "--user", dest="login", help=_("specify the user login"))114 parser.add_option("-u", "--user", dest="login", help=_("specify the user login"))
114 parser.add_option("-p", "--port", dest="port", help=_("specify the server port"))115 parser.add_option("-p", "--port", dest="port", help=_("specify the server port"))
115 parser.add_option("-s", "--server", dest="server", help=_("specify the server ip/name"))116 parser.add_option("-s", "--server", dest="server", help=_("specify the server ip/name"))
117 parser.add_option("-a", "--always-save", dest="always_save", action='store_true', help=_("Enable to save all modified fields (eg: reaonly)"))
116 (opt, args) = parser.parse_args()118 (opt, args) = parser.parse_args()
117119
118 self.rcfile = self._get_rcfile(fname, opt.config)120 self.rcfile = self._get_rcfile(fname, opt.config)
@@ -120,9 +122,12 @@
120122
121 self.options['logging.level'] = opt.log_level123 self.options['logging.level'] = opt.log_level
122124
123 for arg in ('login', 'port', 'server'):125 for arg in ('login', 'port', 'server', 'always_save'):
124 if getattr(opt, arg):126 if getattr(opt, arg):
125 self.options['login.'+arg] = getattr(opt, arg)127 if arg in ('login', 'port', 'server'):
128 self.options['login.'+arg] = getattr(opt, arg)
129 elif arg in ('always_save'):
130 self.options['client.'+arg] = getattr(opt, arg)
126131
127 def _get_rcfile(self, fname, optconfigfile):132 def _get_rcfile(self, fname, optconfigfile):
128 rcfile = fname or optconfigfile or os.environ.get('OPENERPRC') or os.path.join(get_home_dir(), '.openerprc')133 rcfile = fname or optconfigfile or os.environ.get('OPENERPRC') or os.path.join(get_home_dir(), '.openerprc')
129134
=== modified file 'bin/widget/model/record.py'
--- bin/widget/model/record.py 2010-07-27 06:52:02 +0000
+++ bin/widget/model/record.py 2010-07-28 17:19:44 +0000
@@ -33,6 +33,7 @@
33from gtk import glade33from gtk import glade
34import tools34import tools
35from field import O2MField35from field import O2MField
36import options
3637
37class EvalEnvironment(object):38class EvalEnvironment(object):
38 def __init__(self, parent):39 def __init__(self, parent):
@@ -130,12 +131,13 @@
130 self._check_load()131 self._check_load()
131 try:132 try:
132 if not self.id:133 if not self.id:
133 value = self.get(get_readonly=False)134 value = self.get(get_readonly=options.options.get('client.always_save', False))
134 self.id = self.rpc.create(value, self.context_get())135 self.id = self.rpc.create(value, self.context_get())
135 else:136 else:
136 if not self.is_modified():137 if not self.is_modified():
137 return self.id138 return self.id
138 value = self.get(get_readonly=False, get_modifiedonly=True)139 value = self.get(get_readonly=options.options.get('client.always_save', False),
140 get_modifiedonly=True)
139 context = self.context_get().copy()141 context = self.context_get().copy()
140 res = self.rpc.write([self.id], value, context)142 res = self.rpc.write([self.id], value, context)
141 #if type(res) in (int, long):143 #if type(res) in (int, long):