minor fix

This commit is contained in:
wilsongomez 2022-03-07 14:38:18 -05:00
parent c7ab10d11b
commit a2dd063904
3 changed files with 13 additions and 1 deletions

View File

@ -7,6 +7,9 @@ from trytond.pyson import Id
class Configuration(metaclass=PoolMeta):
__name__ = "staff.configuration"
allow_zero_quantities = fields.Boolean('Allow Zero Quantities',
help='If this checked the lines in payroll in zero do not delete')
staff_liquidation_sequence = fields.Many2One('ir.sequence',
'Liquidation Sequence', required=True, domain=[
('sequence_type', '=',

View File

@ -21,7 +21,7 @@ from trytond.modules.staff_payroll.payroll import PayrollReport
from trytond.i18n import gettext
from .exceptions import (GeneratePayrollError, MissingTemplateEmailPayroll,
WageTypeConceptError)
from constants import (
from .constants import (
SHEET_FIELDS_NOT_AMOUNT, LIM_UVT_DEDUCTIBLE, ENTITY_ACCOUNTS,
FIELDS_AMOUNT, EXTRAS, SHEET_SUMABLES, LIM_PERCENT_DEDUCTIBLE,
)
@ -372,6 +372,8 @@ class Payroll(metaclass=PoolMeta):
MoveLine = pool.get('account.move.line')
PayrollLine = pool.get('staff.payroll.line')
LoanLine = pool.get('staff.loan.line')
Configuration = Pool().get('staff.configuration')
configuration = Configuration(1)
for line in self.lines:
to_write = {}
@ -409,6 +411,9 @@ class Payroll(metaclass=PoolMeta):
'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):

View File

@ -12,8 +12,12 @@ 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"/>
</xpath>
<xpath
expr="/form/field[@name='minimum_salary']" position="after">