bank-statement-import icon indicating copy to clipboard operation
bank-statement-import copied to clipboard

[14.0][ADD] account_statement_import_base and account_statement_import_file_reconciliation_widget

Open alexis-via opened this issue 2 years ago • 13 comments

The 2 modules account_statement_import_online and account_statement_import depend on account_statement_import_base (and not on each other) and share common code, in particular a hook to update the statement line. So we can now have reconciliation modules that use this hook and therefore work both on file import and online import. More details on https://github.com/OCA/bank-statement-import/issues/481.

Improve bank statement line form view and journal form view.

I still have to write the migration script for online_raw_data -> raw_data (If we are ok to rename this field and move it to the base module).

alexis-via avatar Aug 07 '22 22:08 alexis-via

Hi @alexey-pelykh, some modules you are maintaining are being modified, check this out!

OCA-git-bot avatar Aug 07 '22 22:08 OCA-git-bot

Travis error seems unrelated.

alexis-via avatar Aug 07 '22 22:08 alexis-via

Sorry, but I don't agree on this refactoring adding more complexity on the module dependency with not too much added value.

pedrobaeza avatar Aug 07 '22 23:08 pedrobaeza

@alexis-via you should rebase once https://github.com/OCA/bank-statement-import/pull/483 is merged

alexey-pelykh avatar Aug 08 '22 06:08 alexey-pelykh

@pedrobaeza I implemented what has been discussed in #481, so this refactoring is not a surprise.

IMHO this refactoring fixes the dependency: there was NO reason for account_statement_import_online to depend on account_statement_import. This refactoring fixes this.

The BIG advantage of this refactoring is that we can now have reconciliation modules that work BOTH on file import and online import. It should have been the case long ago, but it was unfortunately not the case until now. I made sure that reconciliation modules that inherited _complete_stmts_vals() from account_statement_import or _get_statement_filtered_lines() from account_statement_import_online will continue to work, because I didn't change the prototype of those methods.

What I can propose to simplify the refactoring: I can avoid the rename of the field online_raw_data to raw_data and the move of the field definition from account_statement_import_online to account_statement_import_base. That would simplify the refactoring while keeping the real advantage for the users (and we'll be able to move+rename this field in v16 for example).

alexis-via avatar Aug 08 '22 07:08 alexis-via

@alexey-pelykh I made the rebase

alexis-via avatar Aug 08 '22 07:08 alexis-via

@alexis-via

account_statement_import (LGPL-3) depends on account_statement_import_base (AGPL-3)

this will have to be sorted out

alexey-pelykh avatar Aug 09 '22 05:08 alexey-pelykh

@alexey-pelykh I fixed the licence issue. account_statement_import_base is now LGPL.

alexis-via avatar Aug 09 '22 08:08 alexis-via

I also added a module account_statement_import_file_reconciliation_widget which is a glue auto-install module between account_statement_import and account_reconciliation_widget. It adds a button "Import and Start to Reconcile" on the wizard that allows to import and jump directly to the reconciliation interface. The associated code was moved from account_statement_import (it was present in this module but never called) to account_statement_import_file_reconciliation_widget.

bank_statement_import_start_reconcile

If you use the version of account_reconciliation_widget from the PR https://github.com/OCA/account-reconcile/pull/487 where I fixed the notifications, when you click on the new button "Import and Start to Reconcile", you will see the warning message when importing an OFX file where some statement lines were already present in Odoo:

bank_statement_v14-notifications

alexis-via avatar Aug 09 '22 22:08 alexis-via

Tests are red because "account_statement_import_file_reconciliation_widget (Mature) depends on account_reconciliation_widget (Beta)".

I made a PR to switch account_reconciliation_widget to mature https://github.com/OCA/account-reconcile/pull/491 If the PR is not accepted, I'll flag account_statement_import_file_reconciliation_widget to beta.

alexis-via avatar Aug 10 '22 08:08 alexis-via

Tests are green again (I removed the mature flag from account_statement_import_file_reconciliation_widget).

alexis-via avatar Aug 10 '22 10:08 alexis-via

Statement line form view

Before the PR:

before-PR

Scary, isnt' it ?

After PR:

  1. first tab:

after_first_tab

  1. second tab:

after-second_tab

I re-organised the form view of account.bank.statement.line because I thought that the form view defined in the "account" module was really too bad and it required a re-organisation.

alexis-via avatar Aug 10 '22 19:08 alexis-via

But, if the reviewers are against the re-organisation of the bank statement form view, I'll leave the ugly view as-is in OCA (and I'll improve it in one of my modules).

alexis-via avatar Aug 10 '22 19:08 alexis-via

But, if the reviewers are against the re-organisation of the bank statement form view, I'll leave the ugly view as-is in OCA (and I'll improve it in one of my modules).

For What It's worth, I like the improved view.

bosd avatar Aug 22 '22 10:08 bosd

I tested this new proposal and I think this is a good way to go (to keep in sync file on sync import) ! thanks @alexis-via

Note: I prefer the new bank statement line form, simplier to use for non technical user and technical data accessible if needed !

njeudy avatar Aug 24 '22 10:08 njeudy

I also like the new view much more. But if it would be blocking to add the notebook, an alternative might be to only show the technical data in debug / technical mode.

NL66278 avatar Sep 16 '22 07:09 NL66278

@NL66278 Sorry for the delay; the migration script is provided now

alexis-via avatar Sep 27 '22 21:09 alexis-via

I think we are ready to merge now. @pedrobaeza are you ok with the modification of the view ? The other reviewers were positive about the new form view of statement lines.

alexis-via avatar Sep 28 '22 08:09 alexis-via

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

OCA-git-bot avatar Sep 28 '22 12:09 OCA-git-bot

/ocabot merge nobump

alexis-via avatar Sep 29 '22 20:09 alexis-via

Hey, thanks for contributing! Proceeding to merge this for you. Prepared branch 14.0-ocabot-merge-pr-482-by-alexis-via-bump-nobump, awaiting test results.

OCA-git-bot avatar Sep 29 '22 20:09 OCA-git-bot

@alexis-via The merge process could not be finalized, because command oca-gen-addon-readme --org-name OCA --repo-name bank-statement-import --branch 14.0 --addons-dir /tmp/tmpeu98gkyc --commit failed with output:

/tmp/tmpeu98gkyc/account_statement_import_file_reconciliation_widget/README.rst:3: (WARNING/2) Duplicate explicit target name: "oca/bank-statement-import".
Traceback (most recent call last):
  File "/usr/local/bin/oca-gen-addon-readme", line 11, in <module>
    load_entry_point('oca-maintainers-tools', 'console_scripts', 'oca-gen-addon-readme')()
  File "/ocamt-readme/lib/python3.8/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/ocamt-readme/lib/python3.8/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/ocamt-readme/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/ocamt-readme/lib/python3.8/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/ocamt-readme/src/oca-maintainers-tools/tools/gen_addon_readme.py", line 312, in gen_addon_readme
    check_rst(readme_filename)
  File "/ocamt-readme/src/oca-maintainers-tools/tools/gen_addon_readme.py", line 239, in check_rst
    publish_file(
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/core.py", line 370, in publish_file
    output, pub = publish_programmatically(
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/core.py", line 664, in publish_programmatically
    output = pub.publish(enable_exit_status=enable_exit_status)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/core.py", line 216, in publish
    self.document = self.reader.read(self.source, self.parser,
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/readers/__init__.py", line 71, in read
    self.parse()
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/readers/__init__.py", line 77, in parse
    self.parser.parse(self.input, document)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/__init__.py", line 191, in parse
    self.statemachine.run(inputlines, document, inliner=self.inliner)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 170, in run
    results = StateMachineWS.run(self, input_lines, input_offset,
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/statemachine.py", line 238, in run
    context, next_state, result = self.check_line(
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/statemachine.py", line 460, in check_line
    return method(match, context, next_state)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 3007, in text
    self.section(title.lstrip(), source, style, lineno + 1, messages)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 327, in section
    self.new_subsection(title, lineno, messages)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 393, in new_subsection
    newabsoffset = self.nested_parse(
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 281, in nested_parse
    state_machine.run(block, input_offset, memo=self.memo,
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 196, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/statemachine.py", line 238, in run
    context, next_state, result = self.check_line(
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/statemachine.py", line 460, in check_line
    return method(match, context, next_state)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 2771, in underline
    self.section(title, source, style, lineno - 1, messages)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 327, in section
    self.new_subsection(title, lineno, messages)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 393, in new_subsection
    newabsoffset = self.nested_parse(
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 281, in nested_parse
    state_machine.run(block, input_offset, memo=self.memo,
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 196, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/statemachine.py", line 238, in run
    context, next_state, result = self.check_line(
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/statemachine.py", line 460, in check_line
    return method(match, context, next_state)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 2771, in underline
    self.section(title, source, style, lineno - 1, messages)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 327, in section
    self.new_subsection(title, lineno, messages)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 393, in new_subsection
    newabsoffset = self.nested_parse(
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 281, in nested_parse
    state_machine.run(block, input_offset, memo=self.memo,
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 196, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/statemachine.py", line 238, in run
    context, next_state, result = self.check_line(
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/statemachine.py", line 460, in check_line
    return method(match, context, next_state)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 2705, in blank
    paragraph, literalnext = self.paragraph(
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 418, in paragraph
    textnodes, messages = self.inline_text(text, lineno)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 427, in inline_text
    nodes, messages = self.inliner.parse(text, lineno,
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 646, in parse
    before, inlines, remaining, sysmessages = method(self, match,
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 786, in interpreted_or_phrase_ref
    return self.phrase_ref(string[:matchstart], string[textend:],
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 860, in phrase_ref
    self.document.note_explicit_target(target, self.parent)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/nodes.py", line 1409, in note_explicit_target
    self.set_name_id_map(target, id, msgnode, explicit=True)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/nodes.py", line 1352, in set_name_id_map
    self.set_duplicate_name_id(node, id, name, msgnode, explicit)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/nodes.py", line 1375, in set_duplicate_name_id
    msg = self.reporter.system_message(
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/utils/__init__.py", line 195, in system_message
    raise SystemMessage(msg, level)
docutils.utils.SystemMessage: /tmp/tmpeu98gkyc/account_statement_import_file_reconciliation_widget/README.rst:3: (WARNING/2) Duplicate explicit target name: "oca/bank-statement-import".

OCA-git-bot avatar Sep 29 '22 21:09 OCA-git-bot

/ocabot merge nobump

alexis-via avatar Sep 29 '22 21:09 alexis-via

What a great day to merge this nice PR. Let's do it! Prepared branch 14.0-ocabot-merge-pr-482-by-alexis-via-bump-nobump, awaiting test results.

OCA-git-bot avatar Sep 29 '22 21:09 OCA-git-bot

Congratulations, your PR was merged at 80088584bcbeec014f45e01bb645bece4e4d128c. Thanks a lot for contributing to OCA. ❤️

OCA-git-bot avatar Sep 29 '22 21:09 OCA-git-bot