Monday, December 23, 2019

create notebook view, kanban view in odoo

ODOO

notebook

kanban

 
 
In this step we will create some view 
  • create notebook view
  • create kanban view
Notebook is away to view fields as note that contains many pages , so as example we will create notebook view for 'clinic.doctor' consist of two page ' patients page ' & 'doctor's qualifications' so we will go to 'clinic.doctor' object and add the field of qualifications & specialty as bellow 

qualifications = fields.Html(string="Qualifications")
specialty = fields.Many2one('doctor.specialty', string="Specialty")
academic_degree

and in the 'clinic_doctor.py' file we will add new class by name 'DoctorSpecialty' which will contain all specialties for the doctors 'name field only', just as bellow 

class DoctorSpecialty(models.Model):
    _name = "
doctor.specialty"
    _description = "
Doctor Specialty
      
     name = field.Char(string="Name")

Then we have to go to 'clinic_doctor_view.xml' file and add the notenook view as bellow ..

<notebook>
    <page string="Patients">
         <group colspan="2" col="2">
             <field name="patient_ids" nolabel="1"/>
         </group>
    </page> 
    <page string="Qualifications">
         <group colspan="4" col="4">
              <field name="specialty"/>
              <field name="academic_degree"/>
              <field name="university"/>
              <field name="graduate_year"/>
         </group>
         <group colspan="2" col="2">
             <field name="qualifications" nolabel="1"/>
         </group>
    </page>
</notebook>

Then we will create kanban view for 'clinic.doctor' object in which we will put just the important fields for the doctor just as "name, specialty, image"

Now we will create kanban view for the 'clinic.doctor' object by adding the code bellow to the 'clinic_doctor_view.xml' file

<!-- """Create kanban View""" -->

        <record id="clinic_doctor_kanban_view" model="ir.ui.view">
            <field name="name">clinic.doctor.kanban</field>
            <field name="model">clinic.doctor</field>
            <field name="arch" type="xml">
                <kanban >
                    <field name='id'/>
                    <field name="image"/>
                    <field name="specialty"/>
                    <templates>
                        <t t-name="kanban-box">
                            <div class="oe_kanban_global_click" style=" border: 1px solid #d9d7d7; border-radius: 5px !important;">
                                <div class="o_kanban_image">
                                    <img t-att-src="kanban_image('clinic.doctor','image',record.id.raw_value)" alt="Image"/>
                                </div>
                                <div class="oe_kanban_details">
                                    <ul>
                                        <li style="font-size:16px;color:blue !important;"><b>Name :</b> <field name="name"/></li>
                                        <li><b>Specialty :</b> <field name="specialty"/></li>
                                    </ul>
                                </div>
                                <div class="o_kanban_record_bottom">
                                    <div class="oe_kanban_bottom_left" style="margin-left:8px;">
                                        <b> A.D :</b> <field name="academic_degree"/>
                                    </div>
                                    <div class="oe_kanban_bottom_right" style="margin-right:40px;">
                                        <b> Age :</b> <field name="age_year"/>
                                    </div>
                                </div>
                            </div>
                        </t>
                    </templates>
                </kanban>
            </field>
        </record>


Watch On YouTube



PREVIOUS STEP            NEXT STEP

No comments:

Post a Comment

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...