Wednesday, March 31, 2021

order recordset in odoo

 

 

In this blog we will explain how to order recordset in odoo with the search() function

      So let us say we have object "student.student" and we have to build function that must return all student with age = 12 years and sort the ids with the id of the record, so we can build it as bellow

def student_filter(self):
     student_ids = self.env['student.student'].search([(' age','=',12)], order='id')
     return student_ids

Friday, March 26, 2021

java test for beginners

 


In this blog we will give some questions in java for beginners

what is programming ?
________________________________________________________________________________
________________________________________________________________________________

what is program ?

________________________________________________________________________________
________________________________________________________________________________

what is machine language ?
________________________________________________________________________________
________________________________________________________________________________

what is assembly language ?
________________________________________________________________________________
________________________________________________________________________________

what is assembler ?
________________________________________________________________________________
________________________________________________________________________________

what is variable ?
________________________________________________________________________________
________________________________________________________________________________

what is the compiler ?
________________________________________________________________________________
________________________________________________________________________________

define package , class and method ?
________________________________________________________________________________
________________________________________________________________________________

how can we define the programming language as high level programming language ?
________________________________________________________________________________
________________________________________________________________________________

mention all error types in java and explain each one ?
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________

mention data types in java and group them ?
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________

explain why can’t store number greater than 127 in integer variable ?
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________

explain variable scope ?
________________________________________________________________________________
________________________________________________________________________________

explain type casting with 3 examples ?
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________

explain OOP ?
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________

what is the scanner , and what it use for ?
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________

Is java sensitive case ?
________________________________________________________________________________

What is JVM?
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________

mention 5 words of java’s keywords ?
________________________________________________________________________________
________________________________________________________________________________

what does Object-Oriented Programming means ?
________________________________________________________________________________
________________________________________________________________________________

what are the bellow principles stand for ?
JVM ___________________________________________________________________________
JDK ____________________________________________________________________________
JRE ____________________________________________________________________________
JavaC __________________________________________________________________________
OOP ___________________________________________________________________________
JIN ____________________________________________________________________________
SDK ___________________________________________________________________________

Choose the right answer :

What do you mean by JRE?
   a. java runtime environment
   b. java runtime exception
   c. java runtime execution
   d. none of these

Java is a _____________language.
   a. object oriented 
   b. procedural oriented
   c. system oriented
   d. platform oriented

Previously Java was known as ________.
   a. Java onlyb. apple
   c. jdk
   d. oak

What is the extension of the Java program?
   a. .java
   b. .class
   c. .doc
   d. .txt

Which of the following operation(s) is/are required to convert the java source code into output form
   a. Compilation
   b. interpretation
   c. both a and b
   d. none of these

Is java 100% object oriented language?
   a. yes
   b. no
   c. can’t say

Java _________the program first and then __________it.
   1) compile
   2) interpret
   3) assemble
   4) debug
  
   a. 1 and 2
   b. 2 and 1
   c. 3 and 4
   d. 1 and 4

Java is developed by___________
   a. Microsoft
   b. Oracle
   c. Sun
   d. Google

What is JDK?
   a. java development kit
   b. java deployment kit
   c. java demo kit
   d. java distributed kit

In order to run Java program, we need to install __________application program.
   a. jdk
   b. sdk
   c. dbk
   d. all of the above

what is the correct syntax of rmain method in java ?
   a. public void main(String[] gars)
   b. public static void main(string []agrs)
   c. public static void main(String [] args)
   d. public static void Main(String []args)

what is an assignment statement ?
   a. adding a number to an integer
   b. assigning a multiplication
   c. assigning a name to a variable
   d. assigning a value to a variable

which of the flowing is not java keyword ?
   a. static
   b. try
   c. Integer
   d. new

choose the best data type to store this value 5.69
   a. int
   b. double
   c. boolean
   d. String

choose the appropriate data type for this field : isSwimmer
   a. double
   b. boolean
   c. string
   b. int

if you want your condition to depend upon two conditions Both begin true , What is the proper notation to put between the two Boolean statements
   a. =
   b. !=
   c. ||
   d. &&
   e. &

