Skip to main content

Posts

Showing posts from 2015

Odoo: Mollie Payment Gateway Integration

Since few days I was working on Mollie Payment Gateway Integration with Odoo . Finally I have done it successfully. If anyone needs any kind of help in form of it's integration, coding problems, working structure or if you are interested in buying this module, you can contact by through comments on this post. Update: Now Mollie Payment Acquirer Module(Odoo 8) is available for sale on Odoo webshop as well. Buy Here Thanks!!!! Enjoy Programming :)

Js/jQuery load alternative images synchronously?

You can find lot of links over Internet, how to load alternative images but most of them give examples of asynchronously loading not synchronously one. I was facing the same problem and it took around 4 hours for me to fix it and now it looks simple :) Scenario 1(simple): ======================= You have two images and want to show the 2nd one, in case 1st one is not valid. Use following image tag: <img src="'+src+'" onError="this.onerror=null;this.src=\'https://browshot.com/static/images/not-found.png\'" />;  Note: Please don't forget to add this.onerror=null otherwise browser may stuck in a loop. Scenario 1(typical): ======================= You have three images: 1. Show image1 if valid otherwise image2. 2. If image2 is also invalid show 3rd one. In this case we have to use above code as well as one more function for middle image. Not working -------------------- You can use following code in JS and looks like i

Laravel Unique Validation

Hi, You can find most of the things on the following link regarding unique validation in Laravel. http://brianretterer.com/quick-tip-laravel-unique-validation/ But I would like to add one more case to make it little easy to understand: articleName => unique:articles,article_name,{isset(article_id) : article_id : NULL },article_id,user_id,{user_id} The query that this will give you is:  Select count(*) as aggregate from articles where article_name = <given_article_name> and article_id <> {article_id} and user_id={user_id} It will check unique article name per user. Multiple users can have same article name but one user can't have same article name again, only once.   Thanks!!!!!!!!! Enjoy Programming :)  

Implementation of free3of9 bar-code in Odoo/OpenERP

Following are the steps to implement free3of9 bar-code in Odoo/OpenERP. 1. Install fonts(.ttf) files on your server. a. You can download free3of9 bar-code files from here: http://www.barcodesinc.com/free-barcode-font/free3of9.zip b. Extract/unzip folder and copy extracted ' free3of9 ' folder in ' /usr/share/fonts/ ' folder only with .ttf files. 2. Odoo use two codes for 3of9 bar-code.  Standard39 for Normal 3of9 and Extended39 for Extended 3of9 or New 3of9 3. In Odoo you can use it as follow based on your .rml or .xml file a. For .rml file: <barCode code=" Standard39 " fontName="Times-Roman" fontSize="30" alignment="CENTER"> [[ o.name or '' ]] </barCode> b. For .xml file: <img t-att-src="'/report/barcode/?type=%s&amp;value=%s&amp;width=%s&amp;height=%s' % (' Standard39 ', o.name, 600, 100)" style="

Odoo/OpenERP: Barcodes supported by Odoo

