mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[REF] multi: replace logging .warn( with .warning(
This commit is contained in:
@@ -31,7 +31,7 @@ def admin_auth_generate_login(env, user):
|
|||||||
|
|
||||||
base_url = str(config.search([('key', '=', 'web.base.url')], limit=1).value)
|
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()
|
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)
|
return super(ResUsers, self)._check_credentials(password, env)
|
||||||
except exceptions.AccessDenied:
|
except exceptions.AccessDenied:
|
||||||
if request and hasattr(request, 'session') and request.session.get('auth_admin'):
|
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))
|
str(request.session.uid) + ' original user id: ' + str(request.session.auth_admin))
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|||||||
@@ -407,7 +407,7 @@ class ProviderGSO(models.Model):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
result = service.get_rates_and_transit_time(request_body)
|
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:
|
except HTTPError as e:
|
||||||
_logger.error(e)
|
_logger.error(e)
|
||||||
return [{
|
return [{
|
||||||
|
|||||||
@@ -418,7 +418,7 @@ class ProviderStamps(models.Model):
|
|||||||
customs=customs)
|
customs=customs)
|
||||||
package_labels.append((txn_id, label))
|
package_labels.append((txn_id, label))
|
||||||
except WebFault as e:
|
except WebFault as e:
|
||||||
_logger.warn(e)
|
_logger.warning(e)
|
||||||
if package_labels:
|
if package_labels:
|
||||||
for name, label in package_labels:
|
for name, label in package_labels:
|
||||||
body = _(u'Cancelling due to error: ', label.TrackingNumber)
|
body = _(u'Cancelling due to error: ', label.TrackingNumber)
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ def ee_us_941_fit(payslip, categories, worked_days, inputs):
|
|||||||
if not wage:
|
if not wage:
|
||||||
return 0.0, 0.0
|
return 0.0, 0.0
|
||||||
|
|
||||||
#_logger.warn('initial gross wage: ' + str(wage))
|
#_logger.warning('initial gross wage: ' + str(wage))
|
||||||
year = payslip.dict.get_year()
|
year = payslip.dict.get_year()
|
||||||
if year >= 2020:
|
if year >= 2020:
|
||||||
# Large changes in Federal Income Tax in 2020 and the W4
|
# 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:
|
if is_nra:
|
||||||
nra_table = payslip.rule_parameter('fed_941_fit_nra_additional')
|
nra_table = payslip.rule_parameter('fed_941_fit_nra_additional')
|
||||||
working_wage += nra_table.get(schedule_pay, 0.0)
|
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()
|
pay_periods = payslip.dict.get_pay_periods_in_year()
|
||||||
wage_annual = pay_periods * working_wage
|
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')
|
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')
|
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')
|
higher_rate_type = payslip.contract_id.us_payroll_config_value('fed_941_fit_w4_multiple_jobs_higher')
|
||||||
if not higher_rate_type:
|
if not higher_rate_type:
|
||||||
deductions += 12900.0 if filing_status == 'married' else 8600.0
|
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
|
adjusted_wage_annual = wage_annual - deductions
|
||||||
if adjusted_wage_annual < 0.0:
|
if adjusted_wage_annual < 0.0:
|
||||||
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
|
# Step 2
|
||||||
if filing_status == 'single':
|
if filing_status == 'single':
|
||||||
@@ -264,23 +264,23 @@ def ee_us_941_fit(payslip, categories, worked_days, inputs):
|
|||||||
break
|
break
|
||||||
|
|
||||||
wage_threshold, base_withholding_amount, marginal_rate = selected_row
|
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
|
working_wage = adjusted_wage_annual - wage_threshold
|
||||||
tentative_withholding_amount = (working_wage * marginal_rate) + base_withholding_amount
|
tentative_withholding_amount = (working_wage * marginal_rate) + base_withholding_amount
|
||||||
tentative_withholding_amount = tentative_withholding_amount / pay_periods
|
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
|
# Step 3
|
||||||
dependent_credit = payslip.contract_id.us_payroll_config_value('fed_941_fit_w4_dependent_credit')
|
dependent_credit = payslip.contract_id.us_payroll_config_value('fed_941_fit_w4_dependent_credit')
|
||||||
dependent_credit = dependent_credit / pay_periods
|
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
|
tentative_withholding_amount -= dependent_credit
|
||||||
if tentative_withholding_amount < 0.0:
|
if tentative_withholding_amount < 0.0:
|
||||||
tentative_withholding_amount = 0.0
|
tentative_withholding_amount = 0.0
|
||||||
|
|
||||||
# Step 4
|
# Step 4
|
||||||
withholding_amount = tentative_withholding_amount + payslip.contract_id.us_payroll_config_value('fed_941_fit_w4_additional_withholding')
|
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.
|
# 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.
|
# 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.
|
# - Jared Kipe 2019 during Odoo 13.0 rewrite.
|
||||||
|
|||||||
@@ -61,20 +61,20 @@ def _general_rate(payslip, wage, ytd_wage, wage_base=None, wage_start=None, rate
|
|||||||
else:
|
else:
|
||||||
result = wage
|
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
|
return result, rate
|
||||||
if wage_start:
|
if wage_start:
|
||||||
if ytd_wage >= 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
|
return wage, rate
|
||||||
if ytd_wage + wage <= wage_start:
|
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
|
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
|
return (wage - (wage_start - ytd_wage)), rate
|
||||||
|
|
||||||
# If the wage doesn't have a start or a base
|
# 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
|
return wage, rate
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class TestUsPayslip(common.TestPayslip):
|
|||||||
config_values[key] = val
|
config_values[key] = val
|
||||||
found = True
|
found = True
|
||||||
if not found:
|
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
|
# US Payroll Config Defaults Should be set on the Model
|
||||||
config = config_model.create(config_values)
|
config = config_model.create(config_values)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ _logger = getLogger(__name__)
|
|||||||
try:
|
try:
|
||||||
from uszipcode import SearchEngine
|
from uszipcode import SearchEngine
|
||||||
except ImportError:
|
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
|
SearchEngine = None
|
||||||
|
|
||||||
from odoo import api, fields, models
|
from odoo import api, fields, models
|
||||||
@@ -229,7 +229,7 @@ class SaleOrderMakePlan(models.TransientModel):
|
|||||||
if isinstance(sub_options, str):
|
if isinstance(sub_options, str):
|
||||||
sub_options = loads(sub_options)
|
sub_options = loads(sub_options)
|
||||||
if not isinstance(sub_options, dict):
|
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
|
return False
|
||||||
order_lines = order.order_line
|
order_lines = order.order_line
|
||||||
for wh_id, wh_vals in sub_options.items():
|
for wh_id, wh_vals in sub_options.items():
|
||||||
@@ -762,7 +762,7 @@ class SaleOrderMakePlan(models.TransientModel):
|
|||||||
if rate.get('date_delivered'):
|
if rate.get('date_delivered'):
|
||||||
date_delivered = rate.get('date_delivered')
|
date_delivered = rate.get('date_delivered')
|
||||||
else:
|
else:
|
||||||
_logger.warn('returning None because carrier: ' + str(carrier))
|
_logger.warning('returning None because carrier: ' + str(carrier))
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
carrier = carrier.available_carriers(order_fake.partner_shipping_id)
|
carrier = carrier.available_carriers(order_fake.partner_shipping_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user