dont duplicate records liquidation a payroll
This commit is contained in:
parent
eef662f29d
commit
311b73c287
|
@ -15,6 +15,9 @@ class LiquidationEmployeeError(UserError):
|
|||
class LiquidationDeleteError(UserError):
|
||||
pass
|
||||
|
||||
class RecordDuplicateError(UserError):
|
||||
pass
|
||||
|
||||
|
||||
class LiquidationMoveError(UserError):
|
||||
pass
|
||||
|
|
|
@ -10,7 +10,8 @@ from trytond.transaction import Transaction
|
|||
from trytond.i18n import gettext
|
||||
from .exceptions import (
|
||||
LiquidationEmployeeError, MissingSecuenceLiquidation,
|
||||
LiquidationMoveError, WageTypeConceptError, LiquidationDeleteError
|
||||
LiquidationMoveError, WageTypeConceptError, LiquidationDeleteError,
|
||||
RecordDuplicateError
|
||||
)
|
||||
|
||||
STATES = {'readonly': (Eval('state') != 'draft')}
|
||||
|
@ -264,6 +265,10 @@ class Liquidation(Workflow, ModelSQL, ModelView):
|
|||
rec.set_liquidation_lines()
|
||||
cls.create_withholding(rec)
|
||||
|
||||
@classmethod
|
||||
def copy(cls, records, default=None):
|
||||
raise RecordDuplicateError(gettext('staff_payroll_co.msg_cannot_duplicate_record'))
|
||||
|
||||
def get_dates(self, name):
|
||||
res = None
|
||||
if self.contract:
|
||||
|
|
|
@ -65,5 +65,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<record model="ir.message" id="msg_existing_move">
|
||||
<field name="text">Liquidation "%(liquidation)s" has a move, must be deleted before deletion.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_cannot_duplicate_record">
|
||||
<field name="text">You can't duplicate this record.</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
|
@ -20,7 +20,7 @@ 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)
|
||||
WageTypeConceptError, RecordDuplicateError)
|
||||
from .constants import (
|
||||
SHEET_FIELDS_NOT_AMOUNT, LIM_UVT_DEDUCTIBLE, ENTITY_ACCOUNTS,
|
||||
FIELDS_AMOUNT, EXTRAS, SHEET_SUMABLES, LIM_PERCENT_DEDUCTIBLE,
|
||||
|
@ -123,6 +123,10 @@ class Payroll(metaclass=PoolMeta):
|
|||
if self.employee and self.employee.department:
|
||||
self.department = self.employee.department.id
|
||||
|
||||
@classmethod
|
||||
def copy(cls, records, default=None):
|
||||
raise RecordDuplicateError(gettext('staff_payroll_co.msg_cannot_duplicate_record'))
|
||||
|
||||
def create_move(self):
|
||||
super(Payroll, self).create_move()
|
||||
pool = Pool()
|
||||
|
|
Loading…
Reference in New Issue