-
-
Notifications
You must be signed in to change notification settings - Fork 306
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] FIX l10n_it_reverse_charge avoiding extra "exchange difference" entry #3879
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -190,15 +190,20 @@ def rc_payment_vals(self, rc_type): | |||||
"date": self.date, | ||||||
} | ||||||
|
||||||
def _rc_line_values(self, account, credit, debit): | ||||||
def _rc_line_values(self, account, credit, debit, line_amount_currency=None): | ||||||
"""Base Values for the RC Payment Move lines.""" | ||||||
return { | ||||||
values = { | ||||||
"name": self.name, | ||||||
"credit": credit, | ||||||
"debit": debit, | ||||||
"account_id": account.id, | ||||||
"currency_id": self.currency_id.id, | ||||||
} | ||||||
if line_amount_currency: | ||||||
sign = 1 if debit else -1 | ||||||
amount_currency = abs(line_amount_currency) * sign | ||||||
values["amount_currency"] = amount_currency | ||||||
return values | ||||||
|
||||||
def _rc_credit_line_amounts(self, amount): | ||||||
if self.is_inbound(): | ||||||
|
@@ -221,7 +226,9 @@ def rc_payment_credit_line_vals(self, line_to_reconcile): | |||||
) | ||||||
account = line_to_reconcile.account_id | ||||||
|
||||||
line_values = self._rc_line_values(account, credit, debit) | ||||||
line_values = self._rc_line_values( | ||||||
account, credit, debit, line_to_reconcile.amount_currency | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Qui e sotto, penso sia meglio
Suggested change
Così se vengono aggiunti altri |
||||||
) | ||||||
line_values.update( | ||||||
{ | ||||||
"partner_id": self.partner_id.id, | ||||||
|
@@ -235,16 +242,20 @@ def rc_payment_debit_line_vals(self, line_to_reconcile, account): | |||||
abs(line_to_reconcile.balance), | ||||||
) | ||||||
|
||||||
line_values = self._rc_line_values(account, credit, debit) | ||||||
line_values = self._rc_line_values( | ||||||
account, credit, debit, line_to_reconcile.amount_currency | ||||||
) | ||||||
return line_values | ||||||
|
||||||
def rc_credit_line_vals(self, account, amount): | ||||||
credit, debit = self._rc_credit_line_amounts(amount) | ||||||
return self._rc_line_values(account, credit, debit) | ||||||
|
||||||
def rc_debit_line_vals(self, account, amount): | ||||||
def rc_debit_line_vals(self, account, amount, line_amount_currency=None): | ||||||
credit, debit = self._rc_debit_line_amounts(amount) | ||||||
line_values = self._rc_line_values(account, credit, debit) | ||||||
line_values = self._rc_line_values( | ||||||
account, credit, debit, line_amount_currency=line_amount_currency | ||||||
) | ||||||
line_values.update( | ||||||
{ | ||||||
"partner_id": self.partner_id.id, | ||||||
|
@@ -269,6 +280,7 @@ def _prepare_rc_supplier_invoice_payment(self, rc_invoice, rc_type): | |||||
payment_debit_line_data = self.rc_debit_line_vals( | ||||||
line_to_reconcile.account_id, | ||||||
payment_credit_line_data["credit"], | ||||||
payment_credit_line_data.get("amount_currency"), | ||||||
) | ||||||
rc_payment_data["line_ids"] = [ | ||||||
(0, 0, payment_debit_line_data), | ||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@eLBati la differenza (secondo me) sostanziale tra la mia e la tua PR è nel metodo
compute_rc_amount_tax_main_currency
perchè mi tengo da parte il valore della fattura originale per evitare una conversione di un valore già convertito e quindi possibili errori di arrotondamenti:https://github.com/OCA/l10n-italy/pull/4238/files#diff-3c6a29bf7c09821dd6605e9b9c729ab09d0c83b13505138134c227b0b202ac2dR184
Per il resto sono molto simili e posso pensare di aggiungere un test