add field canceled_date in contract
This commit is contained in:
parent
c0ff19d94b
commit
ebffc0b2e7
16
contract.py
16
contract.py
|
@ -35,6 +35,9 @@ class StaffContract(Workflow, ModelSQL, ModelView):
|
|||
'required': Eval('state') == 'finished',
|
||||
'readonly': Eval('state') == 'finished',
|
||||
}, depends=['state'])
|
||||
canceled_date = fields.Date('Canceled Date', states={
|
||||
'required': Eval('state') == 'canceled',
|
||||
}, depends=['state'])
|
||||
salary = fields.Numeric('Salary', digits=(16, 2), states=STATES,
|
||||
help='Salary monthly of person', required=True)
|
||||
kind = fields.Selection([
|
||||
|
@ -49,6 +52,7 @@ class StaffContract(Workflow, ModelSQL, ModelView):
|
|||
('draft', 'Draft'),
|
||||
('active', 'Active'),
|
||||
('finished', 'Finished'),
|
||||
('canceled', 'Canceled'),
|
||||
], 'State', readonly=True, select=True)
|
||||
payment_term = fields.Selection(
|
||||
PAYMENT_TERM, 'Payment Term', states=STATES)
|
||||
|
@ -63,6 +67,7 @@ class StaffContract(Workflow, ModelSQL, ModelView):
|
|||
cls._transitions |= set((
|
||||
('draft', 'active'),
|
||||
('active', 'draft'),
|
||||
('active', 'canceled'),
|
||||
('active', 'finished'),
|
||||
))
|
||||
cls._buttons.update({
|
||||
|
@ -75,6 +80,9 @@ class StaffContract(Workflow, ModelSQL, ModelView):
|
|||
'finished': {
|
||||
'invisible': Eval('state') != 'active',
|
||||
},
|
||||
'canceled': {
|
||||
'invisible': Eval('state') != 'active',
|
||||
},
|
||||
})
|
||||
|
||||
@classmethod
|
||||
|
@ -139,6 +147,14 @@ class StaffContract(Workflow, ModelSQL, ModelView):
|
|||
for contract in records:
|
||||
contract._check_finish_date()
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
@Workflow.transition('canceled')
|
||||
def canceled(cls, records):
|
||||
for contract in records:
|
||||
if not contract.canceled_date:
|
||||
raise StaffContractError(gettext('staff.msg_missing_canceled_date'))
|
||||
|
||||
def _check_finish_date(self):
|
||||
pass
|
||||
|
||||
|
|
58
locale/es.po
58
locale/es.po
|
@ -2,22 +2,6 @@
|
|||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "error:company.employee:"
|
||||
msgid "Employee already exists!"
|
||||
msgstr "El empleado ya existe!"
|
||||
|
||||
msgctxt "error:staff.contract:"
|
||||
msgid "The contract sequence is missing on configuration!"
|
||||
msgstr "Falta la secuencia de contrato en la configuración!"
|
||||
|
||||
msgctxt "error:staff.contract:"
|
||||
msgid "The employee %s already has a contract in draft or active!"
|
||||
msgstr "El empleado %s ya tiene un contrato activo o en borrador!"
|
||||
|
||||
msgctxt "error:staff.contract:"
|
||||
msgid "You can not to finish a contract with end date on future!"
|
||||
msgstr "No puede terminar un contrato con fecha terminación futura!"
|
||||
|
||||
msgctxt "field:company.employee,active:"
|
||||
msgid "Active"
|
||||
msgstr "Activo"
|
||||
|
@ -104,7 +88,7 @@ msgstr "Usuario de creación"
|
|||
|
||||
msgctxt "field:staff.configuration.sequence,id:"
|
||||
msgid "ID"
|
||||
msgstr "UP"
|
||||
msgstr "ID"
|
||||
|
||||
msgctxt "field:staff.configuration.sequence,rec_name:"
|
||||
msgid "Record Name"
|
||||
|
@ -112,7 +96,7 @@ msgstr "Nombre del registro"
|
|||
|
||||
msgctxt "field:staff.configuration.sequence,staff_contract_sequence:"
|
||||
msgid "Staff Contract Sequence"
|
||||
msgstr ""
|
||||
msgstr "Secuencia de Contrato"
|
||||
|
||||
msgctxt "field:staff.configuration.sequence,write_date:"
|
||||
msgid "Write Date"
|
||||
|
@ -122,6 +106,10 @@ msgctxt "field:staff.configuration.sequence,write_uid:"
|
|||
msgid "Write User"
|
||||
msgstr "Usuario modificación"
|
||||
|
||||
msgctxt "field:staff.contract,canceled_date:"
|
||||
msgid "Canceled Date"
|
||||
msgstr "Fecha de Anulación"
|
||||
|
||||
msgctxt "field:staff.contract,comment:"
|
||||
msgid "Comment"
|
||||
msgstr "Observaciones"
|
||||
|
@ -318,6 +306,10 @@ msgctxt "model:ir.action,name:act_contract_form"
|
|||
msgid "Contract"
|
||||
msgstr "Contrato"
|
||||
|
||||
msgctxt "model:ir.action,name:act_holidays_form"
|
||||
msgid "Holidays"
|
||||
msgstr "Vacaciones"
|
||||
|
||||
msgctxt "model:ir.action,name:act_position_tree"
|
||||
msgid "Positions"
|
||||
msgstr "Cargos"
|
||||
|
@ -356,6 +348,10 @@ msgctxt "model:ir.ui.menu,name:"
|
|||
msgid "Contracts"
|
||||
msgstr "Contratos"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_assitants"
|
||||
msgid "Assistants"
|
||||
msgstr "Asistentes"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_configuration"
|
||||
msgid "Configuration"
|
||||
msgstr "Configuración"
|
||||
|
@ -402,7 +398,7 @@ msgstr "Configuración"
|
|||
|
||||
msgctxt "model:staff.configuration.sequence,name:"
|
||||
msgid "Staff Configuration Sequence"
|
||||
msgstr ""
|
||||
msgstr "Configuracion de Secuencia"
|
||||
|
||||
msgctxt "model:staff.contract,name:"
|
||||
msgid "Staff Contract"
|
||||
|
@ -436,6 +432,10 @@ msgctxt "selection:company.employee,contracting_state:"
|
|||
msgid "Finished"
|
||||
msgstr "Terminado"
|
||||
|
||||
msgctxt "selection:company.employee,contracting_state:"
|
||||
msgid "In Process"
|
||||
msgstr "En proceso"
|
||||
|
||||
msgctxt "selection:company.employee,contracting_state:"
|
||||
msgid "Rejected"
|
||||
msgstr "Rechazado"
|
||||
|
@ -456,10 +456,26 @@ msgctxt "selection:staff.contract,kind:"
|
|||
msgid "Steady"
|
||||
msgstr "Término Fijo"
|
||||
|
||||
msgctxt "selection:staff.contract,kind:"
|
||||
msgid "internships"
|
||||
msgstr "Pasantia"
|
||||
|
||||
msgctxt "selection:staff.contract,kind:"
|
||||
msgid "learning"
|
||||
msgstr "Aprendizaje"
|
||||
|
||||
msgctxt "selection:staff.contract,payment_term:"
|
||||
msgid "Cash"
|
||||
msgstr "Efectivo"
|
||||
|
||||
msgctxt "selection:staff.contract,state:"
|
||||
msgid "Active"
|
||||
msgstr "Activo"
|
||||
|
||||
msgctxt "selection:staff.contract,state:"
|
||||
msgid "Canceled"
|
||||
msgstr "Anulado"
|
||||
|
||||
msgctxt "selection:staff.contract,state:"
|
||||
msgid "Draft"
|
||||
msgstr "Borrador"
|
||||
|
@ -520,6 +536,10 @@ msgctxt "view:staff.contract:"
|
|||
msgid "Additional Info"
|
||||
msgstr "Información Adicional"
|
||||
|
||||
msgctxt "view:staff.contract:"
|
||||
msgid "Canceled"
|
||||
msgstr "Anulado"
|
||||
|
||||
msgctxt "view:staff.contract:"
|
||||
msgid "Draft"
|
||||
msgstr "Borrador"
|
||||
|
|
|
@ -15,6 +15,9 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<record model="ir.message" id="msg_finish_contract_out_date">
|
||||
<field name="text">You can not to finish a contract with end date on future!</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_missing_canceled_date">
|
||||
<field name="text">You must define canceled date for contract!</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=6.0.0
|
||||
version=6.0.1
|
||||
depends:
|
||||
ir
|
||||
party
|
||||
|
|
|
@ -22,6 +22,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<page string="Additional Info" id="additional_info">
|
||||
<label name="payment_term"/>
|
||||
<field name="payment_term"/>
|
||||
<label name="canceled_date"/>
|
||||
<field name="canceled_date"/>
|
||||
<label name="company"/>
|
||||
<field name="company"/>
|
||||
<separator name="comment" colspan="4"/>
|
||||
|
@ -38,6 +40,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||
icon="tryton-ok"/>
|
||||
<button name="finished" string="Finished"
|
||||
icon="tryton-ok"/>
|
||||
<button name="canceled" string="Canceled"
|
||||
icon="tryton-cancel"/>
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue