From 9406e9e7a2cb9fa3be634908265697d691ace1d3 Mon Sep 17 00:00:00 2001 From: Heliconia Solutions Date: Mon, 9 Dec 2024 10:57:32 +0530 Subject: [PATCH] [MIG] account_invoice_import: Backported to 13.0 --- account_invoice_import/README.rst | 7 +-- account_invoice_import/__manifest__.py | 2 +- account_invoice_import/models/res_partner.py | 5 +- .../readme/CONTRIBUTORS.rst | 1 + .../security/ir.model.access.csv | 2 - .../static/description/index.html | 14 +++--- .../tests/test_invoice_import.py | 19 +++---- .../views/account_invoice.xml | 4 +- .../views/account_journal_dashboard.xml | 2 +- account_invoice_import/views/res_partner.xml | 5 +- .../wizard/account_invoice_import.py | 49 +++++++++---------- .../wizard/account_invoice_import_view.xml | 3 +- 12 files changed, 51 insertions(+), 62 deletions(-) diff --git a/account_invoice_import/README.rst b/account_invoice_import/README.rst index 0718607fa6..597a8929d4 100644 --- a/account_invoice_import/README.rst +++ b/account_invoice_import/README.rst @@ -2,12 +2,12 @@ Account Invoice Import ====================== -.. +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:26f0853d4122605d020e48687fa420f66fdad1a6c7e41efe74059e0a845f5348 + !! source digest: sha256:9ad4e4cf38e9978675644fa8918e5dc342177d73673e9e56d469daaafe5c0cda !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -120,6 +120,7 @@ Contributors * Yannick Vaucher * Ronald Portier * Simone Orsi +* Heliconia Solutions Maintainers ~~~~~~~~~~~ @@ -140,7 +141,7 @@ promote its widespread use. Current `maintainer `__: -|maintainer-alexis-via| +|maintainer-alexis-via| This module is part of the `OCA/edi `_ project on GitHub. diff --git a/account_invoice_import/__manifest__.py b/account_invoice_import/__manifest__.py index 9cd6af1ecf..564ef8554b 100644 --- a/account_invoice_import/__manifest__.py +++ b/account_invoice_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Account Invoice Import", - "version": "14.0.3.4.0", + "version": "13.0.1.0.0", "category": "Accounting & Finance", "license": "AGPL-3", "summary": "Import supplier invoices/refunds as PDF or XML files", diff --git a/account_invoice_import/models/res_partner.py b/account_invoice_import/models/res_partner.py index fa654857f4..8d35ffe540 100644 --- a/account_invoice_import/models/res_partner.py +++ b/account_invoice_import/models/res_partner.py @@ -34,8 +34,9 @@ def _compute_invoice_import_count(self): def show_account_invoice_import_config(self): self.ensure_one() - xmlid = "account_invoice_import.account_invoice_import_config_action" - action = self.env["ir.actions.act_window"]._for_xml_id(xmlid) + action = self.env["ir.actions.act_window"].for_xml_id( + "account_invoice_import", "account_invoice_import_config_action" + ) action["context"] = { "default_name": self.name, "default_partner_id": self.id, diff --git a/account_invoice_import/readme/CONTRIBUTORS.rst b/account_invoice_import/readme/CONTRIBUTORS.rst index d3cea00716..2f95024304 100644 --- a/account_invoice_import/readme/CONTRIBUTORS.rst +++ b/account_invoice_import/readme/CONTRIBUTORS.rst @@ -4,3 +4,4 @@ * Yannick Vaucher * Ronald Portier * Simone Orsi +* Heliconia Solutions diff --git a/account_invoice_import/security/ir.model.access.csv b/account_invoice_import/security/ir.model.access.csv index b082640a84..ba1cf15311 100644 --- a/account_invoice_import/security/ir.model.access.csv +++ b/account_invoice_import/security/ir.model.access.csv @@ -1,5 +1,3 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_account_invoice_import_config_read,Read access on account.invoice.import.config to Invoicing and Payment,model_account_invoice_import_config,account.group_account_invoice,1,0,0,0 -access_account_invoice_import_config_readonly_grp,Read access on account.invoice.import.config to Account Readonly grp,model_account_invoice_import_config,account.group_account_readonly,1,0,0,0 access_account_invoice_import_config_full,Full access on account.invoice.import.config to Account Manager,model_account_invoice_import_config,account.group_account_manager,1,1,1,1 -access_account_invoice_import,Access to account.invoice.import wizard,model_account_invoice_import,account.group_account_invoice,1,1,1,1 diff --git a/account_invoice_import/static/description/index.html b/account_invoice_import/static/description/index.html index e8e2e62e3e..2ac9843a5a 100644 --- a/account_invoice_import/static/description/index.html +++ b/account_invoice_import/static/description/index.html @@ -1,3 +1,4 @@ + @@ -8,11 +9,10 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ +:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. -Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -275,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: gray; } /* line numbers */ +pre.code .ln { color: grey; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -301,7 +301,7 @@ span.pre { white-space: pre } -span.problematic, pre.problematic { +span.problematic { color: red } span.section-subtitle { @@ -367,7 +367,7 @@

Account Invoice Import

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:26f0853d4122605d020e48687fa420f66fdad1a6c7e41efe74059e0a845f5348 +!! source digest: sha256:9ad4e4cf38e9978675644fa8918e5dc342177d73673e9e56d469daaafe5c0cda !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/edi Translate me on Weblate Try me on Runboat

This module has been started by lazy accounting users who hate enter they vendor bills manually in Odoo. Almost all companies have several vendor bills to enter regularly in the system from the same vendors: phone bill, electricity bill, Internet access, train tickets, etc. Most of these invoices are available as PDF. If we are able to automatically extract from the PDF the required information to enter the invoice as vendor bill in Odoo, then this module will create it automatically. To know the full story behind the development of this module, read this blog post.

@@ -466,9 +466,7 @@

Contributors

Maintainers

This module is maintained by the OCA.

- -Odoo Community Association - +Odoo Community Association

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

diff --git a/account_invoice_import/tests/test_invoice_import.py b/account_invoice_import/tests/test_invoice_import.py index 56087a7981..6e94e711a8 100644 --- a/account_invoice_import/tests/test_invoice_import.py +++ b/account_invoice_import/tests/test_invoice_import.py @@ -220,7 +220,7 @@ def test_import_in_invoice(self): .create_invoice(parsed_inv, import_c) ) logger.debug("testing import with import config=%s", import_c) - self.assertEqual(inv.move_type, parsed_inv["type"]) + self.assertEqual(inv.type, parsed_inv["type"]) self.assertEqual(inv.company_id.id, self.company.id) self.assertFalse( inv.currency_id.compare_amounts( @@ -282,7 +282,7 @@ def test_import_in_invoice_tax_include(self): .create_invoice(parsed_inv, import_c) ) logger.debug("testing import with import config=%s", import_c) - self.assertEqual(inv.move_type, parsed_inv["type"]) + self.assertEqual(inv.type, parsed_inv["type"]) self.assertEqual(inv.company_id.id, self.company.id) self.assertFalse( inv.currency_id.compare_amounts( @@ -312,8 +312,7 @@ def test_import_out_invoice(self): "product": {"code": "AII-TEST-PRODUCT"}, "name": "Super product", "qty": 3, - "discount": 10, - "price_unit": 100, + "price_unit": 10.22, "date_start": "2017-08-01", "date_end": "2017-08-31", "taxes": [ @@ -335,10 +334,8 @@ def test_import_out_invoice(self): .with_company(self.company.id) .create_invoice(parsed_inv, import_config) ) - self.assertFalse( - inv.currency_id.compare_amounts(inv.amount_untaxed, 270.00) - ) - self.assertFalse(inv.currency_id.compare_amounts(inv.amount_total, 272.70)) + self.assertFalse(inv.currency_id.compare_amounts(inv.amount_untaxed, 30.66)) + self.assertFalse(inv.currency_id.compare_amounts(inv.amount_total, 30.97)) self.assertEqual( fields.Date.to_string(inv.invoice_date), parsed_inv["date"] ) @@ -444,7 +441,7 @@ def test_email_no_partner_match(self): move = self.env["account.move"].search( [ ("company_id", "=", self.company.id), - ("move_type", "=", "in_invoice"), + ("type", "=", "in_invoice"), ("invoice_source_email", "like", sender_email), ("state", "=", "draft"), ] @@ -461,7 +458,7 @@ def test_email_partner_no_invoice_config(self): move = self.env["account.move"].search( [ ("company_id", "=", self.company.id), - ("move_type", "=", "in_invoice"), + ("type", "=", "in_invoice"), ("partner_id", "=", self.partner_with_email.id), ("state", "=", "draft"), ] @@ -479,7 +476,7 @@ def test_email_partner_invoice_config(self): move = self.env["account.move"].search( [ ("company_id", "=", self.company.id), - ("move_type", "=", "in_invoice"), + ("type", "=", "in_invoice"), ("partner_id", "=", partner.id), ("state", "=", "draft"), ] diff --git a/account_invoice_import/views/account_invoice.xml b/account_invoice_import/views/account_invoice.xml index 0ef997087c..fdc828c2b2 100644 --- a/account_invoice_import/views/account_invoice.xml +++ b/account_invoice_import/views/account_invoice.xml @@ -15,7 +15,7 @@ name="%(account_invoice_import_action)d" string="Import Invoice File" context="{'wizard_default_state': 'update-from-invoice', 'default_invoice_id': id, 'default_partner_id': commercial_partner_id}" - attrs="{'invisible': ['|', ('move_type', 'not in', ('in_invoice', 'in_refund')), ('state', '!=', 'draft')]}" + attrs="{'invisible': ['|', ('type', 'not in', ('in_invoice', 'in_refund')), ('state', '!=', 'draft')]}" /> @@ -24,7 +24,7 @@ name="%(account_invoice_import_action)d" string="Import Next Invoice" context="{}" - attrs="{'invisible': [('move_type', 'not in', ('in_invoice', 'in_refund'))]}" + attrs="{'invisible': [('type', 'not in', ('in_invoice', 'in_refund'))]}" /> diff --git a/account_invoice_import/views/account_journal_dashboard.xml b/account_invoice_import/views/account_journal_dashboard.xml index 9a695d8fd0..cbedf5e69a 100644 --- a/account_invoice_import/views/account_journal_dashboard.xml +++ b/account_invoice_import/views/account_journal_dashboard.xml @@ -10,7 +10,7 @@