[FIX] account,purchase,sale: Export fail when dict passed to write function

A `TypeError` traceback that occurs in `xlsxwriter.worksheet._write`
was caught by Sentry.

The problem is that there is a binary field which is used by `account`
module as a compute field with a python `dict`.

https://github.com/odoo/odoo/blob/76a640d05a350840bdde1c88bd052251aabd6b12/addons/account/models/account_move.py#L426-L431

https://github.com/odoo/odoo/blob/a542cb3b3d1232f0e2dec58a220a4b35fb76cc7f/addons/l10n_cl/models/account_move.py#L148-L163

Variables of type dict were not supported by the exporter, the solution
is to use a fix already made before in 16.0 (https://github.com/odoo/odoo/pull/105043)
by making `tax_totals` non-exportable

opw-3086746

closes odoo/odoo#107386

X-original-commit: f1ad538ba2a45b510b3dda792e39bc7593ba81b5
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
Signed-off-by: Achraf <abz@odoo.com>
This commit is contained in:
Achraf (abz)
2022-12-07 15:32:12 +01:00
parent eccc308f18
commit 9a713ee70d
3 changed files with 3 additions and 2 deletions
+1
View File
@@ -428,6 +428,7 @@ class AccountMove(models.Model):
compute='_compute_tax_totals',
inverse='_inverse_tax_totals',
help='Edit Tax amounts if you encounter rounding issues.',
exportable=False,
)
payment_state = fields.Selection(
selection=[
+1 -1
View File
@@ -110,7 +110,7 @@ class PurchaseOrder(models.Model):
date_calendar_start = fields.Datetime(compute='_compute_date_calendar_start', readonly=True, store=True)
amount_untaxed = fields.Monetary(string='Untaxed Amount', store=True, readonly=True, compute='_amount_all', tracking=True)
tax_totals = fields.Binary(compute='_compute_tax_totals')
tax_totals = fields.Binary(compute='_compute_tax_totals', exportable=False)
amount_tax = fields.Monetary(string='Taxes', store=True, readonly=True, compute='_amount_all')
amount_total = fields.Monetary(string='Total', store=True, readonly=True, compute='_amount_all')
+1 -1
View File
@@ -276,7 +276,7 @@ class SaleOrder(models.Model):
compute='_compute_tax_country_id',
# Avoid access error on fiscal position when reading a sale order with company != user.company_ids
compute_sudo=True) # used to filter available taxes depending on the fiscal country and position
tax_totals = fields.Binary(compute='_compute_tax_totals')
tax_totals = fields.Binary(compute='_compute_tax_totals', exportable=False)
terms_type = fields.Selection(related='company_id.terms_type')
type_name = fields.Char(string="Type Name", compute='_compute_type_name')