Tuesday, December 17, 2019

example object in odoo

ODOO

python oop

 
In this step we will start the relational fields so we have to 
  • create 'clinic.doctor' object which will contain doctor's data
  • link the doctor object with the patient object
We can create 'clinic.doctor' object by the same way that we use to create 'clinic.patient' in the file with name 'clinic_doctor_view.xml' so we must first create 'clinic_doctor.py' just as ...

# -*- coding: utf-8 -*-
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError

class ClinicDoctor(models.Model):
    ###############################
    #Class for doctor which is contain all doctor data
    ###############################
    _name = 'clinic.doctor'
    _description = "object contain all doctor data"

    first_name = fields.Char(string='First Name', required=True)
    second_name = fields.Char(string='Second Name', required=True)
    third_name = fields.Char(string='Third Name', required=True)
    forth_name = fields.Char(string='Fourth Name', required=True)
    name = fields.Char(string="Name", readonly=True, compute='get_doctor_name')
    image = fields.Binary(string='Image', copy=False)
    gender = fields.Selection([('male','Male'),('female','Female')], string='Gender',default='male')
    birth_day = fields.Date(string='Birthday', required=True)
    age_year = fields.Integer(string="Years", compute='calculate_age')
    age_month = fields.Integer(string="Months", compute='calculate_age')
    age_day = fields.Integer(string="Days", compute='calculate_age')
    country_id = fields.Many2one('res.country', string='Country')
    phone = fields.Char(string="Phone")

    @api.constrains('phone')
    def phone_validation(self):
        """
        function to validate phone data for doctor
        """
        phone_prefix = [1,9]
        phone_type = [0,1,2,6,9]
        check_value = 0

        if self.phone and self.country_id:
            if self.country_id.code == 'SD':
                phone = self.phone
                if len(phone) != 9:
                    raise ValidationError(_("Wrong phone number , it length is not true"))
                if len(phone) == 9:
                    for index in range(0,len(phone_prefix)):
                        if phone[0] == str(phone_prefix[index]):
                            check_value = 1
                    if check_value == 0:
                        raise ValidationError(_("Wrong phone number , it start with wrong key number"))
                    check_value = 0
                    for index in range(0,len(phone_type)):
                        if phone[1] == str(phone_type[index]):
                            check_value = 1
                    if check_value == 0:
                        raise ValidationError(_("Wrong phone number , it not of real phone number"))
                    check_value = 0
                    for index in range(0,len(phone)):
                        check_value = 0
                        for number in range(0,10):
                            if phone[index] == str(number):
                                check_value = 1
                        if check_value == 0:
                            raise ValidationError(_("Wrong phone number , it must not contain charactors"))



    @api.one
    def get_doctor_name(self):
        """
        function to calculate the full name for the doctor
        """
        self.name = self.first_name+' '+self.second_name+' '+self.third_name+' '+self.forth_name


    @api.one
    def calculate_age(self):
        """
        function to calcolate the age of the user

        """
        if self.birth_day :
            birth_day = str(self.birth_day)
            current_date = str(fields.Date.today())

            birth_day_year_as_int =     int(birth_day[0]+birth_day[1]+birth_day[2]+birth_day[3])
            birth_day_month_as_int = int(birth_day[5]+birth_day[6])
            birth_day_day_as_int = int(birth_day[8]+birth_day[9])

            current_date_year_as_int = int(current_date[0]+current_date[1]+current_date[2]+current_date[3])
            current_date_month_as_int = int(current_date[5]+current_date[6])
            current_date_day_as_int = int(current_date[8]+current_date[9])

            period_years = current_date_year_as_int-birth_day_year_as_int
            period_months = current_date_month_as_int-birth_day_month_as_int
            period_days = current_date_day_as_int-birth_day_day_as_int

            months_list_1 = ['04','06','09','11']
            months_list_2 = ['01','03','05','07','08','10','12']

            if period_days < 0:
                if str(current_date_month_as_int) == '02':
                    if current_date_year_as_int%4 == 0:
                        period_days = 29+period_days
                    if current_date_year_as_int%4 != 0:
                        period_days = 28+period_days
                for index in range(0,4):
                    if current_date_month_as_int == int(months_list_1[index]):
                        period_days = 30+period_days
                for index in range(0,7):
                    if current_date_month_as_int == int(months_list_2    [index]):
                        period_days = 31+period_days
                period_months = period_months-1
            if period_months < 0:
                period_months = 12+period_months
                period_years = period_years-1

            self.age_year = period_years
            self.age_month = period_months
            self.age_day = period_days

