[FIX] point_of_sale: sessions closing performances
`account.move.line.company_id` is a related
to `account_id.company_id`
`account.bank.statement.company_id` is a related
to `journal_id.company_id`
Any attempt to set the `company_id` value
when creating or writing records for these models
will result to the update of the value in
the related record (the update of `company_id` in the
`account.account and the `account.journal`), which
will result in the update of the `company_id` value in all
records in which this related record is used
(in all `account.move.line` where this `account_id` is used,
in all `account.bank.statement` where this `journal_id` is used).
In other words, the more a database had `account.move.line`
or `account.bank.statement` records, the more
it took time for the pos sessions to be closed.
To force a company for an `account.move.line`
(`account.bank.statement`), you must just
set the correct `account_id`(`journal_id`)
in the first place.
For instance, for the `account_id`, passing
`force_company` in the context ensure to choose
the `account.account` from the right company
property.
See
`local_context = dict(context or {}, force_company=company_id)`
which is set in `_confirm_orders` just before calling
`_create_account_move_line` which retrieve
the account from the
`property_account_receivable_id` property.
opw-671362
This commit is contained in:
@@ -530,7 +530,6 @@ class pos_session(osv.osv):
|
||||
st_values = {
|
||||
'journal_id': journal.id,
|
||||
'user_id': uid,
|
||||
'company_id': pos_config.company_id.id
|
||||
}
|
||||
statements.append(create_statement(st_values, context=context))
|
||||
|
||||
@@ -1248,7 +1247,6 @@ class pos_order(osv.osv):
|
||||
'journal_id' : sale_journal_id,
|
||||
'date' : fields.date.context_today(self, cr, uid, context=context),
|
||||
'move_id' : move_id,
|
||||
'company_id': current_company.id,
|
||||
})
|
||||
|
||||
if data_type == 'product':
|
||||
|
||||
Reference in New Issue
Block a user