-
-
Notifications
You must be signed in to change notification settings - Fork 693
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
[16.0][MIG] account_invoice_view_payment: Migration to 16.0 #1852
base: 16.0
Are you sure you want to change the base?
[16.0][MIG] account_invoice_view_payment: Migration to 16.0 #1852
Conversation
2bc55d3
to
95d375f
Compare
Currently translated at 100,0% (5 of 5 strings) Translation: account-invoicing-11.0/account-invoicing-11.0-account_invoice_view_payment Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-11-0/account-invoicing-11-0-account_invoice_view_payment/nl_NL/
Currently translated at 100,0% (5 of 5 strings) Translation: account-invoicing-11.0/account-invoicing-11.0-account_invoice_view_payment Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-11-0/account-invoicing-11-0-account_invoice_view_payment/de/
Updated by Update PO files to match POT (msgmerge) hook in Weblate.
Currently translated at 100.0% (5 of 5 strings) Translation: account-invoicing-12.0/account-invoicing-12.0-account_invoice_view_payment Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-12-0/account-invoicing-12-0-account_invoice_view_payment/pt_BR/
Currently translated at 100.0% (5 of 5 strings) Translation: account-invoicing-15.0/account-invoicing-15.0-account_invoice_view_payment Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-15-0/account-invoicing-15-0-account_invoice_view_payment/es/
creating as many payments as invoices and it was not reconciling the invoices. The solution is to remove the Validate & View Payments button because the standard button "Create Payments" already returns the action to see the payments involved
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: account-invoicing-15.0/account-invoicing-15.0-account_invoice_view_payment Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-15-0/account-invoicing-15-0-account_invoice_view_payment/
Currently translated at 100.0% (4 of 4 strings) Translation: account-invoicing-15.0/account-invoicing-15.0-account_invoice_view_payment Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-15-0/account-invoicing-15-0-account_invoice_view_payment/pt_BR/
…ing to view payments from invoice
8afc9f6
to
099f5f2
Compare
61876fc
to
8829e37
Compare
def _get_reconciled_info_JSON_values(self): | ||
self.ensure_one() | ||
reconciled_vals = [] | ||
for move in self: | ||
if move.state == "posted" and move.is_invoice(include_receipts=True): | ||
reconciled_partials = move._get_all_reconciled_invoice_partials() | ||
for reconciled_partial in reconciled_partials: | ||
counterpart_line = reconciled_partial["aml"] | ||
if counterpart_line.move_id.ref: | ||
reconciliation_ref = "%s (%s)" % ( | ||
counterpart_line.move_id.name, | ||
counterpart_line.move_id.ref, | ||
) | ||
else: | ||
reconciliation_ref = counterpart_line.move_id.name | ||
if ( | ||
counterpart_line.amount_currency | ||
and counterpart_line.currency_id | ||
!= counterpart_line.company_id.currency_id | ||
): | ||
foreign_currency = counterpart_line.currency_id | ||
else: | ||
foreign_currency = False | ||
|
||
reconciled_vals.append( | ||
{ | ||
"name": counterpart_line.name, | ||
"journal_name": counterpart_line.journal_id.name, | ||
"amount": reconciled_partial["amount"], | ||
"currency_id": move.company_id.currency_id.id | ||
if reconciled_partial["is_exchange"] | ||
else reconciled_partial["currency"].id, | ||
"date": counterpart_line.date, | ||
"partial_id": reconciled_partial["partial_id"], | ||
"account_payment_id": counterpart_line.payment_id.id, | ||
"payment_method_name": counterpart_line.payment_id.payment_method_line_id.name, # noqa: B950 | ||
"move_id": counterpart_line.move_id.id, | ||
"ref": reconciliation_ref, | ||
# these are necessary for the views to change | ||
# depending on the values | ||
"is_exchange": reconciled_partial["is_exchange"], | ||
"amount_company_currency": formatLang( | ||
self.env, | ||
abs(counterpart_line.balance), | ||
currency_obj=counterpart_line.company_id.currency_id, | ||
), | ||
"amount_foreign_currency": foreign_currency | ||
and formatLang( | ||
self.env, | ||
abs(counterpart_line.amount_currency), | ||
currency_obj=foreign_currency, | ||
), | ||
} | ||
) | ||
return reconciled_vals |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: I don't think we should reintroduce this function. It changed name and structure slightly, but it's _compute_payments_widget_reconciled_info
in v16 and I think you should be able to use it in the same way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introduced new function as reconciled_vals is not obtainable from existing _compute_payments_widget_reconciled_info() or any other available methods in v16.
However, account_invoice_view_payment only uses payment related information hence using get_reconciled_payments method to achieve the same in order to view payments from invoices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, nice catch!
8829e37
to
c30cd58
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
everything else LGTM
payment = [] | ||
for move in self: | ||
if move._get_reconciled_payments().id: | ||
payment.append(move._get_reconciled_payments().id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: _get_reconciled_payments()
could return multiple payments, so .id
could then give a SingletonError
I've tested that _get_reconciled_payments
is safe to use on a recordset with multiple records, so:
payment = [] | |
for move in self: | |
if move._get_reconciled_payments().id: | |
payment.append(move._get_reconciled_payments().id) | |
payments = move._get_reconciled_payments().ids |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated using ids
c30cd58
to
2bfabd2
Compare
2bfabd2
to
8e4253a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review, LGTM
Migrating account_invoice_view_payment to 16.0