Then we will it view in 'clinic_doctor_view.xml' just as

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>

        <!-- """Create Form View""" -->

        <record id="clinic_doctor_form_view" model="ir.ui.view">
            <field name="name">clinic.doctor.form</field>
            <field name="model">clinic.doctor</field>
            <field name="arch" type="xml">
                <form string="Doctor">
                    <sheet>
                        <div style="width:100%;">
                            <div style="width:20%;float:left;">
                                <field name="image" widget="image"/>
                            </div>
                            <div style="width:78%;float:right;">
                                <group colspan="2" col="2">
                                    <field name="name" nolabel="1" style="font-size:32px;"/>
                                </group>
                                <table style="width:100%;">
                                    <tr style="width:100%;">
                                        <td style="width:25%;font-size:13px;padding:2px;">
                                            <field name="first_name" placeholder="First Name"/>
                                        </td>
                                        <td style="width:25%;font-size:13px;padding:2px;">
                                            <field name="second_name" placeholder="Second Name"/>
                                        </td>
                                        <td style="width:25%;font-size:13px;padding:2px;">
                                            <field name="third_name" placeholder="Third Name"/>
                                        </td>
                                        <td style="width:25%;font-size:13px;padding:2px;">
                                            <field name="forth_name" placeholder="Fourth Name"/>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                        <br></br><br></br>
                        <group colspan="4" col="4">
                            <field name="gender"/>
                            <field name="birth_day"/>
                            <field name="country_id"/>
                            <field name="phone"/>
                        </group>
                        <table style="width:50%;">
                            <tr>
                                <td style="width:40%;font-size:13px;padding:2px;">
                                </td>
                                <td style="width:20%;padding:2px;">
                                    <center>
                                        years
                                    </center>
                                </td>
                                <td style="width:20%;padding:2px;">
                                    <center>
                                        months
                                    </center>
                                </td>
                                <td style="width:20%;padding:2px;">
                                    <center>
                                        days
                                    </center>
                                </td>
                            </tr>
                            <tr>
                                <td style="width:40%;font-size:13px;padding:2px;">
                                    <b>
                                        Age
                                    </b>
                                </td>
                                <td style="width:20%;padding:2px;">
                                    <center>
                                        <field name="age_year" />
                                    </center>
                                </td>
                                <td style="width:20%;padding:2px;">
                                    <center>
                                        <field name="age_month" />
                                    </center>
                                </td>
                                <td style="width:20%;padding:2px;">
                                    <center>
                                        <field name="age_day" />
                                    </center>
                                </td>
                            </tr>
                        </table>
                    </sheet>
                </form>
            </field>
        </record>

        <!-- """Create Tree View""" -->

        <record id="clinic_doctor_tree_view" model="ir.ui.view">
            <field name="name">clinic.doctor.tree</field>
            <field name="model">clinic.doctor</field>
            <field name="arch" type="xml">
                <tree string="doctors">
                    <field name="name"/>
                    <field name="gender"/>
                    <field name="age_year"/>
                    <field name="phone"/>
                </tree>
            </field>
        </record>

        <!-- """Create Action View""" -->

        <record id="clinic_doctor_action_view" model="ir.actions.act_window">
            <field name="name">doctors</field>
            <field name="res_model">clinic.doctor</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="clinic_doctor_tree_view"/>
        </record>

        <!-- """Create the Configration menu """ -->

        <menuitem id="clinic_doctor_main_menu"
            name="Doctors" sequence="10"
            parent="clinic_root_menu"
        />

        <!-- """Create the Company's Projects menu""" -->

        <menuitem
            name="Doctors"
            parent="clinic_doctor_main_menu"
            action="clinic_doctor_action_view"
            id="doctors_action_menu"
            sequence="15"
        />

    </data>
