summaryrefslogtreecommitdiff
path: root/addons/hr_expense/models
diff options
context:
space:
mode:
authoroco-odoo <oco@odoo.com>2020-10-22 12:54:34 +0000
committeroco-odoo <oco@odoo.com>2020-10-28 12:58:34 +0000
commit2ca3158ce2de596526067dbd86da2ef7d4ae85bd (patch)
tree0c2e27892c9cb222c84dd6318996793e7d3fad0d /addons/hr_expense/models
parente78805fc3ae9b5dbbf72667e5bd62e5c5346cc53 (diff)
[FIX] account, hr_expense: show correct sign for tax_base_amounts of misc operations' lines
Before this, misc operations always used the balance of the base line as the tax_base_amount of the tax line. This was inconsistent with the invoices, for which we invert its sign when making a sale invoice or a purchase refund (as for those operations, positive amounts are put in credit). This commit should make everything behave in the same way. closes odoo/odoo#60831 X-original-commit: d8c40f07799a11a335c5010a0318d795830d125c Signed-off-by: Laurent Smet <smetl@users.noreply.github.com> Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Diffstat (limited to 'addons/hr_expense/models')
-rw-r--r--addons/hr_expense/models/hr_expense.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/addons/hr_expense/models/hr_expense.py b/addons/hr_expense/models/hr_expense.py
index e94524fd73f..0566716521e 100644
--- a/addons/hr_expense/models/hr_expense.py
+++ b/addons/hr_expense/models/hr_expense.py
@@ -441,6 +441,13 @@ Or send your receipts at <a href="mailto:%(email)s?subject=Lunch%%20with%%20cust
for tax in taxes['taxes']:
balance = expense.currency_id._convert(tax['amount'], company_currency, expense.company_id, account_date)
amount_currency = tax['amount']
+
+ if tax['tax_repartition_line_id']:
+ rep_ln = self.env['account.tax.repartition.line'].browse(tax['tax_repartition_line_id'])
+ base_amount = self.env['account.move']._get_base_amount_to_display(tax['base'], rep_ln)
+ else:
+ base_amount = None
+
move_line_tax_values = {
'name': tax['name'],
'quantity': 1,
@@ -450,7 +457,7 @@ Or send your receipts at <a href="mailto:%(email)s?subject=Lunch%%20with%%20cust
'account_id': tax['account_id'] or move_line_src['account_id'],
'tax_repartition_line_id': tax['tax_repartition_line_id'],
'tax_tag_ids': tax['tag_ids'],
- 'tax_base_amount': tax['base'],
+ 'tax_base_amount': base_amount,
'expense_id': expense.id,
'partner_id': partner_id,
'currency_id': expense.currency_id.id,