Skip to content

Commit

Permalink
fix backend name and add auto post feature (#19)
Browse files Browse the repository at this point in the history
* backend type need to be the same name as defined in xml

* Add the auto post ability and the description en the readme.
  • Loading branch information
davidwul authored and ecino committed Mar 7, 2024
1 parent 645582f commit 0224919
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions account_statement_import_sftp/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ Usage
To use this module you should configure an exchange type and a backend SFTP.
Then when the scheduled action of EDI will run you will get your statement imported automatically.

To post the statement at import create a config parameter import_statement_edi_auto_post with True as value

Bug Tracker
===========

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
# @author: Simon Gonzalez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _
from odoo.tools import str2bool

from odoo.addons.component.core import Component


class EdiBankStatementImportProcess(Component):
_name = "edi.input.process.bank.statement.import"
_usage = "input.process"
_backend_type = "bk_sftp"
_backend_type = "bk_sftp_imp"
_inherit = "edi.component.input.mixin"

def process(self):
ir_config = self.env["ir.config_parameter"].sudo()
auto_post = str2bool(ir_config.get_param("import_statement_edi_auto_post"))
statement_import = self.env["account.statement.import"].create(
[
{
Expand All @@ -27,3 +30,5 @@ def process(self):
statement = self.env["account.bank.statement"].browse(action.get("res_id"))
if not (statement.state and statement.state in ["posted", "open"]):
raise ValueError(_("The bank statement could not be validated."))
if auto_post:
statement.button_post()
2 changes: 2 additions & 0 deletions account_statement_import_sftp/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
To use this module you should configure an exchange type and a backend SFTP.
Then when the scheduled action of EDI will run you will get your statement imported automatically.

To post the statement at import create a config parameter import_statement_edi_auto_post with True as value
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<p>To use this module you should configure an exchange type and a backend SFTP.
Then when the scheduled action of EDI will run you will get your statement imported automatically.</p>
<p>To post the statement at import create a config parameter import_statement_edi_auto_post with True as value</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
Expand Down

0 comments on commit 0224919

Please sign in to comment.