Monday, August 30, 2021

Display current company data

 In this blog we will explain how to display current company data in web page in odoo 14


First we can get the current company in the web page template by using
request.env.user.company_id


so we can show the current company logo by using 

<img t-if="request.env.user.company_id.logo" t-att-src="image_data_uri(request.env.user.company_id.logo)" style="max-height:45pt;max-width:90%" alt="Company Logo"/>
 
and we can show the current company name by using

<span t-esc="request.env.user.name"/>

and so on to display each field in the model res.company

Wednesday, June 16, 2021

cached report in odoo

    Let us say that we have report in odoo and we print it for the first time and then made changes in the data and after we print the report again it still show the first time report 

    For an example : we create an invoice with 1000 usd and register payment with 400 usd and print the invoice and the report show the payment , then we made another payment with 450 usd and when we print the report again it still show the first payment only and review the code and there is no error ???

    Now to fix this we have to go to settings/technical/actions/reports and search for the invoice report and open it to find a field with the name "Reload from Attachment " and set it to false as in the image bellow


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


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