</odoo>

Then we will create the relation between the patient and the doctor , an we can say ' one doctor will take care of more than one patient ' so it will be 'One2many' form doctor to patient , and also we can say ' many patients have taken care by one doctor' so it will be 'Many2one' from patient to doctor 

Now we can code that by adding many2one field into 'clinic.patient' object as 

doctor_id = fields.Many2one('clinic.doctor', string='Doctor') 

then we will add this field to patient object view file 

Then we must go to 'clinic.doctor' object and add One2many field for patients just as bellow ...

patient_id = fields.One2many('clinic.patient', 'doctor_id', string='Patients')

Then we go to doctor object view and add it  as bellow 

<group colspan="4" col="4" string="Patients">
         <field name="patient_id" nolabel="1"/>

</group> 

Watch On YouTube



PREVIOUS STEP            NEXT STEP

add country,phon fields in odoo

In this step we will continue with 'clinic.patient' object and
  • add country field
  • add phone field with validation function
  • edit tree view 
To add phone number and country fields we have to go to 'clinic.patient' object and add them with validation function as bellow

country_id = fields.Many2one('res.country', string="Country")
phone = fields.Char(string="Phone")
    @api.constrains('phone')
    def phone_validation(self):
        """
        function to validate phone data for patient
        """
        phone_prefix = [1,9]
        phone_type = [0,1,2,6,9]
        check_value = 0

        if self.phone and self.country_id:
            if self.country_id.code == 'SD':
                phone = self.phone
                if len(phone) != 9:
                    raise ValidationError(_("Wrong phone number , it length is not true"))
                if len(phone) == 9:
                    for index in range(0,len(phone_prefix)):
                        if phone[0] == str(phone_prefix[index]):
                            check_value = 1
                    if check_value == 0:
                        raise ValidationError(_("Wrong phone number , it start with wrong key number"))
                    check_value = 0
                    for index in range(0,len(phone_type)):
                        if phone[1] == str(phone_type[index]):
                            check_value = 1
                    if check_value == 0:
                        raise ValidationError(_("Wrong phone number , it not of real phone number"))
                    check_value = 0
                    for index in range(0,len(phone)):
                        check_value = 0
                        for number in range(0,10):
                            if phone[index] == str(number):
                                check_value = 1
                        if check_value == 0:
                            raise ValidationError(_("Wrong phone number , it must not contain charactors"))


Then we have to add it to the view in 'clinic_patient_view.xml' file inside the first group to be as

<group colspan="4" col="4">
        <field name="gender"/>
        <field name="birth_day"/>

        <field name="country_id" />
        <field name="phone"/>
        <field name="met_doctor"/>
        <field name="last_meeting" attrs="{'invisible': [('met_doctor','=',False)],'required':[('met_doctor','=',True)]}"/>

</group>

 Then we will edit the tree view to show the important fields for the patient (name, phone, gender, age'years') so it will be as ...

<record id="clinic_patient_tree_view" model="ir.ui.view">
        <field name="name">clinic.patient.tree</field>
        <field name="model">clinic.patient</field>
        <field name="arch" type="xml">
                <tree string="Patients">
                       <field name="name"/>
                       <field name="gender"/>
                       <field name="phone"/>
                       <field name="age_year"/>
                </tree>
       </field>

</record>
 

Watch On YouTube


