Technical

Mysql crashed and won’t start up


  1. Stop mysqld.
  2. Backup /var/lib/mysql/ib*
  3. Add the following line into /etc/my.cnf

innodb_force_recovery = 1 (they suggest 4, but its best to start with 1 and increment if it won’t start)

  1. Restart mysqld.
  2. Dump all tables:# mysqldump -A > dump.sql
  3. Drop all databases which need recovery.
  4. Stop mysqld.
  5. Remove /var/lib/mysql/ib*
  6. Comment out innodb_force_recovery in /etc/my.cnf
  7. Restart mysqld. Look at mysql error log. By default it should be /var/lib/mysql/server/hostname.com.err to see how it creates new ib* files.
  8. Restore databases from the dump:mysql < dump.sql
Advertisements

How to add custom font to qweb report


1). Create font folder under “module_name/static/src/fonts/”


2). create .css file (ref :https://css-tricks.com/snippets/css/using-font-face/)


@font-face {
    font-family: 'calibri';
    src: url('../fonts/Calibri.eot'); /* IE9 Compat Modes */
    src: url('../fonts/Calibri.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
         url('../fonts/Calibri.woff2') format('woff2'), /* Super Modern Browsers */
         url('../fonts/Calibri.woff') format('woff'), /* Pretty Modern Browsers */
         url('../fonts/Calibri.ttf')  format('truetype'), /* Safari, Android, iOS */
         url('../fonts/Calibri.svg#Calibri') format('svg'); /* Legacy iOS */
}
.footer_text
{
    font:normal 12px calibri !important;
    text-align: center !important;
    color: #000000 !important;
    padding-top: 5px !important;
}

3). Add your new style sheet

<?xml version="1.0" encoding="UTF-8"?>
<openerp>
    <data>
    <template inherit_id="report.minimal_layout" id="minimal_layout_inherit">
      <xpath expr="//head" position="inside">
             <link rel='stylesheet' href="/feag_header_footer/static/src/css/feag_layout_style.css"/>
             <link rel='stylesheet' href="/feag_header_footer/static/src/css/feag_report_style.css"/>
      </xpath>
    </template>
    </data>
</openerp>

4). now you can use the class in HTML tags. eg.

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