diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index f8932204a15..7d6a046b851 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -349,6 +349,7 @@ class AccountMove(models.Model): invoice_outstanding_credits_debits_widget = fields.Binary( groups="account.group_account_invoice,account.group_account_readonly", compute='_compute_payments_widget_to_reconcile_info', + exportable=False, ) invoice_has_outstanding = fields.Boolean( groups="account.group_account_invoice,account.group_account_readonly", @@ -357,6 +358,7 @@ class AccountMove(models.Model): invoice_payments_widget = fields.Binary( groups="account.group_account_invoice,account.group_account_readonly", compute='_compute_payments_widget_reconciled_info', + exportable=False, ) # === Currency fields === # diff --git a/addons/account/models/account_move_line.py b/addons/account/models/account_move_line.py index 68e0784d6bf..706c21d5627 100644 --- a/addons/account/models/account_move_line.py +++ b/addons/account/models/account_move_line.py @@ -110,6 +110,7 @@ class AccountMoveLine(models.Model): string='Cumulated Balance', compute='_compute_cumulated_balance', currency_field='company_currency_id', + exportable=False, help="Cumulated balance depending on the domain and the order chosen in the view.") currency_rate = fields.Float( compute='_compute_currency_rate', @@ -1282,13 +1283,6 @@ class AccountMoveLine(models.Model): ) return super(AccountMoveLine, contextualized).search_read(domain, fields, offset, limit, order) - @api.model - def fields_get(self, allfields=None, attributes=None): - res = super().fields_get(allfields, attributes) - if res.get('cumulated_balance'): - res['cumulated_balance']['exportable'] = False - return res - def init(self): """ change index on partner_id to a multi-column index on (partner_id, ref), the new index will behave in the same way when we search on partner_id, with the addition of being optimal when having a query that will diff --git a/odoo/fields.py b/odoo/fields.py index 81c3ab7f96f..728a7e29678 100644 --- a/odoo/fields.py +++ b/odoo/fields.py @@ -306,6 +306,7 @@ class Field(MetaField('DummyField', (object,), {})): prefetch = True # the prefetch group (False means no group) default_export_compatible = False # whether the field must be exported by default in an import-compatible export + exportable = True def __init__(self, string=Default, **kwargs): kwargs['string'] = string @@ -843,6 +844,7 @@ class Field(MetaField('DummyField', (object,), {})): _description_change_default = property(attrgetter('change_default')) _description_group_operator = property(attrgetter('group_operator')) _description_default_export_compatible = property(attrgetter('default_export_compatible')) + _description_exportable = property(attrgetter('exportable')) def _description_depends(self, env): return env.registry.field_depends[self]