This commit is contained in:
Laurent Mignon (Acsone)
2014-01-14 15:37:18 +01:00
parent 760a4781be
commit bc879326ed

View File

@@ -182,7 +182,7 @@ class AccountStatementCompletionRule(orm.Model):
inv = self._find_invoice(cr, uid, line, inv_type, context=context) inv = self._find_invoice(cr, uid, line, inv_type, context=context)
if inv: if inv:
# FIXME use only commercial_partner_id of invoice in 7.1 # FIXME use only commercial_partner_id of invoice in 7.1
# this is for backward compatibility in 7.0 before # this is for backward compatibility in 7.0 before
# the refactoring of res.partner # the refactoring of res.partner
if hasattr(inv, 'commercial_partner_id'): if hasattr(inv, 'commercial_partner_id'):
partner_id = inv.commercial_partner_id.id partner_id = inv.commercial_partner_id.id
@@ -459,7 +459,7 @@ class AccountStatementLine(orm.Model):
""" """
statement_line_obj = self.pool['account.bank.statement.line'] statement_line_obj = self.pool['account.bank.statement.line']
model_cols = statement_line_obj._columns model_cols = statement_line_obj._columns
sparse_fields = dict([(k , col) for k, col in model_cols.iteritems() if isinstance(col, fields.sparse) and col._type == 'char']) sparse_fields = dict([(k, col) for k, col in model_cols.iteritems() if isinstance(col, fields.sparse) and col._type == 'char'])
values = [] values = []
for statement in statement_store: for statement in statement_store:
to_json_k = set() to_json_k = set()
@@ -470,10 +470,9 @@ class AccountStatementLine(orm.Model):
serialized = st_copy.setdefault(col.serialization_field, {}) serialized = st_copy.setdefault(col.serialization_field, {})
serialized[k] = st_copy[k] serialized[k] = st_copy[k]
for k in to_json_k: for k in to_json_k:
st_copy[k] = simplejson.dumps(st_copy[k]) st_copy[k] = simplejson.dumps(st_copy[k])
values.append(st_copy) values.append(st_copy)
return values return values
def _insert_lines(self, cr, uid, statement_store, context=None): def _insert_lines(self, cr, uid, statement_store, context=None):
""" Do raw insert into database because ORM is awfully slow """ Do raw insert into database because ORM is awfully slow
@@ -497,7 +496,7 @@ class AccountStatementLine(orm.Model):
when cheking security. when cheking security.
TODO / WARM: sparse fields are skipped by the method. IOW, if your TODO / WARM: sparse fields are skipped by the method. IOW, if your
completion rule update an sparse field, the updated value will never completion rule update an sparse field, the updated value will never
be stored in the database. It would be safer to call the update method be stored in the database. It would be safer to call the update method
from the ORM for records updating this kind of fields. from the ORM for records updating this kind of fields.
""" """
cols = self._get_available_columns([vals]) cols = self._get_available_columns([vals])