mirror of
https://github.com/bringout/odoomates.git
synced 2026-04-26 12:32:04 +02:00
Initial commit: Odoomates Odoo packages (12 packages)
This commit is contained in:
commit
3b38c49bf0
526 changed files with 34983 additions and 0 deletions
|
|
@ -0,0 +1,4 @@
|
|||
from . import create_appointment
|
||||
from . import search_appointment
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
|
||||
|
||||
class CreateAppointmentWizard(models.TransientModel):
|
||||
_name = "create.appointment.wizard"
|
||||
_description = "Create Appointment Wizard"
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields):
|
||||
res = super(CreateAppointmentWizard, self).default_get(fields)
|
||||
if self._context.get('active_id'):
|
||||
res['patient_id'] = self._context.get('active_id')
|
||||
return res
|
||||
|
||||
date_appointment = fields.Date(string='Date', required=False)
|
||||
patient_id = fields.Many2one('hospital.patient', string="Patient", required=True)
|
||||
|
||||
def action_create_appointment(self):
|
||||
vals = {
|
||||
'patient_id': self.patient_id.id,
|
||||
'doctor_id': 2,
|
||||
'date_appointment': self.date_appointment
|
||||
}
|
||||
appointment_rec = self.env['hospital.appointment'].create(vals)
|
||||
return {
|
||||
'name': _('Appointment'),
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'hospital.appointment',
|
||||
'res_id': appointment_rec.id,
|
||||
}
|
||||
|
||||
# def action_view_appointment(self):
|
||||
# # action = self.env.ref('om_hospital.action_hospital_appointment').read()[0]
|
||||
# # action['domain'] = [('patient_id', '=', self.patient_id.id)]
|
||||
# # return action
|
||||
#
|
||||
# action = self.env['ir.actions.actions']._for_xml_id("om_hospital.action_hospital_appointment")
|
||||
# action['domain'] = [('patient_id', '=', self.patient_id.id)]
|
||||
# return action
|
||||
#
|
||||
# # return {
|
||||
# # 'type': 'ir.actions.act_window',
|
||||
# # 'name': 'Appointments',
|
||||
# # 'res_model': 'hospital.appointment',
|
||||
# # 'view_type': 'form',
|
||||
# # 'domain': [('patient_id', '=', self.patient_id.id)],
|
||||
# # 'view_mode': 'tree,form',
|
||||
# # 'target': 'current',
|
||||
# # }
|
||||
# # return action
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
|
||||
<record id="view_create_appointment_form" model="ir.ui.view">
|
||||
<field name="name">create.appointment.wizard.form</field>
|
||||
<field name="model">create.appointment.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create New Appointment">
|
||||
<group>
|
||||
<field name="date_appointment"/>
|
||||
<field name="patient_id"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="action_create_appointment" type="object" string="Create" class="btn-primary"/>
|
||||
<!-- <button name="action_view_appointment" type="object" string="View Appointments" class="btn-primary"/>-->
|
||||
<button string="Cancel" class="btn-secondary" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_create_appointment" model="ir.actions.act_window">
|
||||
<field name="name">Create Appointment</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">create.appointment.wizard</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_create_appointment_form"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
|
||||
|
||||
class SearchAppointmentWizard(models.TransientModel):
|
||||
_name = "search.appointment.wizard"
|
||||
_description = "Search Appointment Wizard"
|
||||
|
||||
patient_id = fields.Many2one('hospital.patient', string="Patient", required=True)
|
||||
|
||||
def action_search_appointment_m1(self):
|
||||
action = self.env.ref('om_hospital.action_hospital_appointment').read()[0]
|
||||
action['domain'] = [('patient_id', '=', self.patient_id.id)]
|
||||
return action
|
||||
|
||||
def action_search_appointment_m2(self):
|
||||
action = self.env['ir.actions.actions']._for_xml_id("om_hospital.action_hospital_appointment")
|
||||
action['domain'] = [('patient_id', '=', self.patient_id.id)]
|
||||
return action
|
||||
|
||||
def action_search_appointment_m3(self):
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': 'Appointments',
|
||||
'res_model': 'hospital.appointment',
|
||||
'view_type': 'form',
|
||||
'domain': [('patient_id', '=', self.patient_id.id)],
|
||||
'view_mode': 'tree,form',
|
||||
'target': 'current',
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
|
||||
<record id="view_search_appointment_form" model="ir.ui.view">
|
||||
<field name="name">search.appointment.wizard.form</field>
|
||||
<field name="model">search.appointment.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Search Appointment">
|
||||
<group>
|
||||
<field name="patient_id"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="action_search_appointment_m1" type="object" string="Search Appointments (M1)"
|
||||
class="btn-primary"/>
|
||||
<button name="action_search_appointment_m2" type="object" string="Search Appointments (M2)"
|
||||
class="btn-primary"/>
|
||||
<button name="action_search_appointment_m3" type="object" string="Search Appointments (M3)"
|
||||
class="btn-primary"/>
|
||||
<button string="Cancel" class="btn-secondary" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_search_appointment" model="ir.actions.act_window">
|
||||
<field name="name">View Appointment</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">search.appointment.wizard</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_search_appointment_form"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Loading…
Add table
Add a link
Reference in a new issue