by Igor | Apr 9, 2015 | Odoo, Programming
This is second article about creating setup module for odoo.
You can create setup module for odoo and change company info.
There is no need for installing modules one by one and after that change company name, address, phone numbers, vat number, logo etc.
With this code you can change company info:
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="base.main_company" model="res.company">
<field name="name">Your company</field>
<field name="rml_header1"></field>
<field name="currency_id" ref="base.HRK"/>
<field name="street">Your address</field>
<field name="zip">HR-10 000</field>
<field name="city">Zagreb</field>
<field name="country_id" ref="base.hr"/>
<field name="email">info@yourcompany.com</field>
<field name="phone">+385 1 123 456</field>
<field name="fax"> +385 1 123 456</field>
<field name="website">www.yourcompany.com</field>
<field name="vat">HR12345678910</field>
<field name="company_registry">1234567</field>
</record>
</data>
</openerp>
Complete module is available for download from github:
https://github.com/netjunky-hub/company_setup
Related articles:
http://netjunky.net/create-setup-module-for-odoo-and-change-company-logo/
by Igor | Apr 8, 2015 | Odoo, Programming
This is first article about creating setup module for odoo.
You can create setup module for odoo and change company logo or add other customizations (module dependencies etc.).
There is no need for installing modules one by one and after that change company name, address, phone numbers, vat number, logo etc.
Please refer the following link to learn about creating a module in Odoo 8:
https://www.odoo.com/documentation/8.0/howtos/backend.html#build-an-odoo-module
With this code you can change company logo:
# -*- coding: utf-8 -*-
import openerp
from openerp.osv import osv
from openerp import tools
import os
from openerp.tools import image_resize_image
class res_company(osv.osv):
_inherit="res.company"
_name="res.company"
def init(self, cr):
img=open(os.path.join(os.path.dirname(__file__), 'static', 'src', 'img','logo.png'), 'rb') .read().encode('base64')
cr.execute('UPDATE res_partner SET image=%s WHERE is_company=TRUE', (img,))
size = (180, None)
cr.execute('UPDATE res_company SET logo_web=%s', (image_resize_image(img, size),))
1.) Inherit from res.company
2.) Update default image in res_partner and res_company tables
Place your logo in static\src\img folder
Complete module is available for download from github:
https://github.com/netjunky-hub/company_setup
Related articles:
http://netjunky.net/create-setup-module-for-odoo-and-change-company-info/
More soon…
by Igor | Apr 4, 2015 | Hosting, Linux
How to enable linux root access on Microsoft Azure Cloud
1. Login via ssh using your sudo user on your Microsoft Azure linux server
2. Now login as root user
[root@lin ~]# sudo su -
3. check if root access is set (LOCK means that root access is disabled)
[root@lin ~]# grep root /etc/shadow
Result:
root:*LOCK*:14600::::::
4. enable root access (as root user enter command passwd)
[root@lin ~]# passwd
5. Now enter your password and root access is enabled.
You can check this by using command “grep root /etc/shadow”
That’s all folks
by Igor | Mar 25, 2015 | Hosting
You can enable IP Geolocation to have CloudFlare geolocate visitors to your website and pass the country code to you.
Redirect web traffic based on Country origin to subdomain or to different web site.
You will find the IP geolocation option by going to:
Webiste –>CloudFlare Settings –>IP Geolocation
Direct link is:
https://www.cloudflare.com/cloudflare-settings?z=YOURSITE
Once enabled, Cloudflare will then add a header called “CF-IPCountry” to all requests to your website.
Here are a couple of examples of how to access/store this value:
$country_code = $ENV{"HTTP_CF_IPCOUNTRY"}; # to access in Perl
$country_code = $_SERVER["HTTP_CF_IPCOUNTRY"]; // to access in PHP
CloudFlare includes this information for both IPv4 and IPv6 addresses
In your website code capture that header and redirect traffic.
Redirect web traffic based on Country origin PHP sample:
$country_code = $_SERVER["HTTP_CF_IPCOUNTRY"];
if($country_code=="US"){
$location='http://www.mysite.com/us';
}elseif($country_code=="UK"){
$location='http://www.mysite.com/uk';
}else{
$location='http://www.mysite.com/us';
}
header("location:$location");
exit;
Update:
ASP.NET example:
http://netjunky.net/redirect-web-traffic-with-cloudflare-and-asp-net/
by Igor | Mar 24, 2015 | Hosting, Linux
Delete exim queue sometimes is impossible task.
There are just to many emails and queue manager is to slow.
You can use this dirty trick:
cd /var/spool/exim
find input -type f -exec rm -rf {} \;
find msglog -type f -exec rm -rf {} \;
service exim restart
Warning
This will erase all your emails from queue.
Recent Comments