Monday, September 20, 2021

ModuleNotFoundError: No module named 'psycopg2'


 I got this error when I'm trying to run odoo server 


ModuleNotFoundError: No module named 'psycopg2'


so to fix it , I run the commands bellow

sudo apt-get update
sudo apt-get install libpq-dev
sudo pip3 install psycopg2-binary
 & for runing odoo 15.0 with python 3.8 we can use 
sudo python3.8 -m pip install --upgrade psycopg2-binary 

The style compilation failed


When I'm trying to run odoo server , I'm facing this error The style compilation 

failed, see the error below. Your recent actions may be the cause, please try reverting the changes you made

So to fix it I run the commands bellow

sudo pip3 install libsass==0.12.3
sudo apt install python3-libsass

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 
 

 

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