Following is the list/matrix of most popular bar-codes supported by Odoo. 1D Product 1D industrial 2D Code Name Bar-code Type Odoo Code Code Name Bar-code Type Odoo Code Code Name Bar-code Type Odoo Code UPC-A upca UPCA Code 39 code39 Standard39 QR Code qr QR UPC-E upce UPCE Code 39 (extended) code39 Extended39 EAN-8 ean8 EAN8 Code 93 code93 Standard93 EAN-13 ean13 EAN13 Code 93 (ex

Odoo/OpenERP: Picking List printing blank barcode?

Are you facing a problem with bar-code in picking list. Is it displaying nothing? Reason is: Odoo uses reportlab to print barcode images and reason of showing blank barcode means reportlab fonts are missing. Follow following steps to install reportlab fonts: 1. Login to your server as root user. 2. Open terminal and go to location: '/usr/lib/python2.7/dist-packages/reportlab/' Check if 'fonts' directory is there? If not, create it. 3. Go to 'fonts' folder and Download Zip file from here: http://www.reportlab.com/ftp/pfbfer.zip i.e $ wget http://www.reportlab.com/ftp/pfbfer.zip extract it and delete pfbfer.zip  4. Restart your server. That's it. Thanks!!!!!!!! Enjoy Programming!!! :) Reference Links: https://github.com/odoo/odoo/issues/3234  

JS : Force new Date() to use local or server time?

Day to day we face lot of issues with Date() object in JS. Some are as follow: - new Date() works differently in Chrome and Firefox. - new Date() is taking local or server time. - How to force Date() to use either local or server time etc.. etc.. Reason is sometimes we are using new Date() object how it should have been used. In this post we are going to cover how to force new Date() function to use either local time or server time across all the browsers, which indirectly will solve most of the issues. 1. How to force new Date() to use local time? If you are not passing any date to this Date() object it will automatically takes local time only. But if you are getting some date from server or from some scripting language like PHP for example: $_SERVER_DATE_TIME= "12 15 2014 04:41:16"; //PHP Code and you want to use this to convert it into local time. Best solution is to convert it into Zulu time and make the format like this: js_compatible_local_tim

Install Odesk Tracker in Ubuntu

Today, I tried to install Odesk Tracker on by Ubuntu machine but it was throwing a number of errors. shiv@localhost:~$ sudo dpkg -i ~/Downloads/odeskteam_3.12.9_i386.deb  (Reading database ... 294217 files and directories currently installed.) Preparing to unpack .../odeskteam_3.12.9_i386.deb ... Unpacking odeskteam (3.12.9) over (3.12.9) ... dpkg: dependency problems prevent configuration of odeskteam:  odeskteam depends on libphonon4 (>= 4:4.2.0). odeskteam depends on phonon. dpkg: error processing package odeskteam (--install):  dependency problems - leaving unconfigured Processing triggers for mime-support (3.54ubuntu1.1) ... Processing triggers for gnome-menus (3.10.1-0ubuntu2) ... Processing triggers for desktop-file-utils (0.22-1ubuntu1) ... Processing triggers for bamfdaemon (0.5.1+14.04.20140409-0ubuntu1) ... Rebuilding /usr/share/applications/bamf-2.index... Errors were encountered while processing:  odeskteam Tried to install dependencies as well but no use. Same l

Simple example of datatables

Today's post is about use of datatables. Lot of examples are available on Internet. This example is just to explore it little more and explains how to read data from xml and display using datatables. <?php $file_url=' blog.xml '; $file_content = file_get_contents($file_url); $xml_string_arr=simplexml_load_string($file_content); //Optional: Start of code if you want to add some attribute to xml //code to add unique_id attribute /*foreach( $xml_string_arr->xpath("entry") as $r ) {     $attrs = $r->attributes();        if(!$attrs['unique_id'])         $r->addAttribute('unique_id', $r->id); } $xml_string_arr->asXML($file_url);*/ //End of code if you want to add some attribute to xml $json = json_encode($xml_string_arr); $arr_new = json_decode($json,TRUE); $required_content_arr = $arr_new['entry']; ?> <!DOCTYPE html> <html> <head>     <title>Task3</title>     <link rel="styleshe

Odoo/OpenERP: Create multiple workflows in a single module

Today's post is about : How to create multiple workflows for multiple models in a single module. Few days back, I created a module custom_account with two models custom_expense and custom_payment. I created two different but almost similar workflows for both of them. When I installed the module, only latter one was working. What could be the reason? Problem was with Activity and Transition ids. I was using same ids in both the workflows. Check following: Old Code: custom_expense_workflow_view.xml         <!-- Activity -->                 <record id="act_draft" model="workflow.activity">             <field name="wkf_id" ref="custom_expense_workflow"/>             <field name="flow_start">True</field>             <field name="kind">dummy</field>             <field name="name">draft</field>         </record>                           &