2
0
account-financial-tools/account_chart_update/model/account_tax_code.py
Pedro M. Baeza bc483a106f [IMP] account_chart_update: Whole refactoring
* Fix calculated field when showing inactives + add field to view
* Migrated to new API.
* Provided hooks for detecting changes and for adding update/create values.
* Purge dead error detection code (not applying).
* Use global mapping dictionaries stored on class instead of passing arguments down to top and viceversa.
* Number fields computed by a function field instead of being computed by hand.
* Use recordsets as indexes instead of ids to avoid repetitive browses.
* Re-enable local cache variables
* README + authors
2023-01-17 08:54:49 +01:00

38 lines
1.5 KiB
Python

# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2014 ACSONE SA/NV (http://acsone.eu)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import models, fields
class AccountTaxCode(models.Model):
_inherit = 'account.tax.code'
active = fields.Boolean('Active', default=True)
def _sum(self, cr, uid, ids, name, args, context, where='',
where_params=()):
try:
return super(AccountTaxCode, self)._sum(
cr, uid, ids, name, args, context, where=where,
where_params=where_params)
except:
cr.rollback()
return dict.fromkeys(ids, 0.0)