An object can be

   a. class
   b. anything
   c. program
   d. method 


                                              



Tuesday, March 23, 2021

kanban view in odoo




In this blog we will give and example to design kanban view in odoo
so the code can be just as bellow


<!-- """Create Kanban View""" -->

  <record id="view_ssc_projects_kanban" model="ir.ui.view">
    <field name="name">ssc.projects.kanban</field>
    <field name="model">ssc.projects</field>
    <field name="arch" type="xml">
      <kanban class="o_hr_employee_kanban">
        <field name="id"/>
        <templates>
          <t t-name="kanban-box">
            <div class="oe_kanban_global_click">

              <div class="o_kanban_image">
                <img t-att-src="kanban_image('ssc.projects','image',record.id.raw_value)" alt="Image"/>
              </div>

              <div class="oe_kanban_details">
                <h2>
                  <a type="open">
                    <field name="name" />
                  </a>
                </h2>
                <h4>
                  <a type="open" style="color:#04025e ! important;">
                   <field name="customer_id"/>
                 </a>
               </h4>
             </div>

           </div>
         </t>
       </templates>
     </kanban>
   </field>
 </record>


and the kanban view can look like bellow 
 

 

Tuesday, March 9, 2021

rounding in odoo


 In this blog we will explain how we can make rounding in odoo for float numbers
         

          as we know 10/3 = 3.333333333333X , and we can make rounding for this value as 3.34 or 3.334 or 3.33 or 3.3 or 3.333 , that is means we have more than one way to make rounding in math , so how can we make rounding in odoo ?

To make rounding in odoo we can use round() function id takes 2 arguments the first one it the float number that we want to round it  ,and the second one is the number of rounding index so the Rule as

num = round(float_number,index_number)

so if we want to round 10/3 for 2 index with will be 3.34 we can do it as bellow

num = round(10/3,2)


Another way to make rounding in odoo is by using float_round() function with can takes 4 arguments as bellow

num = float_round(10/3,precision_digits=2, precision_rounding=None, precision_method='up' )

Saturday, March 6, 2021

less porblem with odoo 10


 

I had some problem with odoo 10 UI after installing some theme module , and I tried many ways to fix it , and only one way worked with me , which by running the command bellow in the terminal

sudo npm install -g less@3.0.4 less-plugin-clean-css


report color from user in odoo

 


In this blog we will explain how read report color from user in odoo . so let us make an example 


First : we have to define char field that will contain the color rbg as bellow

color = fields.Char(string="Color")

Second : create the view for this field as bellow 

<field name="color" widget="colorpicker"/>

or
<field name="color" widget="color"/>

after that the view will look like bellow 


 

Third : we can read our color in the report template as bellow

background-color:<t t-esc="color"/>!important; // to make it as back groud color for some element 

color:<t t-esc="color"/>!important; // to make it as text color

...

Eg : say we want to add it as back ground color for td in a table so we can do it as bellow

&lt;td style="width:100px;font-size:14px; border: 1px solid black;padding-top:2px; padding-bottom:2px;background-color:<t t-esc="color"/>!important; font-size: 14px; text-align:center;font-weight:bold;"
      <span t-esc="field_name"/>

&lt;/td &gt;



I used this with odoo 11 , and it worked :)

Thursday, February 11, 2021

One2many field in odoo


 In this blog we will explain how to control the line in one2many fields in odoo

 
(0, 0,  { values }) link to a new record that needs to be created with the given value
dictionary

(1, ID, { values }) update the linked record with id = ID (write *values* on it)
 
(2, ID) remove and delete the linked record with id = ID (calls unlink on ID,
that will delete the object completely, and the link to it as well)
 
(3, ID) cut the link to the linked record with id = ID (delete the relationship between
 the two objects but does not delete the target object itself)
 
(4, ID) link to existing record with id = ID (adds a relationship)
 
(5) remove all (like using (3,ID) for all linked records)
 
(6, 0, [IDs]) replace the list of linked IDs (like using (5) then (4,ID) for each ID in the list of IDs)

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