32 lines
800 B
Python
32 lines
800 B
Python
|
from netforce.model import Model, fields, get_model
|
||
|
|
||
|
class SickBed(Model):
|
||
|
_name="clinic.sickbed"
|
||
|
_string="Sickbed"
|
||
|
|
||
|
_fields={
|
||
|
"name": fields.Char("Name",required=True,search=True),
|
||
|
"available": fields.Boolean("Available"),
|
||
|
'hd_cases': fields.One2Many("clinic.hd.case",'sickbed_id','HDCases'),
|
||
|
}
|
||
|
|
||
|
_defaults={
|
||
|
'available': True,
|
||
|
}
|
||
|
|
||
|
def copy(self,ids,context={}):
|
||
|
obj=self.browse(ids)[0]
|
||
|
new_id=get_model("clinic.sickbed").create({
|
||
|
'name': '%s(copy)' % obj.name,
|
||
|
})
|
||
|
return {
|
||
|
'next': {
|
||
|
'name': 'clinic_sickbed',
|
||
|
'mode': 'form',
|
||
|
'active_id': new_id,
|
||
|
},
|
||
|
'flash': 'Copy succesfully',
|
||
|
}
|
||
|
|
||
|
SickBed.register()
|