Technical

Odoo PyCharm Templates


Templates for Odoo in PyCharm

This Templates can help you to develop Odoo Modules Faster and with no Typing Errors

Download odoo.xml file and place in pycharm template folder

https://github.com/ananthukrishna/odoo-pycharm-templates/blob/master/Odoo.xml

Configuration:

Windows

C:\Users\user\.PyCharmCE2016.3\config\templates

If You are using a linux distribution you can save the XML file in PyCharm files, Just find the path:

~/.PyCharm*/config/templates

MacOs X users, look for the templates folder here:

~/Library/Preferences/PyCharm*/templates

and save the XML file there. Enjoy your time developing great Odoo Modules 🙂

odoo 10 custom css for report


STEP 1: Create CSS file:-

We have to create CSS file in the following directory:
/static/src/css/.css

STEP 2: Give path of your CSS file:-

Now put the following code in the xml file of the report.
In this code I have inherited the “minimal_layout” template of the
layout.xml file of the report module and gave path of the CSS file.

<template id="minimal_layout_inherit" inherit_id="report.minimal_layout">
<xpath expr="//head" position="inside">
	<link rel='stylesheet' href="/<module_name>/static/src/css/<file_name>.css"/>
</xpath>
</template>

Setting up a Sharp network Printer on Ubuntu


Add below line on ppd file before you install

*OpenGroup: Authentication
 
*% Base JCL key code option 
*OpenUI JCLPasscode/Key Code: PickOne
*OrderDependency: 10 JCLSetup *JCLPasscode
*DefaultJCLPasscode: None
*JCLPasscode None/No Code: ""
*JCLPasscode 1111: "@PJL SET ACCOUNTNUMBER = \"1111\""
*JCLPasscode 2222: "@PJL SET ACCOUNTNUMBER = \"2222\""
*JCLPasscode 3333: "@PJL SET ACCOUNTNUMBER = \"3333\""
*CloseUI: *JCLPasscode
 
*% Custom JCL key code option 
*CustomJCLPasscode True: "@PJL SET ACCOUNTNUMBER = \"\1\""
*ParamCustomJCLPasscode Code/Key Code: 1 passcode 1 8
 
*CloseGroup: Authentication

go to ubuntu pc localhost:631/printers

Add new printer with ppd file.

Increase Virtual Box Disk Size


To enlarge a virtual disk in VirtualBox, you’ll need to use the VBoxManage command from a Command Prompt window. First, shut down the virtual machine – ensure its state is set to Powered Off, not Saved.

11

Second, open a Command Prompt window from your Start menu and change to VirtualBox’s program files folder so you can run the command:

 cd “C:\Program Files\Oracle\VirtualBox”

22

The following command will operate on the VirtualBox virtual disk located at “C:\Users\Chris\VirtualBox VMs\Windows 7\Windows 7.vdi”. It will resize the virtual disk to 81920 MB (80 GB)

VBoxManage modifyhd “E:\VM\odoo\odoo.vdi” --resize 81920

44

(Use two dashes before resize in the command above.)

Replace the file path in the command above with the location of the VirtualBox disk you want to resize and the number with the size you want to enlarge the image to (in MB).

33

Note that this process doesn’t enlarge the partition on the virtual hard disk, so you won’t have access to the new space yet – see the Enlarge the Virtual Machine’s Partition section below for more information.

How to Add Custom Header and Footer in Odoo


Header

<template id=”report_quotation_header” inherit_id=”report.external_layout_header”>
<xpath expr=”//div[@class=’header’]” position=”replace”>
custom div
</xpath>
</template>

Footer

<template id=”report_quotation_footer” inherit_id=”report.external_layout_footer”>
<xpath expr=”//div[@class=’footer’]” position=”replace”>
custom div
</xpath>
</template>

How to create a first custome widget in odoo


1). Add js and xml file under resource folder.

rootfolder/static/src/css/petstore.css

rootfolder/static/src/js/petstore.js

aslo add these files on __openerp__.py file

11

2). petstore.js

openerp.petstore = function(instance, local) {

instance.web.form.widgets = instance.web.form.widgets.extend(
{
‘test’ : ‘instance.web.form.message’,
});

instance.web.form.message = instance.web.form.FieldChar.extend(
{
template: ‘test’,
start: function() {
var self=this;
$(‘button#message’).click(this.show_message);
},

show_message :function(){
alert($(‘span.oe_breadcrumb_item’).html());
}
});
}

 

3). rootfolder/static/src/xml/petstore.xml   (Qweb template file)

<?xml version=”1.0″ encoding=”utf-8″?>
<templates>
<t t-name=”test”>
<button name=”view_images” type=”object” id=”message” >Alert</button>
</t>
</templates>

 

4). call widget on data template

attach js and css on data file

<template id=”assets_backend” name=”petstore_assets” inherit_id=”web.assets_backend”>
<xpath expr=”.” position=”inside”>
<link rel=”stylesheet” href=”/petstore/static/src/css/petstore.css”/>
<script type=”text/javascript” src=”/petstore/static/src/js/petstore.js”/>
</xpath>
</template>

call widget

<field name=”name” widget=”test”/>

download source

Change Ubuntu Server from DHCP to a Static IP Address


Change Ubuntu Server from DHCP to a Static IP Address

If the Ubuntu Server installer has set your server to use DHCP, you will want to change it to a static IP address so that people can actually use it.

Changing this setting without a GUI will require some text editing, but that’s classic linux, right?

Let’s open up the /etc/network/interfaces file. I’m going to use vi, but you can choose a different editor

sudo vi /etc/network/interfaces

For the primary interface, which is usually eth0, you will see these lines:

auto eth0
iface eth0 inet dhcp

As you can see, it’s using DHCP right now. We are going to change dhcp to static, and then there are a number of options that should be added below it. Obviously you’d customize this to your network.

auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 192.168.1.1

Now we’ll need to add in the DNS settings by editing the resolv.conf file:

sudo vi /etc/resolv.conf

On the line ‘name server xxx.xxx.xxx.xxx’ replace the x with the IP of your name server. (You can do ifconfig /all to find out what they are)

You need to also remove the dhcp client for this to stick (thanks to Peter for noticing). You might need to remove dhcp-client3 instead.

sudo apt-get remove dhcp-client

Now we’ll just need to restart the networking components:

sudo /etc/init.d/networking restart

Ping http://www.google.com. If you get a response, name resolution is working(unless of course if google is in your hosts file).

Really pretty simple.

Updated Thanks to Nickname007 in the comments for noting that I forgot the DNS entries in the guide.

Schedule file transfers (or synchronization) to FTP/SFTP server using WinSCP


  1. install WinSCP on windows machine.
  2. create a batch file using below commands
  3. “C:\Program Files\WinSCP\WinSCP.com” /log=C:\automation_test\log.txt /command “option batch abort” “option confirm off” “open sftp://username:password@epillars.net/” “put C:\automation_test\Sample_ePillars.xlsx  /home/epillpyq/public_html/automation_test/” “exit”
  4. run the batch file using cmd or you can use task scheduler

bat1

bat2

bat3

press entre

bat4