PREVIOUS STEP           NEXT STEP

Wednesday, December 11, 2019

api decorators in odoo

 

ODOO

 

api

 

 
In this step we will
  • explain api decorators
  • add age fields for patient object
  • calculate age from birthday as example for writing function in odoo

What is api decorators ?

odoo.api.one(method)
odoo.api.multi(method)
Where self is defined as record-set (some records that have related with each other)
EG: model.method(cr, uid, ids, args, context=context)
odoo.api.model(method)
Where self is defined as record-set but its contents is not relevant (some records that have no related with each other)
EG: model.method(cr, uid, args, context=context)
odoo.api.depends(*args)
odoo.api.constrains(*args)
odoo.api.onchange(*args)
odoo.api.returns(model, downgrade=None, upgrade=None)


  • add age fields for patient object
we will calculate the age of patient as years, months and days so we must add three fields for age (age_year, age_month, age_day) which will be computed fields that get their values from one function “calculate_age()” so to do that we have to go to ‘clinic.patient’ object and add the code bellow

age_year = fields.Integer(string="Years", compute='calculate_age')
age_month = fields.Integer(string="Months", compute='calculate_age')
age_day = fields.Integer(string="Days", compute='calculate_age')

@api.one
def calculate_age(self):
"""
function to calcolate the age of he user

"""
if self.birth_day :
birth_day = str(self.birth_day)
current_date = str(fields.Date.today())

birth_day_year_as_int = int(birth_day[0]+birth_day[1]+birth_day[2]+birth_day[3])
birth_day_month_as_int = int(birth_day[5]+birth_day[6])
birth_day_day_as_int = int(birth_day[8]+birth_day[9])

current_date_year_as_int = int(current_date[0]+current_date[1]+current_date[2]+current_date[3])
current_date_month_as_int = int(current_date[5]+current_date[6])
current_date_day_as_int = int(current_date[8]+current_date[9])

period_years = current_date_year_as_int-birth_day_year_as_int
period_months = current_date_month_as_int-birth_day_month_as_int
period_days = current_date_day_as_int-birth_day_day_as_int

months_list_1 = ['04','06','09','11']
months_list_2 = ['01','03','05','07','08','10','12']

if period_days < 0:
if str(current_date_month_as_int) == '02':
if current_date_year_as_int%4 == 0:
period_days = 29+period_days
if current_date_year_as_int%4 != 0:
period_days = 28+period_days
for index in range(0,4):
if current_date_month_as_int == int(months_list_1[index]):
period_days = 30+period_days
for index in range(0,7):
if current_date_month_as_int == int(months_list_2 [index]):
period_days = 31+period_days
period_months = period_months-1
if period_months < 0:
period_months = 12+period_months
period_years = period_years-1

self.age_year = period_years
self.age_month = period_months
self.age_day = period_days

Then we will deign view for these field by adding the code bellow to ‘clinic_patient_view.xml’ file

<table style="width:50%;">
    <tr>
        <td style="width:40%;font-size:13px;padding:2px;">
        </td>
        <td style="width:20%;padding:2px;">
            <center>
                years
            </center>
        </td>
        <td style="width:20%;padding:2px;">
            <center>
                months
            </center>
        </td>
        <td style="width:20%;padding:2px;">
            <center>
                days
            </center>
        </td>
    </tr>
    <tr>
        <td style="width:40%;font-size:13px;padding:2px;">
            <b>
                Age
            </b>
        </td>
        <td style="width:20%;padding:2px;">
            <center>
                <field name="age_year" />
            </center>
        </td>
        <td style="width:20%;padding:2px;">
            <center>
                <field name="age_month" />
            </center>
        </td>
        <td style="width:20%;padding:2px;">
            <center>
                <field name="age_day" />
            </center>
        </td>
    </tr>
</table>


Watch On YouTube


PREVIOUS STEP            NEXT STEP

