Skip to content

[14.0] [FW] l10n_it_ricevute_bancarie: Forward port of #2025 #2119#3437

Merged
OCA-git-bot merged 3 commits into
OCA:14.0from
PyTech-SRL:14.0-fw-riba-policy-expenses
Mar 17, 2025
Merged

[14.0] [FW] l10n_it_ricevute_bancarie: Forward port of #2025 #2119#3437
OCA-git-bot merged 3 commits into
OCA:14.0from
PyTech-SRL:14.0-fw-riba-policy-expenses

Conversation

@HekkiMelody

@HekkiMelody HekkiMelody commented Jul 6, 2023

Copy link
Copy Markdown
Contributor

Original PRs: #2025 #2119

Closes #2118

Cf: #3444

@HekkiMelody HekkiMelody force-pushed the 14.0-fw-riba-policy-expenses branch from 171c2cb to 27e23f8 Compare July 6, 2023 14:38
@HekkiMelody HekkiMelody changed the title [14.0] [FW] l10n_it_ricevute_bancarie: Forward port of #2119 [14.0] [FW] l10n_it_ricevute_bancarie: Forward port of #2025 #2119 Jul 6, 2023
@HekkiMelody HekkiMelody force-pushed the 14.0-fw-riba-policy-expenses branch 5 times, most recently from 45b2fb5 to 58a6426 Compare July 6, 2023 15:10
@HekkiMelody

Copy link
Copy Markdown
Contributor Author

Ho rotto un test ma non capisco bene come. Si accettano indicazioni.

@HekkiMelody HekkiMelody force-pushed the 14.0-fw-riba-policy-expenses branch from 58a6426 to aed6559 Compare July 6, 2023 15:20
@HekkiMelody HekkiMelody marked this pull request as draft July 6, 2023 15:59
@HekkiMelody

HekkiMelody commented Jul 6, 2023

Copy link
Copy Markdown
Contributor Author

Ho capito qual'è il problema, anche se non saprei come risolverlo:

  • la riga che viene creata, marcata come due_cost_line, ad un certo punto viene anche cancellata
  • non ci sono mai righe con due_cost_line, quindi qui si rompe

https://github.com/OCA/l10n-italy/pull/3437/files#diff-2a7ae2e3551fc197ff32b4300d47119adccfeb174722a2b974534e6952ac67aeL142-L145

move_line = self.env["account.move.line"].search(
                [("partner_id", "=", invoice.partner_id.id)]
                [
                    ("partner_id", "=", invoice.partner_id.id),
                    ("move_id.invoice_payment_term_id.riba", "=", True),
                    ("date_maturity", ">=", fields.Date.context_today(invoice)),
                ]
            )
            if not any(line.due_cost_line for line in move_line):
                move_line = self.env["account.move.line"]

Perché non trova le righe precedenti, e quindi non riesce a capire di aver già fatto pagare le Collection Fees, e quindi le aggiunge di nuovo.

In attesa di consigli/suggerimenti, per ora ho messo in draft.

@HekkiMelody HekkiMelody force-pushed the 14.0-fw-riba-policy-expenses branch from aed6559 to fa9d179 Compare July 7, 2023 07:46
@HekkiMelody

HekkiMelody commented Jul 7, 2023

Copy link
Copy Markdown
Contributor Author

Dopo molta fatica, credo di essere riuscito a trovare un fix.

.mapped("move_id.line_ids")

move_line = (
                self.env["account.move.line"]
                .search(
                    [
                        ("partner_id", "=", invoice.partner_id.id),
                        ("move_id.invoice_payment_term_id.riba", "=", True),
                        ("date_maturity", ">=", fields.Date.context_today(invoice)),
                    ]
                )
                .mapped("move_id.line_ids")
            )

sembra ridondante ma adesso il codice circostance ha molto più senso.

Il problema è che in Odoo 14 le move.line che hanno date_maturity settato non sono le stesse che hanno due_cost_line settato.

I test passano, ma non sono esperto di questi moduli, quindi chiedo validazione da qualcuno più pratico di me, in fase di review, che si comporti come dovrebbe., grazie 🙏

("date_maturity", ">=", fields.Date.context_today(invoice)),
]
)
.mapped("move_id.line_ids")

@sergiocorato sergiocorato Mar 8, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Vuoi provare a rimuovere questa riga .mapped("move_id.line_ids") e vedere che errore dà?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sergiocorato stiamo portando la PR alla 16 ed abbiamo corretto quello che segnalavi sotto (self -> invoice), però non capisco perchè vorresti rimuovere mapped

