Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] account: invoice document layout IBAN #163565

Closed

Conversation

hupo-odoo
Copy link
Contributor

Step to reproduce:

  • Select a company that has not yet sent invoice (create one if needed)
  • Create an invoice and press "Send and Print"
  • => The wizard to configure your first invoice pops up
  • Press the button "QR Code"
  • Enter a random IBAN
  • ==> Traceback stating that "Invalid field 'account_number' on model 'res.partner.bank'"

Issue introduced in this commit: 45d924b

task-id: 3893654


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@robodoo
Copy link
Contributor

robodoo commented Apr 26, 2024

@C3POdoo C3POdoo added the RD research & development, internal work label Apr 26, 2024
Copy link
Contributor

@malb-odoo malb-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks for the fix !
@william-andre ready for your review 😄 (not tested by a po yet but should be good)

@@ -66,7 +66,7 @@ def _inverse_account_number(self):
elif record.account_number:
record.partner_id.bank_ids = [
Command.create({
'account_number': record.account_number,
'acc_number': record.account_number,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if branch will change the account number of all the banks if there are multiple

Why don't we do anything if there is not qr_code? That seems like a very hidden behavior.
If somehow the field becomes shown without a qr_code, I would expect the behavior to be the same.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed maybe it should only change the account number of the first one 🤔, maybe we can just do record.partner_id.bank_ids[0].acc_number in the line 65.

When coming from an invoice the configure layout has an extra step which is the possibility to change the setting for the qr_code. When selected and only when selected the acc_number field appears and we have the possibility to change it. It was a spec of @chklop, maybe he has some more insight on this ?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not change all current account numbers by the one provided indeed.
The Bank account number field is not useful here if we don't activate QR-code, so it's logical it's not displayed nor used if the "activate QR codes" is not ticked on that wizard. The two are indeed linked.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We won't change anything if there is no number set (already managed by the code)
And if there is a number set just find it weird to have tho read qr_code in the inverse function of account_number when the computation field doesn't depend on it: it's a code smell.

Copy link
Contributor Author

@hupo-odoo hupo-odoo Apr 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. I changed to only change the first account number

Edit: And removed the if condition on the QR code

@hupo-odoo hupo-odoo force-pushed the master-invoice_layout_qrcode_fix-hupo branch from fdd271a to 6be55d3 Compare April 29, 2024 09:16
Copy link
Contributor

@william-andre william-andre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, not changing the qr_code because it is only a minor thing and not related to this bug...
@robodoo r+

Step to reproduce:
 - Select a company that has not yet sent invoice (create one if needed)
 - Create an invoice and press "Send and Print"
 - => The wizard to configure your first invoice pops up
 - Press the button "QR Code"
 - Enter a random IBAN
 - ==> Traceback stating that "Invalid field 'account_number' on model 'res.partner.bank'"

 Issue introduced in this commit: odoo@45d924b

task-id: 3893654
@hupo-odoo hupo-odoo force-pushed the master-invoice_layout_qrcode_fix-hupo branch from 6be55d3 to cb9a363 Compare April 29, 2024 09:29
@hupo-odoo
Copy link
Contributor Author

hupo-odoo commented Apr 29, 2024

Ok, not changing the qr_code because it is only a minor thing and not related to this bug... @robodoo r+

Sorry, I pushed at the same time of r+ and removed the if condition on the qr_code. Hope it's ok
Edit: We might need a new r+ because I think it cancelled the first one

@william-andre
Copy link
Contributor

@robodoo r+

No worries 😊

robodoo pushed a commit that referenced this pull request Apr 30, 2024
Step to reproduce:
 - Select a company that has not yet sent invoice (create one if needed)
 - Create an invoice and press "Send and Print"
 - => The wizard to configure your first invoice pops up
 - Press the button "QR Code"
 - Enter a random IBAN
 - ==> Traceback stating that "Invalid field 'account_number' on model 'res.partner.bank'"

 Issue introduced in this commit: 45d924b

closes #163565

Task-id: 3893654
Signed-off-by: William André (wan) <wan@odoo.com>
@robodoo robodoo closed this Apr 30, 2024
@robodoo robodoo added the 17.3 label Apr 30, 2024
@fw-bot fw-bot deleted the master-invoice_layout_qrcode_fix-hupo branch May 14, 2024 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
17.3 RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants