Exemple #1
0
 def askEnableChannel(self, channel, channel_info_html):
     summary = _("Enable additional software channel")
     msg = _("Do you want to enable the following "
             "software channel: '%s'?") % channel
     d = self._get_dialog(Gtk.MessageType.QUESTION,
                          summary,
                          msg,
                          buttons=Gtk.ButtonsType.YES_NO)
     if channel_info_html:
         try:
             from gi.repository import WebKit
             v = WebKit.WebView()
             v.load_string(channel_info_html, "text/html", "utf-8",
                           "file:/")
             sw = Gtk.ScrolledWindow()
             sw.add(v)
             d.get_content_area().pack_start(sw, True, True, 0)
             sw.set_size_request(400, 200)
             sw.show_all()
         except ImportError:
             pass
     res = d.run()
     d.destroy()
     if res != Gtk.ResponseType.YES:
         return False
     return True
Exemple #2
0
 def create(self, vals):
     print("haii", vals)
     if vals.get('name', _('New')) == _('New'):
         vals['name'] = self.env['ir.sequence'].next_by_code(
             'hospital.sequence.patient', ) or _('New')
     result = super(Hospital, self).create(vals)
     return result
Exemple #3
0
def getProfile(request):
    # get user profile
    user = request.user
    profile = user.get_profile()

    if request.method == 'POST':
        profile_form = ProfileForm(request.POST,
                                   request.FILES,
                                   instance=profile)

        user_form = UserForm(request.POST,
                             instance=request.user)
        if profile_form.is_valid() and user_form.is_valid():

            profile_form.save()
            user_form.save()

            resize_post_image.delay(profile_form.save())
            messages.success(request, _("Profile updated succesfully."))
            return redirect('index')
    else:
        profile_form = ProfileForm(instance=profile)
        user_form = UserForm(instance=request.user)

    return render(request, 'account/profile.html', {
        'formProfile': profile_form,
        'formUser': user_form
    })
Exemple #4
0
 def askEnableChannel(self, channel, channel_info_html):
     summary = _("Enable additional software channel")
     msg = _("Do you want to enable the following "
             "software channel: '%s'?") % channel
     d = self._get_dialog(Gtk.MessageType.QUESTION,
                          summary,
                          msg,
                          buttons=Gtk.ButtonsType.YES_NO)
     if channel_info_html:
         try:
             self._add_webkit_view(channel_info_html, d)
         except ImportError:
             pass
     res = d.run()
     d.destroy()
     if res != Gtk.ResponseType.YES:
         return False
     return True
 def visitor_appointment(self):
     return {
         'name': _('Appointment'),
         'domain': [('v_name', '=', self.id)],
         'view_type': 'form',
         'res_model': 'visitor.data',
         'view_id': False,
         'view_mode': 'tree,form',
         'type': 'ir.actions.act_window',
     }
Exemple #6
0
    def askInstallPackage(self, package, summary, description, homepage):
        # populate the dialog
        dia = self.dia
        dia_xml = self.dia_xml
        header = _("Install additional software?")
        body = _("Do you want to install package '%s'?") % package
        dia.set_keep_above(True)
        dia.set_title('')
        header_label = dia_xml.get_object('header_label')
        header_label.set_markup("<b><big>%s</big></b>" % header)
        body_label = dia_xml.get_object('body_label')
        body_label.set_label(body)
        description_text_view = dia_xml.get_object('description_text_view')
        tbuf = Gtk.TextBuffer()
        desc = "%s\n\n%s" % (summary, Helpers.format_description(description))
        tbuf.set_text(desc)
        description_text_view.set_buffer(tbuf)
        dia.set_icon(Gtk.IconTheme.get_default().load_icon(
            'package-x-generic', 16, False))

        # check if another package manager is already running
        # FIXME: just checking for the existance of the file is
        #        not sufficient, it need to be tested if it can
        #        be locked via apt_pkg.get_lock()
        #        - but that needs to run as root
        #        - a dbus helper might be the best answer here
        #args = (update_button_status, dia_xml.get_object("yes_button"),
        #    dia_xml.get_object("infolabel"))
        #args[0](*args[1:])
        #timer_id = GObject.timeout_add(750, *args )

        # show the dialog
        res = dia.run()
        #GObject.source_remove(timer_id)
        if res != Gtk.ResponseType.YES:
            dia.hide()
            return False

        # don't set on-top while installing
        dia.set_keep_above(False)
        return True
Exemple #7
0
    def action_confirm1(self):
        print("iddd", self.id)

        return {
            'name': _('OP'),
            'domain': [('patient_card', '=', self.patient_card.id)],
            'view_type': 'form',
            'res_model': 'hospital.ticket',
            'view_id': 'hospital_management.patientOp_form',
            'view_mode': 'tree,form',
            'type': 'ir.actions.act_window',
        }
