Skip to content
Permalink
Browse files

[IMP] models: records.ids is now records._origin.ids

  • Loading branch information...
rco-odoo committed May 15, 2019
1 parent 41e670f commit ad664613e8fce6b3fa32bce242a67680d1a5e8a7
@@ -191,7 +191,7 @@ def _str_to_list(string):

def _build_grouping_key(line):
#build a string containing all values used to create the tax line
return str(line.tax_ids._origin.ids) + '-' + str(line.analytic_tag_ids._origin.ids) + '-' + (line.analytic_account_id and str(line.analytic_account_id.id) or '')
return str(line.tax_ids.ids) + '-' + str(line.analytic_tag_ids.ids) + '-' + (line.analytic_account_id and str(line.analytic_account_id.id) or '')

def _parse_grouping_key(line):
# Retrieve values computed the last time this method has been run.
@@ -207,13 +207,13 @@ def _parse_grouping_key(line):
def _find_existing_tax_line(line_ids, tax_repartition_line_id, analytic_tag_ids, analytic_account_id):
# tax_repartition_line_id, tag_ids and analytic_account_id are real ids
if tax.analytic:
return line_ids.filtered(lambda x: x.tax_repartition_line_id.id == tax_repartition_line_id and x.analytic_tag_ids._origin.ids == analytic_tag_ids and x.analytic_account_id.id == analytic_account_id)
return line_ids.filtered(lambda x: x.tax_repartition_line_id.id == tax_repartition_line_id and x.analytic_tag_ids.ids == analytic_tag_ids and x.analytic_account_id.id == analytic_account_id)
return line_ids.filtered(lambda x: x.tax_repartition_line_id.id == tax_repartition_line_id)

def _get_lines_to_sum(line_ids, tax, tag_ids, analytic_account_id):
# tax is a real record; tag_ids and analytic_account_id are real ids
if tax.analytic:
return line_ids.filtered(lambda x: tax in x.tax_ids._origin and x.analytic_tag_ids._origin.ids == tag_ids and x.analytic_account_id.id == analytic_account_id)
return line_ids.filtered(lambda x: tax in x.tax_ids._origin and x.analytic_tag_ids.ids == tag_ids and x.analytic_account_id.id == analytic_account_id)
return line_ids.filtered(lambda x: tax in x.tax_ids._origin)

# Cache the already computed tax to avoid useless recalculation (real records)
@@ -283,7 +283,7 @@ def _get_lines_to_sum(line_ids, tax, tag_ids, analytic_account_id):
'debit': amount > 0 and amount or 0.0,
'credit': amount < 0 and -amount or 0.0,
'analytic_account_id': line.analytic_account_id.id if tax.analytic else False,
'analytic_tag_ids': line.analytic_tag_ids._origin.ids if tax.analytic else False,
'analytic_tag_ids': line.analytic_tag_ids.ids if tax.analytic else False,
'move_id': self.id,
'tax_exigible': tax.tax_exigibility == 'on_invoice',
'company_id': self.company_id.id,
@@ -128,7 +128,7 @@ def _onchange_partner_ids(self):
if not self.survey_id.users_can_signup:
invalid_partners = self.env['res.partner'].search([
('user_ids', '=', False),
('id', 'in', self.partner_ids._origin.ids)
('id', 'in', self.partner_ids.ids)
])
if invalid_partners:
raise UserError(
@@ -535,7 +535,7 @@ def _onchange_relation_table(self):
# check whether other fields use the same table
others = self.search([('ttype', '=', 'many2many'),
('relation_table', '=', self.relation_table),
('id', 'not in', self._origin.ids)])
('id', 'not in', self.ids)])
if others:
for other in others:
if (other.model, other.relation) == (self.relation, self.model):
@@ -3143,7 +3143,7 @@ def _filter_access_rules(self, operation):
query = "SELECT {}.id FROM {} WHERE {}.id IN %s AND {}".format(
self._table, ",".join(tables), self._table, " AND ".join(where_clause),
)
for sub_ids in self._cr.split_for_in_conditions(self._origin._ids):
for sub_ids in self._cr.split_for_in_conditions(self.ids):
self._cr.execute(query, [sub_ids] + where_params)
valid_ids.update(row[0] for row in self._cr.fetchall())

@@ -4755,10 +4755,8 @@ def browse(self, ids=None):

@property
def ids(self):
""" List of actual record ids in this recordset (ignores placeholder
ids for records to create)
"""
return [it for it in self._ids if it]
""" Return the list of actual record ids corresponding to ``self``. """
return list(origin_ids(self._ids))

# backward-compatibility with former browse records
_cr = property(lambda self: self.env.cr)

0 comments on commit ad66461

Please sign in to comment.
You can’t perform that action at this time.