minor fix

This commit is contained in:
Wilson Gomez 2022-11-15 09:46:02 -05:00
parent e290057a0e
commit 43a6c7753d
2 changed files with 12 additions and 1 deletions

View File

@ -170,3 +170,11 @@ class StaffContract(Workflow, ModelSQL, ModelView):
raise AccessError(gettext('staff.msg_employee_with_contract_current',
contract=contracts_current[0].employee.rec_name))
return super(StaffContract, cls).create(vlist)
@classmethod
def delete(cls, records):
for contract in records:
if contract.number:
raise AccessError(gettext('staff.msg_dont_delete_contract',
contract=contracts_current[0].employee.rec_name))
return super(StaffContract, cls).delete(records)

View File

@ -4,7 +4,10 @@ this repository contains the full copyright notices and license terms. -->
<tryton>
<data grouped="1">
<record model="ir.message" id="msg_employee_with_contract_current">
<field name="text">The employee "%(contract)" already has a contract in draft or active!.</field>
<field name="text">The employee "%(contract)s" already has a contract in draft or active!.</field>
</record>
<record model="ir.message" id="msg_dont_delete_contract">
<field name="text">The contract for "%(contract)s" can not delete, cancel this.</field>
</record>
<record model="ir.message" id="msg_missing_contract_sequence">
<field name="text">The contract sequence is missing on configuration!</field>