Exemple #8
0
 def askInstallPackage(self, package, summary, description, homepage):
     # populate the dialog
     dia = self.dia
     dia_xml = self.dia_xml
     header = _("Install additional software?")
     body = _("Do you want to install package '%s'?") % package
     dia.set_keep_above(True)
     dia.set_title('')
     header_label = dia_xml.get_object('header_label')
     header_label.set_markup("<b><big>%s</big></b>" % header)
     body_label = dia_xml.get_object('body_label')
     body_label.set_label(body)
     description_text_view = dia_xml.get_object('description_text_view')
     tbuf = Gtk.TextBuffer()
     desc = "%s\n\n%s" % (summary, Helpers.format_description(description))
     tbuf.set_text(desc)
     description_text_view.set_buffer(tbuf)
     dia.set_icon(Gtk.IconTheme.get_default().load_icon('deb', 16, False))
     
     # check if another package manager is already running
     # FIXME: just checking for the existance of the file is
     #        not sufficient, it need to be tested if it can
     #        be locked via apt_pkg.GetLock() 
     #        - but that needs to run as root 
     #        - a dbus helper might be the best answer here
     #args = (update_button_status, dia_xml.get_object("yes_button"),
     #    dia_xml.get_object("infolabel"))
     #args[0](*args[1:])
     #timer_id = GObject.timeout_add(750, *args )
     
     # show the dialog
     res = dia.run()
     #GObject.source_remove(timer_id)
     if res != Gtk.ResponseType.YES:
         dia.hide()
         return False
     
     # don't set on-top while installing
     dia.set_keep_above(False)
     return True
Exemple #9
0
def sendPost(request):
    if request.method == 'POST':
        form = PostForm(request.POST)
        if form.is_valid():
            form.save(commit=False)
            form.instance.user = request.user
            form.save(commit=True)
            messages.success(request, _("Send Post Succesfully."))
            return redirect('index')
    else:
        form = PostForm()

    return render(request, 'post/sendpost.html', {'form': form})
Exemple #10
0
 def action_conver_op(self):
     for rec in self:
         rec.state = 'op'
     _rec_name = 'op'
     print("iddd", self.id)
     return {
         'name': _('OP'),
         'view_type': 'form',
         'res_model': 'hospital.ticket',
         'view_mode': 'form',
         'type': 'ir.actions.act_window',
         'state': 'op',
     }
Exemple #11
0
 def askEnableChannel(self, channel, channel_info_html):
     summary = _("Enable additional software channel")
     msg = _("Do you want to enable the following "
             "software channel: '%s'?") % channel
     d = self._get_dialog(Gtk.MessageType.QUESTION, summary, msg,
                          buttons=Gtk.ButtonsType.YES_NO)
     if channel_info_html:
         try:
             from gi.repository import WebKit
             v=WebKit.WebView()
             v.load_string(channel_info_html, "text/html", "utf-8", "file:/")
             sw = Gtk.ScrolledWindow()
             sw.add(v)
             d.get_content_area().pack_start(sw, True, True, 0)
             sw.set_size_request(400, 200)
             sw.show_all()
         except ImportError:
             pass
     res = d.run()
     d.destroy()
     if res != Gtk.ResponseType.YES:
         return False
     return True
Exemple #12
0
 def action_register_payment(self):
     ''' Open the account.payment.register wizard to pay the selected journal entries.
     :return: An action opening the account.payment.register wizard.
     '''
     return {
         'name': _('Register Payment'),
         'res_model': 'account.payment.register',
         'view_mode': 'form',
         'context': {
             'active_model': 'account.move',
             'active_ids': self.ids,
         },
         'target': 'new',
         'type': 'ir.actions.act_window',
     }
Exemple #13
0
def register(request):
    if request.method == 'POST':
        data = request.POST.copy()

        # random username
        data['username'] = ''.join([choice(letters) for i in xrange(30)])
        form = RegisterForm(data)

        if form.is_valid():
            form.save()
            messages.success(request, _("Registration Success. Please Sing In"))
            return HttpResponseRedirect('/index/')
    else:
        form = RegisterForm()

    return render(request, 'account/login.html', {'form': form})
 def check_phn(self):
     for rec in self:
         if rec.v_phn > 11:
             raise ValidationError(_("Incorrect"))
     return True
