Skip to content

Commit

Permalink
[IMP] account_invoice_import: black, isort, prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
BhaveshHeliconia committed Dec 3, 2024
1 parent 6162dd3 commit 141632e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ class AccountInvoiceImportConfig(models.Model):

name = fields.Char(required=True)
partner_id = fields.Many2one(
"res.partner",
ondelete="cascade",
domain=[("parent_id", "=", False)],
"res.partner", ondelete="cascade", domain=[("parent_id", "=", False)],
)
active = fields.Boolean(default=True)
sequence = fields.Integer()
Expand Down
5 changes: 1 addition & 4 deletions account_invoice_import/models/account_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ def create_invoice_from_attachment(self, attachment_ids=None):
return super().create_invoice_from_attachment(attachment_ids=attachment_ids)
attachment = self.env["ir.attachment"].browse(attachment_ids[0])
wiz = self.env["account.invoice.import"].create(
{
"invoice_file": attachment.datas,
"invoice_filename": attachment.name,
}
{"invoice_file": attachment.datas, "invoice_filename": attachment.name}
)
action = wiz.import_invoice()
# JS crash when there is not a 'views' key != False
Expand Down
4 changes: 1 addition & 3 deletions account_invoice_import/scripts/mass_invoice_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ def handle_failure(directory, entry, file_path):
fail_dir_path = fail_subdir_ok[directory]
if fail_dir_path:
logger.info(
"Moving file %s to sub-directory %s",
entry,
args.fail_subdir,
"Moving file %s to sub-directory %s", entry, args.fail_subdir,
)
os.rename(file_path, os.path.join(fail_dir_path, entry))

Expand Down
8 changes: 2 additions & 6 deletions account_invoice_import/wizard/account_invoice_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -1232,9 +1232,7 @@ def post_process_invoice(self, parsed_inv, invoice, import_config): # noqa: C90
)
)
assert not float_compare(
parsed_inv["amount_total"],
invoice.amount_total,
precision_rounding=prec,
parsed_inv["amount_total"], invoice.amount_total, precision_rounding=prec,
)

def update_invoice_lines(self, parsed_inv, invoice, seller):
Expand Down Expand Up @@ -1574,9 +1572,7 @@ def message_new(self, msg_dict, custom_values=None):
)
continue
logger.info(
"Attachment %d: %s. Trying to import it as an invoice",
i,
filename,
"Attachment %d: %s. Trying to import it as an invoice", i, filename,
)
# if it's an XML file, attach.content is a string
# if it's a PDF file, attach.content is a byte !
Expand Down
6 changes: 6 additions & 0 deletions setup/account_invoice_import/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit 141632e

Please sign in to comment.