diff --git a/account_move_base_import/models/account_journal.py b/account_move_base_import/models/account_journal.py
index 93cffd59..d8165f35 100644
--- a/account_move_base_import/models/account_journal.py
+++ b/account_move_base_import/models/account_journal.py
@@ -32,7 +32,7 @@ class AccountJournal(models.Model):
"moves for this journal.",
)
- last_import_date = fields.Datetime(string="Last Import Date")
+ last_import_date = fields.Datetime()
partner_id = fields.Many2one(
comodel_name="res.partner",
@@ -64,13 +64,11 @@ class AccountJournal(models.Model):
)
create_counterpart = fields.Boolean(
- string="Create Counterpart",
help="Tick that box to automatically create the move counterpart",
default=True,
)
split_counterpart = fields.Boolean(
- string="Split Counterpart",
help="Two counterparts will be automatically created : one for "
"the refunds and one for the payments",
)
@@ -218,8 +216,8 @@ class AccountJournal(models.Model):
:return: True
"""
self.message_post(
- body=_("Move %s have been imported with %s " "lines.")
- % (move.name, num_lines)
+ body=_("Move %(move_name)s have been imported with %(num_lines)s " "lines.")
+ % {"move_name": move.name, "num_lines": num_lines}
)
return True
@@ -397,5 +395,5 @@ class AccountJournal(models.Model):
st += "".join(traceback.format_tb(trbk, 30))
raise ValidationError(
_("Statement import error " "The statement cannot be created: %s") % st
- )
+ ) from None
return move
diff --git a/account_move_base_import/models/account_move.py b/account_move_base_import/models/account_move.py
index c8a72386..0951c40f 100644
--- a/account_move_base_import/models/account_move.py
+++ b/account_move_base_import/models/account_move.py
@@ -42,8 +42,8 @@ class AccountMoveCompletionRule(models.Model):
_order = "sequence asc"
_description = "Account move completion method"
- sequence = fields.Integer(string="Sequence", help="Lower means parsed first.")
- name = fields.Char(string="Name")
+ sequence = fields.Integer(help="Lower means parsed first.")
+ name = fields.Char()
journal_ids = fields.Many2many(
comodel_name="account.journal",
relation="account_journal_completion_rule_rel",
@@ -94,10 +94,10 @@ class AccountMoveCompletionRule(models.Model):
else:
raise ErrorTooManyPartner(
_(
- 'Line named "%s" was matched by more than one '
- "partner while looking on %s invoices"
+ 'Line named "%(line_name)s" was matched by more than one '
+ "partner while looking on %(inv_type)s invoices"
)
- % (line.name, inv_type)
+ % {"line_name": line.name, "inv_type": inv_type}
)
return False
@@ -177,9 +177,12 @@ class AccountMoveCompletionRule(models.Model):
if partners:
if len(partners) > 1:
msg = _(
- 'Line named "%s" was matched by more than '
- "one partner while looking on partner label: %s"
- ) % (line.name, ",".join([x.name for x in partners]))
+ 'Line named "%(line_name)s" was matched by more than '
+ "one partner while looking on partner label: %(partner_labels)s"
+ ) % {
+ "line_name": line.name,
+ "partner_labels": ",".join([x.name for x in partners]),
+ }
raise ErrorTooManyPartner(msg)
res["partner_id"] = partners[0].id
return res
@@ -316,6 +319,7 @@ class AccountMove(models.Model):
move.partner_id = move.import_partner_id
else:
super(AccountMove, move)._compute_partner_id()
+ return
def write_completion_log(self, error_msg, number_imported):
"""Write the log in the completion_logs field of the bank statement to
@@ -332,22 +336,31 @@ class AccountMove(models.Model):
log = self.completion_logs or ""
completion_date = fields.Datetime.now()
message = _(
- "%s Account Move %s has %s/%s lines completed by " "%s \n%s\n%s\n"
- ) % (
- completion_date,
- self.name,
- number_imported,
- number_line,
- user_name,
- error_msg,
- log,
- )
+ "%(completion_date)s Account Move %(move_name)s has %(num_imported)s/"
+ "%(number_line)s lines completed by "
+ "%(user_name)s \n%(error_msg)s\n%(log)s\n"
+ ) % {
+ "completion_date": completion_date,
+ "move_name": self.name,
+ "num_imported": number_imported,
+ "number_line": number_line,
+ "user_name": user_name,
+ "error_msg": error_msg,
+ "log": log,
+ }
self.write({"completion_logs": message})
body = (
(
- _("Statement ID %s auto-completed for %s/%s lines completed")
- % (self.name, number_imported, number_line)
+ _(
+ "Statement ID %(move_name)s auto-completed for %(num_imported)s/"
+ "%(number_line)s lines completed"
+ )
+ % {
+ "move_name": self.name,
+ "num_imported": number_imported,
+ "number_line": number_line,
+ }
),
)
self.message_post(body=body)
diff --git a/account_move_base_import/models/partner.py b/account_move_base_import/models/partner.py
index 477304b6..dd6985e5 100644
--- a/account_move_base_import/models/partner.py
+++ b/account_move_base_import/models/partner.py
@@ -14,7 +14,6 @@ class ResPartner(models.Model):
_inherit = "res.partner"
bank_statement_label = fields.Char(
- string="Bank Statement Label",
help="Enter the various label found on your bank statement "
"separated by a ; If one of this label is include in the "
"bank statement line, the partner will be automatically "
diff --git a/account_move_base_import/parser/file_parser.py b/account_move_base_import/parser/file_parser.py
index 086df420..1fdc45b4 100644
--- a/account_move_base_import/parser/file_parser.py
+++ b/account_move_base_import/parser/file_parser.py
@@ -158,33 +158,35 @@ class FileParser(AccountMoveImportParser):
raise UserError(
_(
"Date format is not valid."
- " It should be YYYY-MM-DD for column: %s"
- " value: %s \n \n \n Please check"
- " the line with ref: %s \n \n Detail: %s"
+ " It should be YYYY-MM-DD for column: %(rule)s"
+ " value: %(line_value)s \n \n \n Please check"
+ " the line with ref: %(ref_value)s \n \n Detail: "
+ "%(error)s"
)
- % (
- rule,
- line.get(rule, _("Missing")),
- line.get("ref", line),
- repr(err),
- )
- )
+ % {
+ "rule": rule,
+ "line_value": line.get(rule, _("Missing")),
+ "ref_value": line.get("ref", line),
+ "error": repr(err),
+ }
+ ) from err
else:
try:
line[rule] = conversion_rules[rule](line[rule])
except Exception as err:
raise UserError(
_(
- "Value %s of column %s is not valid.\n Please "
- "check the line with ref %s:\n \n Detail: %s"
+ "Value %(line_value)s of column %(rule)s is not valid."
+ "\n Please check the line with ref %(value_ref)s:\n "
+ "\n Detail: %(error)s"
)
- % (
- line.get(rule, _("Missing")),
- rule,
- line.get("ref", line),
- repr(err),
- )
- )
+ % {
+ "line_value": line.get(rule, _("Missing")),
+ "rule": rule,
+ "value_ref": line.get("ref", line),
+ "error": repr(err),
+ }
+ ) from err
return result_set
def _from_xls(self, result_set, conversion_rules):
@@ -202,32 +204,34 @@ class FileParser(AccountMoveImportParser):
_(
"Date format is not valid. "
"Please modify the cell formatting to date "
- "format for column: %s value: %s\n Please"
- " check the line with ref: %s\n \n Detail: %s"
+ "format for column: %(rule)s value: %(line_value)s\n "
+ "Please check the line with ref: %(value_ref)s\n "
+ "\n Detail: %(error)s"
)
- % (
- rule,
- line.get(rule, _("Missing")),
- line.get("ref", line),
- repr(err),
- )
- )
+ % {
+ "rule": rule,
+ "line_value": line.get(rule, _("Missing")),
+ "value_ref": line.get("ref", line),
+ "error": repr(err),
+ }
+ ) from err
else:
try:
line[rule] = conversion_rules[rule](line[rule])
except Exception as err:
raise UserError(
_(
- "Value %s of column %s is not valid.\n Please "
- "check the line with ref %s:\n \n Detail: %s"
+ "Value %(line_value)s of column %(rule)s is not valid."
+ "\n Please check the line with ref %(value_ref)s:\n "
+ "\n Detail: %(error)s"
)
- % (
- line.get(rule, _("Missing")),
- rule,
- line.get("ref", line),
- repr(err),
- )
- )
+ % {
+ "line_value": line.get(rule, _("Missing")),
+ "rule": rule,
+ "value_ref": line.get("ref", line),
+ "error": repr(err),
+ }
+ ) from err
return result_set
def _cast_rows(self, *args, **kwargs):
diff --git a/account_move_base_import/views/account_move_view.xml b/account_move_base_import/views/account_move_view.xml
index 46df5ebf..b61cc745 100644
--- a/account_move_base_import/views/account_move_view.xml
+++ b/account_move_base_import/views/account_move_view.xml
@@ -53,7 +53,7 @@
account.move.completion.rule.view
account.move.completion.rule
-
+
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 00000000..542d351c
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,2 @@
+# generated from manifests external_dependencies
+xlrd
diff --git a/setup/account_move_base_import/odoo/addons/account_move_base_import b/setup/account_move_base_import/odoo/addons/account_move_base_import
new file mode 120000
index 00000000..9e14849e
--- /dev/null
+++ b/setup/account_move_base_import/odoo/addons/account_move_base_import
@@ -0,0 +1 @@
+../../../../account_move_base_import
\ No newline at end of file
diff --git a/setup/account_move_base_import/setup.py b/setup/account_move_base_import/setup.py
new file mode 100644
index 00000000..28c57bb6
--- /dev/null
+++ b/setup/account_move_base_import/setup.py
@@ -0,0 +1,6 @@
+import setuptools
+
+setuptools.setup(
+ setup_requires=['setuptools-odoo'],
+ odoo_addon=True,
+)