class Visitor(models.Model):
    _name = 'visitor.data'
    _inherit = ['mail.thread', 'mail.activity.mixin']
    _description = 'Visitor data'
    _rec_name = 'v_name'
    _order = "visitor_seq desc"

    # Track Visibility for any changes
    I_AM = fields.Selection([('visitor', 'Visitor'), ('guest', 'Guest'),
                             ('labour', 'Labour')],
                            required=True)
    v_name = fields.Char(string="Name",
                         required=True,
                         track_visibility="always")
    v_company = fields.Char(string="Company",
                            required=True,
                            track_visibility="always")
    v_phn = fields.Integer(string="Phone Number",
                           required=True,
                           track_visibility="always")
    v_email = fields.Char(string="E-mail", track_visibility="always")
    v_purpose = fields.Text(string="Purpose")
    v_gender = fields.Selection([('male', 'Male'), ('female', 'Female')],
                                default='male',
                                string="Gender",
                                required=True)
    v_image = fields.Binary(string='Take Photo')
    v_address = fields.Char(string="Address")
    visitor_seq = fields.Char(string='sequence',
                              required=True,
                              copy=False,
                              randomly=True,
                              index=True,
                              default=lambda self: _('New'))
    employee_id = fields.Many2one('hr.employee',
                                  string='Employee',
                                  required=True)
    image_1920 = fields.Image(related='employee_id.image_1920', string="Photo")
    work_phone = fields.Char(related='employee_id.work_phone', string="Phone")
    work_email = fields.Char(related='employee_id.work_email', string="Email")
    dept = fields.Many2one(related='employee_id.department_id',
                           string="Department")
    job_title = fields.Char(related='employee_id.job_title',
                            string=" Job Position")
    check_in_date = fields.Datetime(string='Check-In',
                                    default=datetime.today())
    check_out_date = fields.Datetime(string='Check-Out')
    appoint_count = fields.Integer(string='Appointment',
                                   computed='get_appoint_count')

    # @api.depends('v_name')
    # def get_appoint_count(self):
    #     for rec in self:
    #         count = self.env['visitor.data'].search_count([('v_name' '=', self.id)])
    #         rec.appoint_count = count

    # ##################Phone number Validations################################
    @api.depends('v_phn')
    def check_phn(self):
        for rec in self:
            if rec.v_phn > 11:
                raise ValidationError(_("Incorrect"))
        return True

    # Phone number Validations end

    # @api.model
    # def create(self, vals):
    #     if vals:
    #         vals['visitor_seq'] = self.env['ir.sequence'].next_by_code('visitor.data.sequence') or _('New')
    #         result = super(Visitor, self).create(vals)
    #         return result

    ################################################################################
    # # Sequence method
    @api.model
    def create(self, vals):
        if vals.get('visitor_seq', _('New')) == _('New'):
            vals['visitor_seq'] = self.env['ir.sequence'].next_by_code(
                'visitor.data.sequence') or _('New')
        result = super(Visitor, self).create(vals)
        return result

    ###################################################################################################

    # appointment count section
    def visitor_appointment(self):
        return {
            'name': _('Appointment'),
            'domain': [('v_name', '=', self.id)],
            'view_type': 'form',
            'res_model': 'visitor.data',
            'view_id': False,
            'view_mode': 'tree,form',
            'type': 'ir.actions.act_window',
        }

    def action_mail(self):
        template_id = self.env.ref('visitor_management.email_template').id
        template = self.env['mail.template'].browse(template_id)
        template.send_mail(self.id, force_send=True)
Exemple #16
0
class Hospital(models.Model):
    _name = "hospital.patient"
    _inherit = ['mail.thread.cc', 'mail.activity.mixin']
    _description = "Hospital patient"

    order_lines = fields.One2many('hospital.ticket',
                                  'patient_card',
                                  ondelete='set null')

    name = fields.Char(string='Order Reference',
                       required=True,
                       copy=False,
                       readonly=True,
                       index=True,
                       default=lambda self: _('New'))
    patient_id = fields.Many2one(
        'res.partner',
        ondelete='set null',
        string='Patients Name',
    )

    dob1 = fields.Date(string="DOB", related='patient_id.dob')
    print("here s the dateeeeeeeexx", dob1)
    age = fields.Integer(string="Age", compute='_compute_get_age')
    gender = fields.Selection([
        ('m', 'Male'),
        ('f', 'female'),
    ],
                              string="Gender")
    mobile = fields.Char(
        string='mobile',
        related='patient_id.phone',
    )
    telephone = fields.Char(string='Telephone', related='patient_id.phone')
    blood_group = fields.Selection([
        ('b+', 'B+'),
        ('o+', 'O+'),
        ('o-', 'O-'),
    ],
                                   string="Blood Group")

    #order_lines = fields.One2many('op.line', 'cons_id', ondelete='set null')

    @api.model
    def create(self, vals):
        print("haii", vals)
        if vals.get('name', _('New')) == _('New'):
            vals['name'] = self.env['ir.sequence'].next_by_code(
                'hospital.sequence.patient', ) or _('New')
        result = super(Hospital, self).create(vals)
        return result

    @api.depends("dob1")
    def _compute_get_age(self):
        self.age = 0
        today_date = datetime.date.today()
        for stud in self:
            if stud.dob1:
                dob1 = fields.Datetime.to_datetime(stud.dob1).date()
                # now = dob1.year
                age = (today_date - dob1).days / 365
                stud.age = age
