mirror of
https://github.com/brain-tec/account_ebics.git
synced 2024-11-23 20:52:04 +00:00
[13.0][FIX]multi-company fix
This commit is contained in:
parent
37406c4042
commit
9779b39101
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'EBICS banking protocol',
|
'name': 'EBICS banking protocol',
|
||||||
'version': '13.0.1.1.0',
|
'version': '13.0.1.1.1',
|
||||||
'license': 'LGPL-3',
|
'license': 'LGPL-3',
|
||||||
'author': 'Noviat',
|
'author': 'Noviat',
|
||||||
'category': 'Accounting & Finance',
|
'category': 'Accounting & Finance',
|
||||||
|
@ -86,6 +86,10 @@ class EbicsFile(models.Model):
|
|||||||
|
|
||||||
def process(self):
|
def process(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
|
ctx = dict(
|
||||||
|
self.env.context,
|
||||||
|
allowed_company_ids=self.env.user.company_ids.ids)
|
||||||
|
self = self.with_context(ctx)
|
||||||
self.note_process = ''
|
self.note_process = ''
|
||||||
ff_methods = self._file_format_methods()
|
ff_methods = self._file_format_methods()
|
||||||
ff = self.format_id.name
|
ff = self.format_id.name
|
||||||
@ -157,18 +161,36 @@ class EbicsFile(models.Model):
|
|||||||
self.note_process += '\n'
|
self.note_process += '\n'
|
||||||
self.note_process += '\n'
|
self.note_process += '\n'
|
||||||
if st_line_ids:
|
if st_line_ids:
|
||||||
|
self.flush()
|
||||||
self.env.cr.execute(
|
self.env.cr.execute(
|
||||||
"""
|
"""
|
||||||
SELECT DISTINCT statement_id
|
SELECT DISTINCT
|
||||||
FROM account_bank_statement_line
|
absl.statement_id,
|
||||||
WHERE id IN %s
|
abs.name, abs.date, abs.company_id,
|
||||||
|
rc.name AS company_name
|
||||||
|
FROM account_bank_statement_line absl
|
||||||
|
INNER JOIN account_bank_statement abs
|
||||||
|
ON abs.id = absl.statement_id
|
||||||
|
INNER JOIN res_company rc
|
||||||
|
ON rc.id = abs.company_id
|
||||||
|
WHERE absl.id IN %s
|
||||||
|
ORDER BY date, company_id
|
||||||
""",
|
""",
|
||||||
(tuple(st_line_ids),)
|
(tuple(st_line_ids),)
|
||||||
)
|
)
|
||||||
statement_ids = [x[0] for x in self.env.cr.fetchall()]
|
sts_data = self.env.cr.dictfetchall()
|
||||||
|
else:
|
||||||
|
sts_data = []
|
||||||
|
st_cnt = len(sts_data)
|
||||||
|
if st_cnt:
|
||||||
self.note_process += _(
|
self.note_process += _(
|
||||||
"Number of Bank Statements: %s"
|
"%s bank statements have been imported: "
|
||||||
) % len(statement_ids)
|
) % st_cnt
|
||||||
|
self.note_process += '\n'
|
||||||
|
for st_data in sts_data:
|
||||||
|
self.note_process += ("\n%s, %s (%s)") % (
|
||||||
|
st_data['date'], st_data['name'], st_data['company_name'])
|
||||||
|
statement_ids = [x['statement_id'] for x in sts_data]
|
||||||
if statement_ids:
|
if statement_ids:
|
||||||
self.sudo().bank_statement_ids = [(6, 0, statement_ids)]
|
self.sudo().bank_statement_ids = [(6, 0, statement_ids)]
|
||||||
ctx = dict(self.env.context, statement_ids=statement_ids)
|
ctx = dict(self.env.context, statement_ids=statement_ids)
|
||||||
|
Loading…
Reference in New Issue
Block a user