@francesco-ooops francesco-ooops Mar 11, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@odooNextev è chiaro il problema indicato in #3437 (comment) ?

Senza questo fix si rompe qualche test?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ad essere sincero non molto, ma l'ultima versione pubblicata da @aleuffre che ho portato anche alla 16.0 funzionalmente è ok e non da errori nei test

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sergiocorato se ci puoi dare un input, siamo due aziende che necessitano questa funzionalità. Grazie!

@HekkiMelody HekkiMelody Mar 13, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Rileggendo il codice e il mio commento di quasi 2 anni fa, il problema era questo

 self.env["account.move.line"]
                .search(
                    [
                        ("partner_id", "=", invoice.partner_id.id),
                        ("move_id.invoice_payment_term_id.riba", "=", True),
                        ("date_maturity", ">=", fields.Date.context_today(invoice)),
                    ]
                )

Faccio una ricerca sulle move lines con una certa date_maturity

if not any(line.due_cost_line for line in move_line):
                move_line = self.env["account.move.line"]

Se nessuna delle righe ha due_cost_line, scarto tutte le righe trovate

Ma, in Odoo 14, le righe che hanno date_maturity (primo punto) e le righe che hanno settato due_cost_line (secondo punto) sono righe diverse. Quindi il secondo punto fallirebbe sempre, e verrebbe creata sempre una nuova riga per le collection_fees (perché non viene mai trovata quella precedente a cui aggiungere)

con quel mapped io invece prendo tutte le righe collegate alla fattura. Ho provato a spostare il mapped direttamente dentro l'any, dovrebbe essere più pulito ed avere lo stesso effetto. Si può provare di nuovo? Grazie

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@odooNextev @sergiocorato se confermate mergiamo

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@francesco-ooops l'ho ritestato ed è OK
Domani cerchiamo di portare anche quest'ultima correzione nella PR della 16

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@odooNextev ottimo, se possibile mergiamo questa nella call di domani e poi fate un porting paro paro

Comment thread l10n_it_ricevute_bancarie/models/account.py Outdated
@github-actions

Copy link
Copy Markdown

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions Bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Jul 14, 2024
@SirAionTech SirAionTech removed their request for review July 25, 2024 11:08
@github-actions github-actions Bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Jul 28, 2024
@github-actions

github-actions Bot commented Dec 1, 2024

Copy link
Copy Markdown

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions Bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Dec 1, 2024
@SirAionTech SirAionTech added the is porting This pull request is porting a change from another version label Dec 2, 2024
@HekkiMelody HekkiMelody force-pushed the 14.0-fw-riba-policy-expenses branch from 717194c to 46c29c3 Compare March 13, 2025 12:11
@HekkiMelody HekkiMelody force-pushed the 14.0-fw-riba-policy-expenses branch from 46c29c3 to f853000 Compare March 13, 2025 13:56

@francesco-ooops francesco-ooops left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Funzionale ok

@francesco-ooops

Copy link
Copy Markdown
Contributor

@OCA/local-italy-maintainers si può andare?

@francesco-ooops

Copy link
Copy Markdown
Contributor

@sergiocorato ping

@sergiocorato sergiocorato left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Non mi è chiaro perché ci sono 3 commit

@francesco-ooops

Copy link
Copy Markdown
Contributor

Non mi è chiaro perché ci sono 3 commit

@sergiocorato penso siano quelli necessari da migrare da

https://github.com/OCA/l10n-italy/pull/2025/commits e https://github.com/OCA/l10n-italy/pull/2119/commits , sbaglio?

@sergiocorato

Copy link
Copy Markdown
Contributor

@francesco-ooops ottimo, grazie
/ocabot merge minor

@OCA-git-bot

Copy link
Copy Markdown
Contributor

On my way to merge this fine PR!
Prepared branch 14.0-ocabot-merge-pr-3437-by-sergiocorato-bump-minor, awaiting test results.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

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 OCA-git-bot merged commit 888263c into OCA:14.0 Mar 17, 2025
@OCA-git-bot

Copy link
Copy Markdown
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

14.0 approved is porting This pull request is porting a change from another version merged 🎉 ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

l10n_it_riba: generazione riga costi di incasso Miglioria RIBA - Politica di addebito spese d'incasso

8 participants