OCA / account-financial-tools

Odoo Accountant Financial Tools and Utils
GNU Affero General Public License v3.0
298 stars 739 forks source link

account_move_template error V.17 #1891

Open C2dricLeroy opened 1 month ago

C2dricLeroy commented 1 month ago

Module

account_move_template

Describe the bug

Error while using wizard.

To Reproduce

Odoo v17, V17 module from there

Steps to reproduce the behavior:

  1. Create a template
  2. Open "Accounting / Actions" --> "Create Entry From Template"
  3. Fill the field until pressing "Create Journal Entry"

Expected behavior The module should create a Jouyrnal Entry from the template.

Error

File "/opt/odoo/extra_addons/account_move_template/wizard/account_move_template_run.py", line 213, in _prepare_move_line
    pterm_list = line.payment_term_id.compute(value=1, date_ref=self.date)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'account.payment.term' object has no attribute 'compute'
File "/opt/odoo/extra_addons/account_move_template/wizard/account_move_template_run.py", line 213, in _prepare_move_line
    pterm_list = line.payment_term_id.compute(value=1, date_ref=self.date)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'account.payment.term' object has no attribute 'compute'

You can find this line in account_move_template_run.py line213.

Since this commit Odoo change the .compute method.

Moreover, later in the code there is a weird thing. The tax_repartition string is set and then a search is perform.

            atrl_ids = self.env["account.tax.repartition.line"].search(
                [
                    (tax_repartition, "in", line.tax_ids.ids),
                    ("repartition_type", "=", "base"),
                ]
            )

This result to ```("invoice_tax_id", "in", [5]) in my case

C2dricLeroy commented 1 month ago

Code correction is here, I will try to work on unit tests.