Tuesday, December 10, 2019

create report in odoo 10



      In this blog we will explain how we can create report in odoo 10 (report generate by wizard)

      So to to that we have to follow the step blow , we will take payments report as an example

1/ create wizard python file in which we will add all fields that we want to use as filler to generate the report 

class paymentsReportWiz(models.TransientModel):
    _name = "payments.report.wiz"
    _description = "Payments Report"


    def get_year_range(self):
        year_list = []
        for i in range(2015, (fields.Date.from_string(fields.Date.today()).year)+5):
            year_list.append((str(i), str(i)))
        return year_list

    target_move = fields.Selection([('posted', 'All Posted Entries'),
        ('all', 'All Entries')], string='Target Moves', required=True, default='posted')
    year = fields.Selection(get_year_range, string='Year', default=str(fields.Date.from_string(fields.Date.today()).year))
 
@api.multi
    def print_report(self):
        """
            function to print the report
        """
        data = {}
        move_ids = self.get_move_ids()
        data['year'] = self.year
        data['move_ids'] = move_ids
        return self.env['report'].with_context({'portrait': 1}).get_action(self, 'module_name.payments_report_template', data=data)

    
    def get_move_ids(self):
        """
            Function to retrun moves base on selected moves type
        """
        move_object = self.env['account.move']
        move_ids = []
        if self.target_move == 'posted':
            move_ids = move_object.search([('state','=','posted')])
        else:
            move_ids = move_object.search([])
        return move_ids.ids



class PaymnetsReportDetails(models.AbstractModel):
    _name = "report.module_name.payments_report_template"

    @api.model
    def render_html(self, docids, data=None):
        """
            function to render the report
        """
        docids = docids
        current_company = self.env.user.company_id
        data['current_company'] = current_company
        return self.env['report'].render('module_name.payments_report_template', data)
 

2/ create the wizard form view file  , as bellow 


<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <data>

        <!-- """Create Wizard View""" -->

        <record id="view_payments_report_wiz_form" model="ir.ui.view">
            <field name="name">payments.report.wiz.form</field>
            <field name="model">payments.report.wiz</field>
            <field name="arch" type="xml">
                <form >
                    <sheet>
                        <group colspan="4" col="4">
                            <field name="target_move" widget="radio"/>
                            <field name="year" required="1"/>
                        </group>

                        <footer>
                            <button name="print_report" string="Print" type="object" default_focus="1" class="oe_highlight"/>
                            <button string="Cancel" special="cancel"/>
                        </footer>
                    </sheet>
                </form>
            </field>
        </record>



3/ create the report template as bellow 
 

<?xml version="1.0" encoding="utf-8" ?>
<odoo>

  <!-- ...Define Template... -->

  <template id="payments_report_template">
    <t t-call="report.html_container">
      <div class="page">
        <b style="font-size:24px;">
          <span t-esc="current_company.name"/>
        </b>
        <b style="float:right;font-size:24px;color:#3a5d9c">
          Payments Report
        </b>
      </div>
    </t>
  </template>

<report
    id="payments_report_action"
    string="Payments Report"
    model="account.move.line"
    report_type="qweb-html"
    name="module_name.payments_report_template"
    menu="False"
    />

  </odoo>


Monday, December 9, 2019

how to edit view in odoo

ODOO

views

 

In this step we will continue with patient object by adding some new fields and design their view , so we have two steps today
  • add the fields 
          'name' which will contain the full name for the patient that will be concatenation of the four name , so 'name' field will be computed field
          'image' which is binary field that will contain the image of patient
          'gender' contain the gender of patient and it is selection field contain two values [male and female]
          'birth_day' the birthdate for the patient
          'met_doctor' which is boolean field that will be true if the patient met the doctor before 
          'last_meeting' the date of last meeting 

So we can add them as 

# -*- coding: utf-8 -*-
from odoo import api, fields, models, _

