Christophe Chauvet - http://www.syleam.fr/ has proposed merging
lp:~christophe-chauvet/openobject-client/trunk-save-readonly-field into
lp:openobject-client.
Requested reviews:
OpenERP sa GTK client R&D (openerp-dev-gtk)
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,
--
https://code.launchpad.net/~christophe-chauvet/openobject-client/trunk-save-readonly-field/+merge/30989
Your team OpenERP sa GTK client R&D is requested to review the proposed merge
of lp:~christophe-chauvet/openobject-client/trunk-save-readonly-field into
lp:openobject-client.
=== modified file 'bin/options.py'
--- bin/options.py 2010-07-22 09:16:49 +0000
+++ bin/options.py 2010-07-26 21:19:42 +0000
@@ -104,6 +104,7 @@
'help.context': 'http://doc.openerp.com/index.php?model=%(model)s&lang=%(lang)s',
'client.timeout': 300,
'client.form_text_spellcheck': True,
+ 'client.save_readonly': False,
}
loglevels = ('critical', 'error', 'warning', 'info', 'debug', 'debug_rpc', 'debug_rpc_answer', 'notset')
parser = optparse.OptionParser(version=_("OpenERP Client %s" % openerp_version))
@@ -113,6 +114,7 @@
parser.add_option("-u", "--user", dest="login", help=_("specify the user login"))
parser.add_option("-p", "--port", dest="port", help=_("specify the server port"))
parser.add_option("-s", "--server", dest="server", help=_("specify the server ip/name"))
+ parser.add_option("-r", "--save-readonly", dest="save_readonly", action='store_true', help=_("Enable to save the readonly field"))
(opt, args) = parser.parse_args()
self.rcfile = self._get_rcfile(fname, opt.config)
@@ -120,9 +122,12 @@
self.options['logging.level'] = opt.log_level
- for arg in ('login', 'port', 'server'):
+ for arg in ('login', 'port', 'server', 'save_readonly'):
if getattr(opt, arg):
- self.options['login.'+arg] = getattr(opt, arg)
+ if arg in ('login', 'port', 'server'):
+ self.options['login.'+arg] = getattr(opt, arg)
+ elif arg in ('save_readonly'):
+ self.options['client.'+arg] = getattr(opt, arg)
def _get_rcfile(self, fname, optconfigfile):
rcfile = fname or optconfigfile or os.environ.get('OPENERPRC') or os.path.join(get_home_dir(), '.openerprc')
=== modified file 'bin/widget/model/record.py'
--- bin/widget/model/record.py 2010-07-20 08:33:43 +0000
+++ bin/widget/model/record.py 2010-07-26 21:19:42 +0000
@@ -33,6 +33,7 @@
from gtk import glade
import tools
from field import O2MField
+import options
class EvalEnvironment(object):
def __init__(self, parent):
@@ -130,12 +131,13 @@
self._check_load()
try:
if not self.id:
- value = self.get(get_readonly=False)
+ value = self.get(get_readonly=options.options.get('client.save_readonly', False))
self.id = self.rpc.create(value, self.context_get())
else:
if not self.is_modified():
return self.id
- value = self.get(get_readonly=False, get_modifiedonly=True)
+ value = self.get(get_readonly=options.options.get('client.save_readonly', False),
+ get_modifiedonly=True)
context = self.context_get().copy()
res = self.rpc.write([self.id], value, context)
#if type(res) in (int, long):
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp