Skip to content

Commit

Permalink
Add button to import invoice in journal dashboard
Browse files Browse the repository at this point in the history
Improve README of account_invoice_download_weboob
Fix mail gateway in multi-company environment
  • Loading branch information
alexis-via authored and Alexis de Lattre committed Oct 30, 2018
1 parent 91b6264 commit 0cc07e1
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
8 changes: 7 additions & 1 deletion account_invoice_download_weboob/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This module adds a weboob backend to the *account_invoice_download* module. `Web
Installation
============

Install the weboob library:
Install the weboob library (TODO: check that it works with the stable version weboob 1.3 and not just the development version weboob 1.4):

.. code::
Expand All @@ -23,6 +23,12 @@ Some Weboob modules require additionnal Python libraries. For example, the `Webo
sudo pip install python-jose
Weboob requires `MuPDF <https://mupdf.com/>`_. If you use Debian/Ubuntu, run:

.. code::
sudo apt install mupdf-tools
Configuration
=============

Expand Down
1 change: 1 addition & 0 deletions account_invoice_import/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'wizard/account_invoice_import_view.xml',
'views/account_invoice.xml',
'views/partner.xml',
'views/account_journal_dashboard.xml',
],
'images': ['images/sshot-wizard1.png'],
'installable': True,
Expand Down
33 changes: 33 additions & 0 deletions account_invoice_import/views/account_journal_dashboard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 Akretion France
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->

<odoo>


<record id="account_journal_dashboard_kanban_view" model="ir.ui.view">
<field name="name">account_invoice_import.journal.dashboard</field>
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.account_journal_dashboard_kanban_view"/>
<field name="arch" type="xml">
<xpath expr="//t[@t-name='JournalBodySalePurchase']/div" position="inside">
<t t-if="journal_type == 'purchase'">
<br/>
<button type="action" name="%(account_invoice_import_action)d" class="btn btn-primary btn-sm">
<span>Import Bill</span>
</button>
</t>
</xpath>
<xpath expr="//t[@t-name='JournalManage']//div[@class='col-xs-4 o_kanban_card_manage_section o_kanban_manage_new']//a[@name='action_create_new']" position="inside">
<a type="action" name="%(account_invoice_import_action)d">
<span t-if="journal_type == 'purchase'">Import Bill</span>
</a>
</xpath>
</field>
</record>


</odoo>
7 changes: 4 additions & 3 deletions account_invoice_import/wizard/account_invoice_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ def message_new(self, msg_dict, custom_values=None):
'invoice_import_email of the companies of this DB was '
'not found as destination of this email (to: %s, cc: %s). '
'Ignoring this email.',
msg_dict['email_to'], msg_dict['cc'])
msg_dict.get('email_to'), msg_dict.get('cc'))
return
else: # mono-company setup
company_id = all_companies[0]['id']
Expand Down Expand Up @@ -1016,13 +1016,14 @@ def message_new(self, msg_dict, custom_values=None):
existing_inv.id, existing_inv.number,
parsed_inv.get('invoice_number'))
continue
import_configs = aiico.search([
import_configs = aiico.sudo().search([
('partner_id', '=', partner.id),
('company_id', '=', company_id)])
if not import_configs:
logger.warning(
"Mail import: missing Invoice Import Configuration "
"for partner '%s'.", partner.display_name)
"for partner '%s' ID %d.",
partner.display_name, partner.id)
continue
elif len(import_configs) == 1:
import_config = import_configs.convert_to_import_config()
Expand Down

0 comments on commit 0cc07e1

Please sign in to comment.