Fix
This commit is contained in:
parent
073ef596db
commit
a3d0fde0b6
|
@ -23,3 +23,6 @@ class Configuration(metaclass=PoolMeta):
|
|||
], required=True)
|
||||
payment_partial_sunday = fields.Boolean('Payment Partial Sunday')
|
||||
template_email_confirm = fields.Many2One('email.template', 'Template Email of Confirmation')
|
||||
limit_shift_month = fields.Integer('Limit Shift Month')
|
||||
wage_shift_fixed = fields.Many2One('staff.wage_type',
|
||||
'Wage Shift Fixed')
|
||||
|
|
74
payroll.py
74
payroll.py
|
@ -19,8 +19,10 @@ from trytond.pyson import Eval, Id
|
|||
from trytond.modules.staff_payroll.period import Period
|
||||
from trytond.modules.staff_payroll.payroll import PayrollReport, get_dom_contract_period
|
||||
from trytond.i18n import gettext
|
||||
from .exceptions import (GeneratePayrollError, MissingTemplateEmailPayroll,
|
||||
WageTypeConceptError, RecordDuplicateError)
|
||||
from .exceptions import (
|
||||
GeneratePayrollError, MissingTemplateEmailPayroll,
|
||||
WageTypeConceptError, RecordDuplicateError
|
||||
)
|
||||
from .constants import (
|
||||
SHEET_FIELDS_NOT_AMOUNT, LIM_UVT_DEDUCTIBLE, ENTITY_ACCOUNTS,
|
||||
FIELDS_AMOUNT, EXTRAS, SHEET_SUMABLES, LIM_PERCENT_DEDUCTIBLE,
|
||||
|
@ -36,16 +38,15 @@ class PayrollLine(metaclass=PoolMeta):
|
|||
|
||||
is_event = fields.Boolean('Is Event')
|
||||
start_date = fields.Date('Start Date', depends=['is_event'],
|
||||
states={
|
||||
states={
|
||||
'invisible': ~Eval('is_event'),
|
||||
})
|
||||
})
|
||||
end_date = fields.Date('End Date', depends=['is_event'],
|
||||
states={
|
||||
states={
|
||||
'invisible': ~Eval('is_event'),
|
||||
})
|
||||
})
|
||||
move_lines = fields.Many2Many('staff.payroll.line-move.line',
|
||||
'line', 'move_line', 'Payroll Line - Move Line')
|
||||
|
||||
'line', 'move_line', 'Payroll Line - Move Line')
|
||||
origin = fields.Reference("Origin", selection='get_origin')
|
||||
|
||||
def get_expense_amount(self):
|
||||
|
@ -96,22 +97,19 @@ class Payroll(metaclass=PoolMeta):
|
|||
last_payroll = fields.Boolean('Last Payroll', states=STATES, select=True)
|
||||
ibc = fields.Function(fields.Numeric('IBC'), 'on_change_with_ibc')
|
||||
health_amount = fields.Function(fields.Numeric('EPS Amount'),
|
||||
'get_non_fiscal_amount')
|
||||
'get_non_fiscal_amount')
|
||||
retirement_amount = fields.Function(fields.Numeric('AFP Amount'),
|
||||
'get_non_fiscal_amount')
|
||||
'get_non_fiscal_amount')
|
||||
risk_amount = fields.Function(fields.Numeric('ARL Amount'),
|
||||
'get_non_fiscal_amount')
|
||||
'get_non_fiscal_amount')
|
||||
box_family_amount = fields.Function(fields.Numeric('Box Amount'),
|
||||
'get_non_fiscal_amount')
|
||||
'get_non_fiscal_amount')
|
||||
absenteeism_days = fields.Integer("Absenteeism Days", states=STATES)
|
||||
department = fields.Many2One('company.department', 'Department',
|
||||
required=False, depends=['employee'])
|
||||
required=False, depends=['employee'])
|
||||
sended_mail = fields.Boolean('Sended Email')
|
||||
worked_days_effective = fields.Function(fields.Numeric('Worked Days Effective'), 'get_worked_days_effective')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(Payroll, cls).__setup__()
|
||||
worked_days_effective = fields.Function(
|
||||
fields.Numeric('Worked Days Effective'), 'get_worked_days_effective')
|
||||
|
||||
@fields.depends('end', 'date_effective')
|
||||
def on_change_with_date_effective(self):
|
||||
|
@ -125,7 +123,8 @@ class Payroll(metaclass=PoolMeta):
|
|||
|
||||
@classmethod
|
||||
def copy(cls, records, default=None):
|
||||
raise RecordDuplicateError(gettext('staff_payroll_co.msg_cannot_duplicate_record'))
|
||||
raise RecordDuplicateError(gettext(
|
||||
'staff_payroll_co.msg_cannot_duplicate_record'))
|
||||
|
||||
def create_move(self):
|
||||
super(Payroll, self).create_move()
|
||||
|
@ -150,7 +149,7 @@ class Payroll(metaclass=PoolMeta):
|
|||
MoveLine.reconcile(set(to_reconcile))
|
||||
|
||||
@fields.depends('period', 'employee', 'start', 'end', 'contract',
|
||||
'description', 'date_effective', 'last_payroll')
|
||||
'description', 'date_effective', 'last_payroll')
|
||||
def on_change_period(self):
|
||||
if not self.period:
|
||||
return
|
||||
|
@ -220,7 +219,7 @@ class Payroll(metaclass=PoolMeta):
|
|||
days.append(l.quantity)
|
||||
if l.wage_type.uom.id == Id('product', 'uom_hour').pyson():
|
||||
unit = 8
|
||||
res = sum(days)/unit
|
||||
res = sum(days) / unit
|
||||
return res
|
||||
|
||||
def adjust_partial_sunday(self, quantity):
|
||||
|
@ -404,8 +403,8 @@ class Payroll(metaclass=PoolMeta):
|
|||
if sum(values) <= amount:
|
||||
lines_to_reconcile.append(m.id)
|
||||
to_write = {
|
||||
'move_lines': [('add', lines_to_reconcile)]
|
||||
}
|
||||
'move_lines': [('add', lines_to_reconcile)]
|
||||
}
|
||||
else:
|
||||
for m in move_lines:
|
||||
values.append(abs(m.debit - m.credit))
|
||||
|
@ -413,14 +412,13 @@ class Payroll(metaclass=PoolMeta):
|
|||
amount = sum(values) + sum(amount_line)
|
||||
unit_value = amount
|
||||
to_write = {
|
||||
'unit_value': unit_value,
|
||||
'move_lines': [('add', lines_to_reconcile)]
|
||||
}
|
||||
'unit_value': unit_value,
|
||||
'move_lines': [('add', lines_to_reconcile)]
|
||||
}
|
||||
PayrollLine.write([line], to_write)
|
||||
if not configuration.allow_zero_quantities and line.quantity == 0:
|
||||
PayrollLine.delete([line])
|
||||
|
||||
|
||||
def process_loans_to_pay(self, line, LoanLine, PayrollLine, MoveLine):
|
||||
|
||||
dom = [
|
||||
|
@ -440,12 +438,12 @@ class Payroll(metaclass=PoolMeta):
|
|||
line_ = line
|
||||
if r == 0:
|
||||
to_write = {
|
||||
'origin': m,
|
||||
'party': party,
|
||||
'quantity': 1,
|
||||
'unit_value': amount,
|
||||
'move_lines': [('add', move_lines)]
|
||||
}
|
||||
'origin': m,
|
||||
'party': party,
|
||||
'quantity': 1,
|
||||
'unit_value': amount,
|
||||
'move_lines': [('add', move_lines)]
|
||||
}
|
||||
else:
|
||||
res = self.get_line(line.wage_type, 1, amount, party=party)
|
||||
res['origin'] = m
|
||||
|
@ -484,6 +482,7 @@ class Payroll(metaclass=PoolMeta):
|
|||
return res
|
||||
|
||||
def set_preliquidation(self, extras, discounts=None):
|
||||
PayrollLine = Pool().get('staff.payroll.line')
|
||||
discounts = self.set_events()
|
||||
ctx = {
|
||||
'absenteeism_days': self.absenteeism_days
|
||||
|
@ -491,6 +490,11 @@ class Payroll(metaclass=PoolMeta):
|
|||
with Transaction().set_context(ctx):
|
||||
super(Payroll, self).set_preliquidation(extras, discounts)
|
||||
self.save()
|
||||
if extras.get('wage_shift_fixed'):
|
||||
wg = extras.get('wage_shift_fixed')
|
||||
line_ = self.get_line(wg['wage'], wg['qty'], wg['unit_value'])
|
||||
PayrollLine.create([line_])
|
||||
|
||||
self.update_wage_no_salary()
|
||||
self.recompute_lines()
|
||||
|
||||
|
@ -737,8 +741,8 @@ class Payroll(metaclass=PoolMeta):
|
|||
amount = sum(values) + sum(amount_line)
|
||||
# 'amount': amount,
|
||||
line.write([line], {
|
||||
'unit_value': amount,
|
||||
})
|
||||
'unit_value': amount,
|
||||
})
|
||||
if line.wage_type.definition == 'deduction':
|
||||
deductions += line.amount
|
||||
if line.wage_type.type_concept == 'tax':
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
[tryton]
|
||||
version=6.0.3
|
||||
version=6.0.4
|
||||
depends:
|
||||
company
|
||||
company_department
|
||||
account
|
||||
bank
|
||||
staff
|
||||
|
|
|
@ -12,12 +12,14 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="uvt_value"/>
|
||||
<label name="liquidation_account"/>
|
||||
<field name="liquidation_account"/>
|
||||
|
||||
<label name="payment_partial_sunday"/>
|
||||
<field name="payment_partial_sunday"/>
|
||||
<label name="allow_zero_quantities"/>
|
||||
<field name="allow_zero_quantities"/>
|
||||
|
||||
<label name="limit_shift_month"/>
|
||||
<field name="limit_shift_month"/>
|
||||
<label name="wage_shift_fixed"/>
|
||||
<field name="wage_shift_fixed"/>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="/form/field[@name='minimum_salary']" position="after">
|
||||
|
|
Loading…
Reference in New Issue