HABTM stands for Has And Belongs To Many.
Its is a cake php associations that we defined in a models for accesing associated data across different entities over the database tables.
Example - A product have more then one tags, and in the s...
CakePHP have several In-built sessions configurations. We can use these sessions as the basis or can create a fully custom solution for that. To use defaults inbuilt sessions, we can simply set the defaults
key to the name and can override any s...
We can achieve this using javascript or using jquery.Below methods demonstrate it.
Method 1: Use any JavaScript to include another js file.
Step 1: Add following function in your page.
function includeScript(url)
{
var head = ...
In update records can be updated using write(), it takes a list of records to update and a mapping of updated fields to values similar to create() .for example code is like below.
models.execute_kw(db, uid, password, 'res.partner', 'write', [[...
For redirecting http to https, please follow the below steps :-
First - Please Open .htaccess file from /public OR /public_html.
Second - Add below code in opened .htaccess at the top.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteR...
In PHP there is a feature which allows to write code in a different file and call it where ever there is a need for executing the code. this can be done by using the include and require functions.
with the help of the these two functions we ca...
Odoo provides a search_read() shortcut which as its name notes is equivalent to a search() followed by a read(), but avoids having to perform two requests and keep ids around.for example code is like below.
models.execute_kw(db, uid, password,...
$_SERVER is a PHP super global variable which holds information about headers, paths, and script locations.
The example below shows how to use some of the elements in $_SERVER.
<?php
echo $_SERVER['PHP_SELF'];
echo "<br>";
echo ...
In record data is accessible via the read() method, which takes a list of ids (as returned by search()) and optionally a list of fields to fetch.
ids = models.execute_kw(db, uid, password,
'res.partner', 'search',
[[['is_company', '=...
In count records retrieve a list of records and count them, search_count() can be used to retrieve only the number of records matching the query. It takes the same domain filter as search() and no other parameter.For example code is like below.
...
Code generation: CakePHP Framework generates the code automatically using the bake command which enable the developer to execute the bake command.
Database: programmer is not required to write Insert, update, select & delete queries becaus...
As we know that , Node js is a single threaded application but it also support concurrency based on concept of event and callbacks.
Every api that we are doing using node.js are asynchronous and single thread,node js uses asynchronous fu...
Every android device has a local ip address and we can easily get that ip address for our backend purpose like we can save that ip address to our server.
In below method NetworkInterface is a interface that provides many methods to get device ...
Hello Readers ,
The following code demonstrate how you would accomplish common tasks with the Facebook SDK for PHP.
This SDK can be use in facebook login , Retrieve a user's profile , Post a link to a user's feed.
window.fbAsyncInit =...
If you want to create Item view function check below example. In the below example I have created a Advanced class. By using Advanced adpater many opretions can be consumed. In Advanced adapter we can easily use view holder method. Adapter call t...
What is utilization of str_replace () function ?
there are 3 main uses of str_replace () function in php.
1-str_replace() function supersedes some characters with some other characters in a string.
2-str_replace() Supersede all occurren...
The following method can help you to find device manufacturer name and model name. To get these details Android provides Build class to get system properties like Build.MANUFACTURER returns the device build name.
Build.MODEL returns the model ...
If user pass errors and data then we use Error-first callbacks .There are two argument in callbacks. first argument is always an error object which is for to check if something went wrong. and we use additional argument along with this paramete...
What is the strpos() function ?
The strpos() function searches for a concrete text within a string.
In other word we can say that strpos() function use for searching position of Text Within a String.
If text word match will found, th...
In Android we can download a file from a given url so that we can use that file's data without downloading again and again so we save that file in internal or external storage of device.
you can use this method to download your file, you have ...
We can use array_reverse function to invert the values of array.This way we can allow them to get reverse order.
Ex : -
$data = Array(
'ProductA',
'ProductB',
'ProductC',
'ProductD',
'ProductE'
);
foreach ( array_reverse(...
CakePHP uses the exceptions internally to show the logical cake PHP errors. All of the exceptions that occur in CakePHP raises a CakeException.
CakePHP is also having the number of exception classes that we can use for HTTP errors.
For con...
If you want to make your page more reliable ,then Use HtmlHelper instead of html tag in your (xyz.ctp). CakePHP Helper will enable your application more light & flexible. By using these HtmlHelper ,we can create well formed markup in our Cake...
To change the action overflow menu icon first you need to create a style for the overflow icon in which you need to set the new icon then use this style in your app theme.
Step 1
Create a style for your menu overflow icon in styles.xml and set...
For this modify the php.ini files in your xampp folder.These three file you have to change to enable curl library with XAMPP in Windows
Browse and open these 3 files
C:\Program Files\xampp\apache\bin\php.ini
C:\Program Files\xampp\php\php....
Whenever textarea is replaced by TinyMCE, at that time it will hidden and TinyMCE editor which is an iframe is display in place of this.
When we make standard form submission then it is handled by TinyMce. But in case of Ajax form submission,w...
Firstly let us know What is the user defined function in php ?
This function declaration starts with the word "function" and user defined function name is not case-sensitive.
User defined function starts with a letter not a number.
Use...
What is tht arsort() function in php ?
The arsort() function sorts an associative array in descending order, as reported by the value.
why use arsort() function in php ?
arsort() is fundamentally used when sorting associative array in ...
Hi,
It is one of the important topics in java.
For dynamically resizable array we use ArrayList. ArrayList provides us fast access as compare to simple
array.
1. As we go to synchronization, Vector is synchronized means at a single time o...
Hi,
I am explaining the difference between HashSet and TreeSet in Java.
First of all they both come from the same family. They implement the Set Interface.
In HashSet, values store in random order. That means it is not sure that the ele...
For current cordinate we have to add a button resetting the product's coordinates to the location of the user, you can get these coordinates using the javascript geolocation API.
Now we would like to display an additional button to automatically...
To Add two fields to product for storing a latitude and a longitude, then for this you have to create a new form widget to display the latitude and longitude of a product's origin on a map.
Displaying the two position fields and a map widget usi...
RSS simply means Really Simple syndication, this is a xml document which is created by a website.
You need to parse this xml file and show the information:-
Here is the code that can help you :-
Step 1:-Declare the variable of which you wa...
Hello Readers
In php there are many different ways to get the data from one page to another page in php.
Using session by passing values between pages: This is the one of the method to get the data from one page to another page in php and...
To Create a transit location with company_id being the given company_id. This is needed in case of resupply routes between warehouses belonging to the same company, because we don't want to create accounting entries at that time. For this use thi...
Generate Dynamic Table content by using form fields in AngularJs
We all know that "AngularJs" is adopting vastly. We already found so many example of AngularJs and Application in AngularJS.
We had created an example of "AngularJs" relate ...
To create a Field Color class, the value of this field should be a string containing a color code like those used in CSS. This color field should display in block whose color corresponds to the value of the field. In read-write mode. For more see...
In Read-only fields, which only display content and don't allow the user to modify it can be useful, but most fields in Odoo also allow editing.
In the write field the Abstract field class sets a widget property named effective_readonly. The fie...
To create Account Analytic Line to compute the line and inherit the class account_analytic_line in odoo-9 then write this function in .py file in your module in odoo.
Use this code show in given below
def _compute_accountanalytic(self, d...
What is tht asort() function in php ?
The asort() function sorts an associative array in ascending order as reported by the value.
why use asort() function in php ?
asort() is fundamentally used when sorting associative array where the...
We can split sublime editor into 2 or more screen in any one of the following 2 ways :-
I am going to tell you how to split it into 2 screens, using the similar way you can split in into more than 2 screens also or vice-versa.
1>...
Odoo web provides a helper for easy and clear questioning of models query() which functions as a shortcut for the usual combination of search() and read(). As shown in example code given below.
model.query(['name', 'login', 'user_email', 'si...
Sometimes we need select option of a drop-down dynamically by clicking on a button or on some other action. We can do this by using "selected" property.
Example- In the below example I have a drop-down for distance and I want to select option ...
The context is like a "magic" argument that the web client will always give to the server when calling a method.
The context is a dictionary containing multiple keys. One of the most important key is the language of the user, used by the server ...
In below example a sample widget that calls my_method() and displays the result.
local.HomePage = instance.Widget.extend({
start: function() {
var self = this;
var model = new instance.web.Model("oepetstore.message_of_th...
Most operations with Odoo involve communicating with models implementing business concern, these models will then interact with some storage engine.
JQuery provides ajax function for network interactions, communicating with Odoo requires additio...
In the class system of the Odoo web framework allows direct modification of existing classes using the include() method.
This system is similar to the inheritance mechanism, except it will alter the target class in-place instead of creating a ne...
A function is a group of statements that does a special task. the function can be called repeatedly to execute the same statements.
The syntax of the user defined functions in php is as :
function functionName() {
code to be executed;
...
How to make Draw on a Canvas in Android.
If you want to create Draw on a Canvas function check below example. In the below example I have created a Suraface class. Canvas works like as an interface. I have also used onDraw() method for drawing e...
What is tht implode() function in php ?
The implode() function basically utilized to join elements of an array with a string. So in other word we can say, it takes an array and returns a string.
syntax of implode() function
implode (sep...