savoirfairelinux-openerp team mailing list archive
-
savoirfairelinux-openerp team
-
Mailing list archive
-
Message #00147
[Merge] lp:~sebastien.beau/openobject-extension/oerp6.1-stable-fix into lp:openobject-extension/oerp6.1-stable
Sébastien BEAU - http://www.akretion.com has proposed merging lp:~sebastien.beau/openobject-extension/oerp6.1-stable-fix into lp:openobject-extension/oerp6.1-stable.
Requested reviews:
extra-addons-commiter (extra-addons-commiter)
For more details, see:
https://code.launchpad.net/~sebastien.beau/openobject-extension/oerp6.1-stable-fix/+merge/168486
Fix base_file_protocole
And also fix the base_external_referential decorator for catching error. Indeed for example for the export of the picking the resource contain the id of the picking.
--
https://code.launchpad.net/~sebastien.beau/openobject-extension/oerp6.1-stable-fix/+merge/168486
Your team extra-addons-commiter is requested to review the proposed merge of lp:~sebastien.beau/openobject-extension/oerp6.1-stable-fix into lp:openobject-extension/oerp6.1-stable.
=== modified file 'base_external_referentials/decorator.py'
--- base_external_referentials/decorator.py 2012-12-03 16:26:23 +0000
+++ base_external_referentials/decorator.py 2013-06-10 16:23:25 +0000
@@ -112,18 +112,30 @@
if not context['report_line_based_on'] == self._name:
return func(self, cr, uid, external_session, resource, *args, **kwargs)
report_line_obj = self.pool.get('external.report.line')
+
+ #TODO improve me
+ res_id = False
+ external_id = False
+ if context.get('external_id_key_for_report'):
+ external_id = resource.get(context['external_id_key_for_report'])
+ else:
+ if type(resource) in [int, long]:
+ res_id = resource
+ else:
+ res_id = args and args[0]
+
report_line_id = report_line_obj.start_log(
cr,
uid,
self._name,
func.__name__,
- #TODO manage external id and res_id in a good way
- external_id=context.get('external_id_key_for_report') and resource.get(context.get('external_id_key_for_report')),
- res_id= not context.get('external_id_key_for_report') and args and args[0],
+ external_id = external_id,
+ res_id = res_id,
resource=resource,
args = args,
kwargs = kwargs,
)
+
import_cr = pooler.get_db(cr.dbname).cursor()
response = False
try:
=== modified file 'base_file_protocole/base_file_protocole.py'
--- base_file_protocole/base_file_protocole.py 2012-12-21 17:16:07 +0000
+++ base_file_protocole/base_file_protocole.py 2013-06-10 16:23:25 +0000
@@ -131,7 +131,7 @@
self.connection.storbinary('STOR ' + filename, output_file)
output_file.close()
return True
- elif self.is_('filestore'):
+ elif self.is_('filesystem'):
if not os.path.isabs(filepath):
filepath = os.path.join(self.location, filepath)
if self.allow_dir_creation and not os.path.exists(filepath):
@@ -162,7 +162,7 @@
self.connection.retrbinary("RETR " + filename, outfile.write)
outfile.seek(0)
return outfile
- elif self.is_('filestore'):
+ elif self.is_('filesystem'):
return open(os.path.join(filepath, filename), 'r+b')
@open_and_close_connection
@@ -171,14 +171,14 @@
self.connection.cwd(filepath)
#Take care that ftp lib use utf-8 and not unicode
return [x for x in self.connection.nlst() if filename.encode('utf-8') in x]
- elif self.is_('filestore'):
+ elif self.is_('filesystem'):
return [x for x in os.listdir(filepath) if filename in x]
@open_and_close_connection
def move(self, oldfilepath, newfilepath, filename):
if self.is_('ftp'):
self.connection.rename(os.path.join(oldfilepath, filename), os.path.join(newfilepath, filename))
- elif self.is_('filestore'):
+ elif self.is_('filesystem'):
os.rename(os.path.join(oldfilepath, filename), os.path.join(newfilepath, filename))
class FileCsvReader(object):
@@ -287,6 +287,3 @@
index += 1
result.append(row)
return result
-
-
-