[REF] multi: replace logging .warn( with .warning(

This commit is contained in:
Jared Kipe
2022-01-11 12:54:14 -08:00
parent 3f36f96d0f
commit 4216ff5f44
7 changed files with 24 additions and 24 deletions

View File

@@ -31,7 +31,7 @@ def admin_auth_generate_login(env, user):
base_url = str(config.search([('key', '=', 'web.base.url')], limit=1).value)
_logger.warn('login url for user id: ' + u + ' original user id: ' + o)
_logger.warning('login url for user id: ' + u + ' original user id: ' + o)
return base_url + '/auth_admin?u=' + u + '&e=' + e + '&o=' + o + '&h=' + h.hexdigest()
@@ -86,7 +86,7 @@ class ResUsers(models.Model):
return super(ResUsers, self)._check_credentials(password, env)
except exceptions.AccessDenied:
if request and hasattr(request, 'session') and request.session.get('auth_admin'):
_logger.warn('_check_credentials for user id: ' + \
_logger.warning('_check_credentials for user id: ' + \
str(request.session.uid) + ' original user id: ' + str(request.session.auth_admin))
else:
raise

View File

@@ -407,7 +407,7 @@ class ProviderGSO(models.Model):
try:
result = service.get_rates_and_transit_time(request_body)
# _logger.warn('GSO result:\n%s' % result)
# _logger.warning('GSO result:\n%s' % result)
except HTTPError as e:
_logger.error(e)
return [{

View File

@@ -418,7 +418,7 @@ class ProviderStamps(models.Model):
customs=customs)
package_labels.append((txn_id, label))
except WebFault as e:
_logger.warn(e)
_logger.warning(e)
if package_labels:
for name, label in package_labels:
body = _(u'Cancelling due to error: ', label.TrackingNumber)

View File

@@ -207,7 +207,7 @@ def ee_us_941_fit(payslip, categories, worked_days, inputs):
if not wage:
return 0.0, 0.0
#_logger.warn('initial gross wage: ' + str(wage))
#_logger.warning('initial gross wage: ' + str(wage))
year = payslip.dict.get_year()
if year >= 2020:
# Large changes in Federal Income Tax in 2020 and the W4
@@ -220,26 +220,26 @@ def ee_us_941_fit(payslip, categories, worked_days, inputs):
if is_nra:
nra_table = payslip.rule_parameter('fed_941_fit_nra_additional')
working_wage += nra_table.get(schedule_pay, 0.0)
#_logger.warn(' is_nrm after wage: ' + str(working_wage))
#_logger.warning(' is_nrm after wage: ' + str(working_wage))
pay_periods = payslip.dict.get_pay_periods_in_year()
wage_annual = pay_periods * working_wage
#_logger.warn('annual wage: ' + str(wage_annual))
#_logger.warning('annual wage: ' + str(wage_annual))
wage_annual += payslip.contract_id.us_payroll_config_value('fed_941_fit_w4_other_income')
#_logger.warn(' after other income: ' + str(wage_annual))
#_logger.warning(' after other income: ' + str(wage_annual))
deductions = payslip.contract_id.us_payroll_config_value('fed_941_fit_w4_deductions')
#_logger.warn('deductions from W4: ' + str(deductions))
#_logger.warning('deductions from W4: ' + str(deductions))
higher_rate_type = payslip.contract_id.us_payroll_config_value('fed_941_fit_w4_multiple_jobs_higher')
if not higher_rate_type:
deductions += 12900.0 if filing_status == 'married' else 8600.0
#_logger.warn(' deductions after standard deduction: ' + str(deductions))
#_logger.warning(' deductions after standard deduction: ' + str(deductions))
adjusted_wage_annual = wage_annual - deductions
if adjusted_wage_annual < 0.0:
adjusted_wage_annual = 0.0
#_logger.warn('adusted annual wage: ' + str(adjusted_wage_annual))
#_logger.warning('adusted annual wage: ' + str(adjusted_wage_annual))
# Step 2
if filing_status == 'single':
@@ -264,23 +264,23 @@ def ee_us_941_fit(payslip, categories, worked_days, inputs):
break
wage_threshold, base_withholding_amount, marginal_rate = selected_row
#_logger.warn(' selected row: ' + str(selected_row))
#_logger.warning(' selected row: ' + str(selected_row))
working_wage = adjusted_wage_annual - wage_threshold
tentative_withholding_amount = (working_wage * marginal_rate) + base_withholding_amount
tentative_withholding_amount = tentative_withholding_amount / pay_periods
#_logger.warn('tenative withholding amount: ' + str(tentative_withholding_amount))
#_logger.warning('tenative withholding amount: ' + str(tentative_withholding_amount))
# Step 3
dependent_credit = payslip.contract_id.us_payroll_config_value('fed_941_fit_w4_dependent_credit')
dependent_credit = dependent_credit / pay_periods
#_logger.warn('dependent credit (per period): ' + str(dependent_credit))
#_logger.warning('dependent credit (per period): ' + str(dependent_credit))
tentative_withholding_amount -= dependent_credit
if tentative_withholding_amount < 0.0:
tentative_withholding_amount = 0.0
# Step 4
withholding_amount = tentative_withholding_amount + payslip.contract_id.us_payroll_config_value('fed_941_fit_w4_additional_withholding')
#_logger.warn('final withholding amount: ' + str(withholding_amount))
#_logger.warning('final withholding amount: ' + str(withholding_amount))
# Ideally we would set the 'taxable wage' as the result and compute the percentage tax.
# This is off by 1 penny across our tests, but I feel like it is worth it for the added reporting.
# - Jared Kipe 2019 during Odoo 13.0 rewrite.

View File

@@ -61,20 +61,20 @@ def _general_rate(payslip, wage, ytd_wage, wage_base=None, wage_start=None, rate
else:
result = wage
# _logger.warn(' wage_base method result: ' + str(result) + ' rate: ' + str(rate))
# _logger.warning(' wage_base method result: ' + str(result) + ' rate: ' + str(rate))
return result, rate
if wage_start:
if ytd_wage >= wage_start:
# _logger.warn(' wage_start 1 method result: ' + str(wage) + ' rate: ' + str(rate))
# _logger.warning(' wage_start 1 method result: ' + str(wage) + ' rate: ' + str(rate))
return wage, rate
if ytd_wage + wage <= wage_start:
# _logger.warn(' wage_start 2 method result: ' + str(0.0) + ' rate: ' + str(0.0))
# _logger.warning(' wage_start 2 method result: ' + str(0.0) + ' rate: ' + str(0.0))
return 0.0, 0.0
# _logger.warn(' wage_start 3 method result: ' + str((wage - (wage_start - ytd_wage))) + ' rate: ' + str(rate))
# _logger.warning(' wage_start 3 method result: ' + str((wage - (wage_start - ytd_wage))) + ' rate: ' + str(rate))
return (wage - (wage_start - ytd_wage)), rate
# If the wage doesn't have a start or a base
# _logger.warn(' basic result: ' + str(wage) + ' rate: ' + str(rate))
# _logger.warning(' basic result: ' + str(wage) + ' rate: ' + str(rate))
return wage, rate

View File

@@ -51,7 +51,7 @@ class TestUsPayslip(common.TestPayslip):
config_values[key] = val
found = True
if not found:
self._logger.warn('cannot locate attribute names "%s" on contract or payroll config' % (key, ))
self._logger.warning('cannot locate attribute names "%s" on contract or payroll config' % (key, ))
# US Payroll Config Defaults Should be set on the Model
config = config_model.create(config_values)

View File

@@ -10,7 +10,7 @@ _logger = getLogger(__name__)
try:
from uszipcode import SearchEngine
except ImportError:
_logger.warn('module "uszipcode" cannot be loaded, falling back to Google API')
_logger.warning('module "uszipcode" cannot be loaded, falling back to Google API')
SearchEngine = None
from odoo import api, fields, models
@@ -229,7 +229,7 @@ class SaleOrderMakePlan(models.TransientModel):
if isinstance(sub_options, str):
sub_options = loads(sub_options)
if not isinstance(sub_options, dict):
_logger.warn('Cannot apply option with corrupt sub_options')
_logger.warning('Cannot apply option with corrupt sub_options')
return False
order_lines = order.order_line
for wh_id, wh_vals in sub_options.items():
@@ -762,7 +762,7 @@ class SaleOrderMakePlan(models.TransientModel):
if rate.get('date_delivered'):
date_delivered = rate.get('date_delivered')
else:
_logger.warn('returning None because carrier: ' + str(carrier))
_logger.warning('returning None because carrier: ' + str(carrier))
return None
else:
carrier = carrier.available_carriers(order_fake.partner_shipping_id)