diff --git a/account_bank_statement_import_online/__manifest__.py b/account_bank_statement_import_online/__manifest__.py
index 4f251c08..c8653081 100644
--- a/account_bank_statement_import_online/__manifest__.py
+++ b/account_bank_statement_import_online/__manifest__.py
@@ -4,7 +4,7 @@
{
"name": "Online Bank Statements",
- "version": "12.0.1.4.1",
+ "version": "13.0.1.0.0",
"author": "Brainbean Apps, Dataplug, Odoo Community Association (OCA)",
"maintainers": ["alexey-pelykh"],
"website": "https://github.com/OCA/bank-statement-import/",
diff --git a/account_bank_statement_import_online/migrations/13.0.1.0.0/noupdate_changes.xml b/account_bank_statement_import_online/migrations/13.0.1.0.0/noupdate_changes.xml
new file mode 100644
index 00000000..55731376
--- /dev/null
+++ b/account_bank_statement_import_online/migrations/13.0.1.0.0/noupdate_changes.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ ['|',('company_id','=',False),('company_id','in',company_ids)]
+
+
diff --git a/account_bank_statement_import_online/migrations/13.0.1.0.0/post-migration.py b/account_bank_statement_import_online/migrations/13.0.1.0.0/post-migration.py
new file mode 100644
index 00000000..88f5a345
--- /dev/null
+++ b/account_bank_statement_import_online/migrations/13.0.1.0.0/post-migration.py
@@ -0,0 +1,14 @@
+# Copyright 2020 Brainbean Apps (https://brainbeanapps.com)
+# Copyright 2020 Dataplug (https://dataplug.io)
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
+
+from openupgradelib import openupgrade # pylint: disable=W7936
+
+
+@openupgrade.migrate()
+def migrate(env, version):
+ openupgrade.load_data(
+ env.cr,
+ "account_bank_statement_import_online",
+ "migrations/13.0.1.0.0/noupdate_changes.xml",
+ )
diff --git a/account_bank_statement_import_online/models/account_journal.py b/account_bank_statement_import_online/models/account_journal.py
index f0ae857b..53764c25 100644
--- a/account_bank_statement_import_online/models/account_journal.py
+++ b/account_bank_statement_import_online/models/account_journal.py
@@ -42,7 +42,6 @@ class AccountJournal(models.Model):
res += [("dummy", "Dummy")]
return res
- @api.multi
def _update_online_bank_statement_provider_id(self):
OnlineBankStatementProvider = self.env["online.bank.statement.provider"]
for journal in self.filtered("id"):
@@ -72,14 +71,12 @@ class AccountJournal(models.Model):
rec._update_online_bank_statement_provider_id()
return rec
- @api.multi
def write(self, vals):
res = super().write(vals)
if "bank_statements_source" in vals or "online_bank_statement_provider" in vals:
self._update_online_bank_statement_provider_id()
return res
- @api.multi
def action_online_bank_statements_pull_wizard(self):
provider_ids = self.mapped("online_bank_statement_provider_id").ids
return {
diff --git a/account_bank_statement_import_online/models/online_bank_statement_provider.py b/account_bank_statement_import_online/models/online_bank_statement_provider.py
index 64bf4556..1749d7aa 100644
--- a/account_bank_statement_import_online/models/online_bank_statement_provider.py
+++ b/account_bank_statement_import_online/models/online_bank_statement_provider.py
@@ -10,7 +10,7 @@ from html import escape
from dateutil.relativedelta import MO, relativedelta
from pytz import timezone, utc
-from odoo import _, api, fields, models
+from odoo import SUPERUSER_ID, _, api, fields, models
from odoo.addons.base.models.res_bank import sanitize_account_number
from odoo.addons.base.models.res_partner import _tz_get
@@ -115,7 +115,6 @@ class OnlineBankStatementProvider(models.Model):
def values_service(self):
return self._get_available_services()
- @api.multi
@api.depends("service")
def _compute_name(self):
for provider in self:
@@ -123,7 +122,6 @@ class OnlineBankStatementProvider(models.Model):
filter(lambda x: x[0] == provider.service, self._selection_service())
)[0][1]
- @api.multi
@api.depends("active", "interval_type", "interval_number")
def _compute_update_schedule(self):
for provider in self:
@@ -141,8 +139,7 @@ class OnlineBankStatementProvider(models.Model):
)[0][1],
}
- @api.multi # noqa: C901
- def _pull(self, date_since, date_until):
+ def _pull(self, date_since, date_until): # noqa: C901
AccountBankStatement = self.env["account.bank.statement"]
is_scheduled = self.env.context.get("scheduled")
if is_scheduled:
@@ -255,7 +252,7 @@ class OnlineBankStatementProvider(models.Model):
unique_import_id
)
line_values.update({"unique_import_id": unique_import_id})
- if AccountBankStatementLine.sudo().search(
+ if AccountBankStatementLine.with_user(SUPERUSER_ID).search(
[("unique_import_id", "=", unique_import_id)], limit=1
):
continue
@@ -289,13 +286,11 @@ class OnlineBankStatementProvider(models.Model):
if is_scheduled:
provider._schedule_next_run()
- @api.multi
def _schedule_next_run(self):
self.ensure_one()
self.last_successful_run = self.next_run
self.next_run += self._get_next_run_period()
- @api.multi
def _get_statement_date_since(self, date):
self.ensure_one()
date = date.replace(hour=0, minute=0, second=0, microsecond=0)
@@ -306,7 +301,6 @@ class OnlineBankStatementProvider(models.Model):
elif self.statement_creation_mode == "monthly":
return date.replace(day=1)
- @api.multi
def _get_statement_date_step(self):
self.ensure_one()
if self.statement_creation_mode == "daily":
@@ -320,7 +314,6 @@ class OnlineBankStatementProvider(models.Model):
months=1, day=1, hour=0, minute=0, second=0, microsecond=0,
)
- @api.multi
def _get_statement_date(self, date_since, date_until):
self.ensure_one()
# NOTE: Statement date is treated by Odoo as start of period. Details
@@ -330,7 +323,6 @@ class OnlineBankStatementProvider(models.Model):
date_since = date_since.replace(tzinfo=utc).astimezone(tz)
return date_since.date()
- @api.multi
def _generate_unique_import_id(self, unique_import_id):
self.ensure_one()
return (
@@ -340,13 +332,11 @@ class OnlineBankStatementProvider(models.Model):
+ unique_import_id
)
- @api.multi
def _sanitize_bank_account_number(self, bank_account_number):
"""Hook for extension"""
self.ensure_one()
return sanitize_account_number(bank_account_number)
- @api.multi
def _get_next_run_period(self):
self.ensure_one()
if self.interval_type == "minutes":
@@ -381,7 +371,6 @@ class OnlineBankStatementProvider(models.Model):
_logger.info("Scheduled pull of online bank statements complete.")
- @api.multi
def _obtain_statement_data(self, date_since, date_until):
"""Hook for extension"""
# Check tests/online_bank_statement_provider_dummy.py for reference
diff --git a/account_bank_statement_import_online/security/online_bank_statement_provider.xml b/account_bank_statement_import_online/security/online_bank_statement_provider.xml
index c3a4d4e6..0b1ae8e0 100644
--- a/account_bank_statement_import_online/security/online_bank_statement_provider.xml
+++ b/account_bank_statement_import_online/security/online_bank_statement_provider.xml
@@ -1,8 +1,8 @@
@@ -11,6 +11,6 @@
['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]
+ >['|',('company_id','=',False),('company_id','in',company_ids)]
diff --git a/account_bank_statement_import_online/tests/online_bank_statement_provider_dummy.py b/account_bank_statement_import_online/tests/online_bank_statement_provider_dummy.py
index 3ed1137c..a59cac70 100644
--- a/account_bank_statement_import_online/tests/online_bank_statement_provider_dummy.py
+++ b/account_bank_statement_import_online/tests/online_bank_statement_provider_dummy.py
@@ -8,13 +8,12 @@ from random import randrange
from dateutil.relativedelta import relativedelta
from pytz import timezone
-from odoo import api, fields, models
+from odoo import fields, models
class OnlineBankStatementProviderDummy(models.Model):
_inherit = "online.bank.statement.provider"
- @api.multi
def _obtain_statement_data(self, date_since, date_until):
self.ensure_one()
if self.service != "dummy":
diff --git a/account_bank_statement_import_online/wizards/online_bank_statement_pull_wizard.py b/account_bank_statement_import_online/wizards/online_bank_statement_pull_wizard.py
index 5a366680..606a29d0 100644
--- a/account_bank_statement_import_online/wizards/online_bank_statement_pull_wizard.py
+++ b/account_bank_statement_import_online/wizards/online_bank_statement_pull_wizard.py
@@ -2,7 +2,7 @@
# Copyright 2019-2020 Dataplug (https://dataplug.io)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
-from odoo import api, fields, models
+from odoo import fields, models
class OnlineBankStatementPullWizard(models.TransientModel):
@@ -23,7 +23,6 @@ class OnlineBankStatementPullWizard(models.TransientModel):
relation="online_bank_statement_provider_pull_wizard_rel",
)
- @api.multi
def action_pull(self):
self.ensure_one()
self.with_context(active_test=False,).provider_ids._pull(