class ClinicPatient(models.Model):
    ###############################
    #Class for patient which is contain all patient data
    ###############################
    _name = 'clinic.patient'
    _description = "object contain all patient data"

    first_name = fields.Char(string='First Name', required=True)
    second_name = fields.Char(string='Second Name', required=True)
    third_name = fields.Char(string='Third Name', required=True)
    forth_name = fields.Char(string='Fourth Name', required=True)
    name = fields.Char(string="Name", readonly=True, compute='get_patient_name')
    image = fields.Binary(string='Image', copy=False)
    gender = fields.Selection([('male','Male'),('female','Female')], string='Gender',default='male')
    birth_day = fields.Date(string='Birthday', required=True)
    met_doctor = fields.Boolean(string='Met Doctor')
    last_meeting = fields.Date(string='Last Meeting')

    @api.one
    def get_patient_name(self):
        """
        function to calculate the full name for the patient
        """
        self.name = self.first_name+' '+self.second_name+' '+self.third_name+' '+self.forth_name

  • Edit view file as bellow 
<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>

        <!-- """Create Form View""" -->

        <record id="clinic_patient_form_view" model="ir.ui.view">
            <field name="name">clinic.patient.form</field>
            <field name="model">clinic.patient</field>
            <field name="arch" type="xml">
                <form string="Patient">
                    <sheet>
                        <div style="width:100%;">
                            <div style="width:20%;float:left;">
                                <field name="image" widget="image"/>
                            </div>
                            <div style="width:78%;float:right;">
                                <group colspan="2" col="2">
                                    <field name="name" nolabel="1" style="font-size:32px;"/>
                                </group>
                                <table style="width:100%;">
                                    <tr style="width:100%;">
                                        <td style="width:25%;font-size:13px;padding:2px;">
                                            <field name="first_name" placeholder="First Name"/>
                                        </td>
                                        <td style="width:25%;font-size:13px;padding:2px;">
                                            <field name="second_name" placeholder="Second Name"/>
                                        </td>
                                        <td style="width:25%;font-size:13px;padding:2px;">
                                            <field name="third_name" placeholder="Third Name"/>
                                        </td>
                                        <td style="width:25%;font-size:13px;padding:2px;">
                                            <field name="forth_name" placeholder="Fourth Name"/>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                        <br></br><br></br>
                        <group colspan="4" col="4">
                            <field name="gender"/>
                            <field name="birth_day"/>
                            <field name="met_doctor"/>
                            <field name="last_meeting" attrs="{'invisible':[('met_doctor','=',False)],'required':[('met_doctor','=',True)]}"/>
                        </group>
                    </sheet>
                </form>
            </field>
        </record>

        <!-- """Create Tree View""" -->

        <record id="clinic_patient_tree_view" model="ir.ui.view">
            <field name="name">clinic.patient.tree</field>
            <field name="model">clinic.patient</field>
            <field name="arch" type="xml">
                <tree string="Patients">
                    <field name="first_name"/>
                    <field name="second_name"/>
                    <field name="third_name"/>
                    <field name="forth_name"/>
                </tree>
            </field>
        </record>

        <!-- """Create Action View""" -->

        <record id="clinic_patient_action_view" model="ir.actions.act_window">
            <field name="name">Patients</field>
            <field name="res_model">clinic.patient</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="clinic_patient_tree_view"/>
        </record>


        <!-- """Create the root menu """ -->

        <menuitem id="clinic_root_menu"
            name="Clinic Patient"
            sequence="1"
        />

        <!-- """Create the Configration menu """ -->

        <menuitem id="clinic_patient_main_menu"
            name="Patients" sequence="2"
            parent="clinic_root_menu"
        />

        <!-- """Create the Company's Projects menu""" -->

        <menuitem
            name="Patients"
            parent="clinic_patient_main_menu"
            action="clinic_patient_action_view"
            id="patients_action_menu"
            sequence="5"
        />

    </data>