Exemple #17
0
class HospitalOpTicket(models.Model):
    _name = "hospital.ticket"
    _inherit = ['mail.thread.cc', 'mail.activity.mixin']
    _description = "Hospital Op"
    #_rec_name = 'patient_card'
    _rec_name = 'tocken_no'

    patient_card = fields.Many2one(
        'hospital.patient',
        ondelete='set null',
        string='Patients Card',
    )
    _patients_name = fields.Many2one("hr.employee.base", string="names")
    name = fields.Char(
        string='Name',
        related='patient_card.patient_id.name',
    )
    age = fields.Integer(string="Age", related='patient_card.age')
    dob = fields.Date(string="DOB", related='patient_card.dob1')
    gender = fields.Selection(string="Gender", related="patient_card.gender")
    blood_group = fields.Selection(string="Blood Group",
                                   related="patient_card.blood_group")
    doctor = fields.Many2one('hr.employee',
                             ondelete='set null',
                             string="Doctors")
    department = fields.Many2one(string="Department",
                                 related='doctor.department_id')
    company_id = fields.Many2one("res.company",
                                 default=lambda self: self.env.company)
    currency_id = fields.Many2one("res.currency",
                                  string="Currency",
                                  related='company_id.currency_id',
                                  readonly=True)
    job = fields.Char(string="Gender", related="doctor.job_title")
    date = fields.Date(string="Date", compute='calculate_date')
    tocken_no = fields.Char(string='Tocken Number',
                            required=True,
                            copy=False,
                            readonly=True,
                            index=True,
                            default=lambda self: _('New'))
    fee = fields.Integer(string='Fee',
                         currency_field='currency_id',
                         related='doctor.fee')
    state = fields.Selection([
        ('draft', 'Draft'),
        ('op', 'OP'),
    ],
                             string='Status',
                             readonly=True,
                             copy=False,
                             index=True,
                             tracking=3,
                             default='draft')

    @api.model
    def create(self, vals):
        if vals.get('tocken_no', _('New')) == _('New'):
            vals['tocken_no'] = self.env['ir.sequence'].next_by_code(
                'hospital.sequence.op', ) or _('New')
        result = super(HospitalOpTicket, self).create(vals)
        return result

    def action_confirm(self):
        for rec in self:
            rec.state = 'op'

    @api.depends("dob")
    def calculate_date(self):
        today_date = datetime.date.today()
        self.date = today_date
        print("today", today_date)

    @api.onchange('tocken_no')
    def change_domain(self):
        for rec in self:
            return {'domain': {'doctor': [('job_title', '=', 'Doctor')]}}

    def action_register_payment(self):
        ''' Open the account.payment.register wizard to pay the selected journal entries.
        :return: An action opening the account.payment.register wizard.
        '''
        return {
            'name': _('Register Payment'),
            'res_model': 'account.payment.register',
            'view_mode': 'form',
            'context': {
                'active_model': 'account.move',
                'active_ids': self.ids,
            },
            'target': 'new',
            'type': 'ir.actions.act_window',
        }
Exemple #18
0
 def create(self, vals):
     if vals.get('tocken_no', _('New')) == _('New'):
         vals['tocken_no'] = self.env['ir.sequence'].next_by_code(
             'hospital.sequence.op', ) or _('New')
     result = super(HospitalOpTicket, self).create(vals)
     return result
Exemple #19
0
from AptUrl.Helpers import _

TYPEBAIL_CHOICE = (
    (1, _("Voiture en fin de leasing")),
    (2, _("voiture en cours de leasing"))
)
Exemple #20
0
 def check_parent_id(self):
     if not self._check_recursion():
         raise ValueError(_('Error ! You cannot create recursive categories.'))
 def create(self, vals):
     if vals.get('visitor_seq', _('New')) == _('New'):
         vals['visitor_seq'] = self.env['ir.sequence'].next_by_code(
             'visitor.data.sequence') or _('New')
     result = super(Visitor, self).create(vals)
     return result