</odoo>


Watch on YouTube


  PREVIOUS STEP            NEXT STEP

Saturday, December 7, 2019

object with simple view in odoo

ODOO

 

views

 

On this step we will create object with simple view
    As we decided we are going to design clinic erp system as today we will start to create patient model so as we know in our module structure we create models folder which is contain python files , also we will create views folder which will contain xml files so let us start …
First : create patient object in python file by name “clinic_patient.py” inside models folder which we must create inside our module just as bellow …

# -*- coding: utf-8 -*-
from odoo import api, fields, models, _

class ClinicPatient(models.Model):
    _name = 'clinic.patient'
    _description = "object contain all patient data"

    first_name = fields.Char(string='First Name', required=True)
    second_name = fields.Char(string='Second Name', required=True)
    third_name = fields.Char(string='Third Name', required=True)
    forth_name = fields.Char(string='Fourth Name', required=True)


   Now we created new object with name "clinic.patient" which will create new table in the database by name "clinic_patient" which is also contain four fields (names) , then we must create view file for this model by name “clinic_patient_view.xml” inside views folder which we create inside our module as bellow …
 First : create new file inside view folder and save it by name "
clinic_patient_view.xml"
second : open it and and edit it as bellow ...

 <?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>

        <!-- """Create Form View""" -->

        <record id="clinic_patient_form_view" model="ir.ui.view">
            <field name="name">clinic.patient.form</field>
            <field name="model">clinic.patient</field>
            <field name="arch" type="xml">
                <form string="Patient">
                    <sheet>
                        <table style="width:100%;">
                            <tr style="width:100%;">
                                <td style="width:20%;">
                                    <b style="font-size:13px;">
                                        Name
                                    </b>
                                </td>
                                <td style="width:20%;font-size:13px;">
                                    <field name="first_name" placeholder="First Name"/>
                                </td>
                                <td style="width:20%;font-size:13px;">
                                    <field name="second_name" placeholder="Second Name"/>
                                </td>
                                <td style="width:20%;font-size:13px;">
                                    <field name="third_name" placeholder="Third Name"/>
                                </td>
                                <td style="width:20%;font-size:13px;">
                                    <field name="forth_name" placeholder="Fourth Name"/>
                                </td>
                            </tr>
                        </table>
                    </sheet>
                </form>
            </field>
        </record>

        <!-- """Create Tree View""" -->

        <record id="clinic_patient_tree_view" model="ir.ui.view">
            <field name="name">clinic.patient.tree</field>
            <field name="model">clinic.patient</field>
            <field name="arch" type="xml">
                <tree string="Patients">
                    <field name="first_name"/>
                    <field name="second_name"/>
                    <field name="third_name"/>
                    <field name="forth_name"/>
                </tree>
            </field>
        </record>

        <!-- """Create Action View""" -->

        <record id="clinic_patient_action_view" model="ir.actions.act_window">
            <field name="name">Patients</field>
            <field name="res_model">clinic.patient</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="view_id" ref="clinic_patient_tree_view"/>
        </record>


        <!-- """Create the root menu """ -->

        <menuitem id="clinic_root_menu"
            name="Clinic Patient"
            sequence="1"
        />

        <!-- """Create the Configration menu """ -->

        <menuitem id="clinic_patient_main_menu"
            name="Patients" sequence="2"
            parent="clinic_root_menu"
        />

        <!-- """Create the Company's Projects menu""" -->

        <menuitem
            name="Patients"
            parent="clinic_patient_main_menu"
            action="clinic_patient_action_view"
            id="patients_action_menu"
            sequence="5"
        />

    </data>
</odoo> 

 Whatch On YouTube 


 
  PREVIOUS STEP         NEXT STEP

Odoo Invoice Qr code issues

There are two main issues must of us facing with the QR code in Odoo invoice & these issues are 1/ QR code displayed as broken image w...