<t t-extend="template_name">
<t t-jquery="[div,span,button,etc].class_name" t-operation="[replace,after,before]">
<-- your code -->
</t>
</t>
for example :
<t t-extend="website_sale.products_item">
<t t-jquery="div.product_price" t-operation="replace">
<-- your code -->
</t>
</t>
Showing posts with label OpenERP. Show all posts
Showing posts with label OpenERP. Show all posts
Wednesday, 17 June 2020
Odoo10 - How to inherit t-if tag and extend it template.
Labels:
#docker,
#error,
#odoo,
#odoo11,
#odoo12,
#openerp,
#ubuntu,
erp,
Jquery in odoo,
js,
many2many,
map view,
model,
Odoo,
OpenERP,
OpenERP v8
Thursday, 13 April 2017
How to call model objects at xml qweb?
<t t-foreach="request.env['your.model'].search([])" t-as="obj">
<t t-esc="obj.name"/>
</t>
Monday, 3 April 2017
Second approval from RFQ to PO (based on amount) in odoo
Step 1 : Go to Settings > Purchase > tick the field " Force two levels of approvals " and also you can set the limit amount in " limit to require a second approval ".
so when purchase order exceed this limit of amount. then system will ask for second approval from manager.
Step 2 : you can see in below screen shot that system showing second approved button for approval.
so when purchase order exceed this limit of amount. then system will ask for second approval from manager.
Step 2 : you can see in below screen shot that system showing second approved button for approval.
Thursday, 23 March 2017
what is ondelete optional parameter in odoo
It is
Foreign Key constraint on delete records in your object. These parameters define constraint on PostgreSQL level.
Restricting and cascading deletes are the two most common options.
RESTRICT prevents deletion of a referenced row. NO ACTION means that if any referencing rows still exist when the constraint is checked, an error is raised; this is the default behavior if you do not specify anything. (The essential difference between these two choices is that NO ACTION allows the check to be deferred until later in the transaction, whereas RESTRICT does not.) CASCADE specifies that when a referenced row is deleted, row(s) referencing it should be automatically deleted as well. There are two other options: SET NULL and SET DEFAULT. These cause the referencing columns to be set to nulls or default values, respectively, when the referenced row is deleted. Note that these do not excuse you from observing any constraints. For example, if an action specifies SET DEFAULT but the default value would not satisfy the foreign key, the operation will fail.Wednesday, 22 March 2017
How many widget we can use in odoo v8?
Here are the latest widgets and its following classes usable in odoo js to include or extend also use syntax widget="any_widget_name" with odoo views,
'char' : 'instance.web.form.FieldChar',
'id' : 'instance.web.form.FieldID',
'email' : 'instance.web.form.FieldEmail',
'url' : 'instance.web.form.FieldUrl',
'text' : 'instance.web.form.FieldText',
'html' : 'instance.web.form.FieldTextHtml',
'char_domain': 'instance.web.form.FieldCharDomain',
'date' : 'instance.web.form.FieldDate',
'datetime' : 'instance.web.form.FieldDatetime',
'selection' : 'instance.web.form.FieldSelection',
'radio' : 'instance.web.form.FieldRadio',
'many2one' : 'instance.web.form.FieldMany2One',
'many2onebutton' : 'instance.web.form.Many2OneButton',
'many2many' : 'instance.web.form.FieldMany2Many',
'many2many_tags' : 'instance.web.form.FieldMany2ManyTags',
'many2many_kanban' : 'instance.web.form.FieldMany2ManyKanban',
'one2many' : 'instance.web.form.FieldOne2Many',
'one2many_list' : 'instance.web.form.FieldOne2Many',
'reference' : 'instance.web.form.FieldReference',
'boolean' : 'instance.web.form.FieldBoolean',
'float' : 'instance.web.form.FieldFloat',
'percentpie': 'instance.web.form.FieldPercentPie',
'barchart': 'instance.web.form.FieldBarChart',
'integer': 'instance.web.form.FieldFloat',
'float_time': 'instance.web.form.FieldFloat',
'progressbar': 'instance.web.form.FieldProgressBar',
'image': 'instance.web.form.FieldBinaryImage',
'binary': 'instance.web.form.FieldBinaryFile',
'many2many_binary': 'instance.web.form.FieldMany2ManyBinaryMultiFiles',
'statusbar': 'instance.web.form.FieldStatus',
'monetary': 'instance.web.form.FieldMonetary',
'many2many_checkboxes': 'instance.web.form.FieldMany2ManyCheckBoxes',
'x2many_counter': 'instance.web.form.X2ManyCounter',
'priority':'instance.web.form.Priority',
'kanban_state_selection':'instance.web.form.KanbanSelection',
'statinfo': 'instance.web.form.StatInfo',
Tuesday, 21 March 2017
How can I activate the developer mode?
You can activate the developer mode in the About Box by clicking About from the menu under your username in the top right corner of Odoo:
Click Activate the developer mode
Click Activate the developer mode
Alternatively, you can insert the character string ?debug in the URL after your domain name and before the number sign "#".
Eg: http://mycompany.my.odoo.com/?debug#id=27&view_type=form&model=sale.order&menu_id=110&action=89
Eg: http://mycompany.my.odoo.com/?debug#id=27&view_type=form&model=sale.order&menu_id=110&action=89
The developer mode will display a menu at the bottom of each view giving you access to advanced administrative tools related to view edition, workflow edition, translation, javascript tests, debug information, record log, default values, user filters,...
Where is OpenERP v7 documentation?
First: Here is an intent to create an OpenERP documentation search engine:
Read:
- Installation Guides [v6.1] and [v7]
- EBooks: [Official e-books v6 & v6.1] and via [Facebook]
- Various functional readings: [Project management]
Watch:
- [Trainings, events and webinars] (select "webinar" category for online events, mostly free)
Watch (Overview)
Watch (Functional)
Watch (Technical)
Monday, 20 March 2017
How i can create module openerp 7 / Odoo 8 ?
Hi,
Quick Start Guide
For Odoo v8: https://www.odoo.com/documentation/8.0/
1°-Start reading:
Quick start :
Technical_Memento_v0.7.3(En)
Technical_Memento_v 7 (FR)
Official doc : Modules OpenERP v7
2°-Sample module :
Example 1 : Basics of developing a simple module in OpenERP
Example 2 : How to create a module in OpenERP ?
Example 3: Custom Sample Module Development
Example 4:Module structure of OpenERP module
Example 5:Adding additional fields
3°- Videos
Create a module (through interface not with python code)
Tools / IDE OpenERP
1°-IDE : I suggest Eclipse IDE : Eclipse Classic
2°-Python : plugin PyDev for eclipse : Installing the Eclipse PyDev plugin
3°-XML : Editor integrated with eclipse
4°-Templates Openerp :Template for eclipse of openerp code snippets. This snippets are build to help rapid building openerp project with great ease.
For Python Snippets
For XML Snippets
5°-OpenERP in eclipse.
Debug your openERP+python code in eclipse
OpenERP development environment in Windows using Eclipse.
6°-OpenERP V7.0 installation on ubuntu 12.04 x64
How to install OpenERP V7.0 on Ubuntu 12.04 from launchpad repository?
Quick Start Guide
For Odoo v8: https://www.odoo.com/documentation/8.0/
1°-Start reading:
Quick start :
Technical_Memento_v0.7.3(En)
Technical_Memento_v 7 (FR)
Official doc : Modules OpenERP v7
2°-Sample module :
Example 1 : Basics of developing a simple module in OpenERP
Example 2 : How to create a module in OpenERP ?
Example 3: Custom Sample Module Development
Example 4:Module structure of OpenERP module
Example 5:Adding additional fields
3°- Videos
Create a module (through interface not with python code)
Tools / IDE OpenERP
1°-IDE : I suggest Eclipse IDE : Eclipse Classic
2°-Python : plugin PyDev for eclipse : Installing the Eclipse PyDev plugin
3°-XML : Editor integrated with eclipse
4°-Templates Openerp :Template for eclipse of openerp code snippets. This snippets are build to help rapid building openerp project with great ease.
For Python Snippets
For XML Snippets
5°-OpenERP in eclipse.
Debug your openERP+python code in eclipse
OpenERP development environment in Windows using Eclipse.
6°-OpenERP V7.0 installation on ubuntu 12.04 x64
How to install OpenERP V7.0 on Ubuntu 12.04 from launchpad repository?
Thursday, 16 March 2017
How to Create service in odoo10
On Ubuntu 16.04, this is how you create a service for Odoo10:
You put this in /etc/systemd/system and I called my file odoo10.service so you can then do:
sudo systemctl start odoo10.service (starts service)
sudo systemctl stop odoo10.service (stops service)
sudo systemctl restart odoo10.service (restarts Service)
sudo systemctl status odoo10.service (status of service)
sudo systemctl enable odoo10.service (starts service at boot)
sudo systemctl disable odoo10.service (disables service at boot)
[Unit]
Description=Odoo
Documentation=http://www.odoo.com/
[Service]
# Ubuntu/Debian convention:
Type=simple
User=odoo
ExecStart=/opt/odoo10/odoo-bin -c /etc/odoo-server.conf
[Install]
WantedBy=default.target
You put this in /etc/systemd/system and I called my file odoo10.service so you can then do:
sudo systemctl start odoo10.service (starts service)
sudo systemctl stop odoo10.service (stops service)
sudo systemctl restart odoo10.service (restarts Service)
sudo systemctl status odoo10.service (status of service)
sudo systemctl enable odoo10.service (starts service at boot)
sudo systemctl disable odoo10.service (disables service at boot)
Wednesday, 15 March 2017
ValueError Expected singleton in Odoo
Expected Singleton:
Class methods required single invoking object (Single Browsable Record) to invoke the method and suppose it will call by multiple invoking objects (Browsable Recordsets) then method is not able to identify for which object it should process, therefore it will raise an error Expected Singleton.
New API decorator is used to define method calling pattern whether methods allows only single object or multiple objects to invoke this method.
For Example:
if self.location_id: #face ValueError Expected singleton because self contains multiple recordset.
########
Need to change with following:
for warehouse in self:
if warehouse.location_id:
########
@api.one
This decorator loops automatically on Records of RecordSet for you. Self is redefined as current record
Note:
Caution: the returned value is put in a list. This is not always supported by the web client, e.g. on button action
methods. In that case, you should use @api.multi to decorate your method, and probably call self.ensure_one() in
the method definition.
@api.multi
Self will be the current RecordSet without iteration. It is the default behavior (multiple browsable objects). Methods which returns non premitive type data(list, dictionary, function) must be decorated with @api.multi
@api.model
This decorator will convert old API calls to decorated function to new API signature. It allows to be polite when
migrating code. Self does not contain any record/recordset in methods which are decorated by this decorator.
So simply call like this
self.env['model_name'].method_name(arguments)
Class methods required single invoking object (Single Browsable Record) to invoke the method and suppose it will call by multiple invoking objects (Browsable Recordsets) then method is not able to identify for which object it should process, therefore it will raise an error Expected Singleton.
New API decorator is used to define method calling pattern whether methods allows only single object or multiple objects to invoke this method.
For Example:
if self.location_id: #face ValueError Expected singleton because self contains multiple recordset.
########
Need to change with following:
for warehouse in self:
if warehouse.location_id:
########
@api.one
This decorator loops automatically on Records of RecordSet for you. Self is redefined as current record
Note:
Caution: the returned value is put in a list. This is not always supported by the web client, e.g. on button action
methods. In that case, you should use @api.multi to decorate your method, and probably call self.ensure_one() in
the method definition.
@api.multi
Self will be the current RecordSet without iteration. It is the default behavior (multiple browsable objects). Methods which returns non premitive type data(list, dictionary, function) must be decorated with @api.multi
@api.model
This decorator will convert old API calls to decorated function to new API signature. It allows to be polite when
migrating code. Self does not contain any record/recordset in methods which are decorated by this decorator.
So simply call like this
self.env['model_name'].method_name(arguments)
Labels:
create,
erp,
JavaScript for odoo v8,
Jquery in odoo,
JScript for odoo,
module,
Odoo,
odoo9,
open source,
OpenERP,
OpenERP v8,
Point Of Sale,
Procurement,
Ubuntu 12.04,
Ubuntu server
one2many, many2many, many2one field in openerp
In OpenERP/Odoo, we have one2many and many2many datatype field. For add, update, delete we have some trick to link with record, which are listed below.
1. (0, 0, { values }) link to a new record that needs to be created with the given values dictionary
2. (1, ID, { values }) update the linked record with id = ID (write *values* on it)
3. (2, ID) remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object completely, and the link to it as well)
4. (3, ID) cut the link to the linked record with id = ID (delete the relationship between the two objects but does not delete the target object itself)
5. (4, ID) link to existing record with id = ID (adds a relationship)
6. (5) unlink all (like using (3,ID) for all linked records)
7. (6, 0, [IDs]) replace the list of linked IDs (like using (5) then (4,ID) for each ID in the list of IDs)
1. (0, 0, { values }) link to a new record that needs to be created with the given values dictionary
2. (1, ID, { values }) update the linked record with id = ID (write *values* on it)
3. (2, ID) remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object completely, and the link to it as well)
4. (3, ID) cut the link to the linked record with id = ID (delete the relationship between the two objects but does not delete the target object itself)
5. (4, ID) link to existing record with id = ID (adds a relationship)
6. (5) unlink all (like using (3,ID) for all linked records)
7. (6, 0, [IDs]) replace the list of linked IDs (like using (5) then (4,ID) for each ID in the list of IDs)
Friday, 10 March 2017
How to Add Search View Filters In Odoo ?
Filters for Datetime field
Today Filter
<filter icon="terp-go-month" string="Today " separator="1" domain="[('date','<=', (datetime.date.today()).strftime('%Y-%m-%d')),('date','>=',(datetime.date.today()).strftime('%Y-%m-%d'))]" help="Created today"/>
OR
<filter icon="terp-go-today" string="Today" domain="[('date','<=', datetime.datetime.combine(context_today(), datetime.time(23,59,59))), ('date','>=', datetime.datetime.combine(context_today(), datetime.time(0,0,0)))]" help="Orders processed Today or planned for Today"/>
This Year
<filter string="This Year" name="year" domain="[('date','<=', time.strftime('%%Y-12-31')),('date','>=',time.strftime('%%Y-01-01'))]"/>
Last Week
<filter string="Last week" domain="[('date_order', '>=', ((context_today()+relativedelta(weeks=-2, days=1, weekday=0)).strftime('%Y-%m-%d'))),('date_order', '<=', ((context_today()+relativedelta(weeks=-1,weekday=6)).strftime('%Y-%m-%d')))]"/>
This Month
<filter icon="terp-go-month" string="Month" name="month" domain="[('date_order','<=',(datetime.date.today()+relativedelta(day=31)).strftime('%Y-%m-%d')),('date_order','>=',(datetime.date.today()-relativedelta(day=1)).strftime('%Y-%m-%d'))]" help="Current Month"/>
Current week
<filter icon="terp-go-week"
string="Current Week"
separator="1"
name="week"
domain="[('date_order','<=', (context_today() + relativedelta(weeks=0,day=7, weekday=-1)).strftime('%Y-%m-%d')),('date_order','>=',(context_today() - relativedelta(weeks=1, weekday=0)).strftime('%Y-%m-%d'))]"
help="Current Week"
context="{'group_by':'date_order'}"/>
Previous Month
<filter string="Prev Month" name="prev_month" domain="[('date_order','>=',(context_today()-relativedelta(months=1)).strftime('%Y-%m-01')),('date_order','<',time.strftime('%Y-%m-01'))]"/>
Expiry checking
<filter string="Immediate Expiry" name="od_imm" domain="[('expiry_date','>=', ((context_today()+datetime.timedelta(days=1)).strftime('%Y-%m-%d'))),('expiry_date','<=', ((context_today()+datetime.timedelta(days=45)).strftime('%Y-%m-%d')))]"/>
Yesterday
<filter string="Yesterday" domain="[('date_order','>=', ((context_today()-datetime.timedelta(days=1)).strftime('%Y-%m-%d 00:00:00'))), ('date_order','<=', ((context_today()+datetime.timedelta(days=0)).strftime('%Y-%m-%d 00:00:00')))]"/>
Tomorrow
<filter string="Tomorrow" domain="[('date_order','>=', ((context_today()+datetime.timedelta(days=0)).strftime('%Y-%m-%d 23:59:59'))), ('date_order','<=', ((context_today()+datetime.timedelta(days=1)).strftime('%Y-%m-%d 23:59:59')))]"/>
Filters for Selection Field
Eg:<filter string="Quotations" name="draft" domain="[('state','in',('draft','sent'))]" help="Sales Order that haven't yet been confirmed"/>
Eg:<filter string="To Invoice" domain="[('state','=','manual')]" help="Sales Order ready to be invoiced"/>
Filters for Boolean Field
Eg:<filter icon="terp-gtk-jump-to-ltr" string="To Review" domain="[('to_check','=',True)]" help="Journal Entries to Review"/>
Filters for Many2one Field
<filter domain="[('user_id','=',uid)]" help="My Invoices" string="My Invoices"/>
for many2one field we are usually adding group by instead of filters.
you can add filters for many2one field by hard coding ids
Eg:-<filter domain="[('partner_id','in',(1,2,9,8,22)]" help="Selected" string="Special Partners"/>
Eg:-<filter domain="[('partner_id','=',1]" help="Selected" string="My Order"/>
Filters for Date Field
This week
<filter string="This Week" name="This Week" separator="1"
domain="[('date_from','>=', ((context_today()).strftime('%Y-%m-%d'))), ('date_from','<=', ((context_today()+datetime.timedelta(days=7)).strftime('%Y-%m-%d')))]"
help="This Week"/>
Last Week
<filter string="Last Week" name="Last Week" separator="1"
domain="[('date_from','>=', ((context_today()+datetime.timedelta(days=-7)).strftime('%Y-%m-%d'))), ('date_from','<=', ((context_today()).strftime('%Y-%m-%d')))]"
help="This Week"/>
yesterday
<filter string="Yesterday" name="Yesterday" separator="1"
domain="[('date_from','>=', ((context_today()+datetime.timedelta(days=-1)).strftime('%Y-%m-%d'))), ('date_from','<=', ((context_today()+datetime.timedelta(days=-1)).strftime('%Y-%m-%d')))]"
help="Yesterday"/>
Today
<filter string="Today" name="Today" separator="1"
domain="[('date_from','>=', ((context_today()+datetime.timedelta(days=0)).strftime('%Y-%m-%d'))), ('date_from','<=', ((context_today()+datetime.timedelta(days=0)).strftime('%Y-%m-%d')))]"
help="Today"/>
Tomorrow
<filter string="Tomorrow" name="Tomorrow" separator="1"
domain="[('date_from','>=', ((context_today()+datetime.timedelta(days=1)).strftime('%Y-%m-%d'))), ('date_from','<=', ((context_today()+datetime.timedelta(days=1)).strftime('%Y-%m-%d')))]"
help="Tomorrow"/>
Expiry
<filter string="Immediate Expiry" name="Immediate Expiry" separator="1"
domain="[('date_from','>=', ((context_today()+datetime.timedelta(days=0)).strftime('%Y-%m-%d'))), ('date_from','<=', ((context_today()+datetime.timedelta(days=45)).strftime('%Y-%m-%d')))]"
help="Immediate Expiry"/>
Last Month
<filter icon="terp-go-month" string="Last Month"
domain="[('date_from','<=', (context_today()-relativedelta(day=31, months=1)).strftime('%Y-%m-%d')),
('date_from','>=',(context_today()-relativedelta(day=1,months=1)).strftime('%Y-%m-%d'))]"
help="last month"/>
Current Month
<filter string="Current Month" name="current_month" domain="[('date_from','<',(context_today()+relativedelta(months=1)).strftime('%Y-%m-01')), ('date_from','>=',time.strftime('%Y-%m-01'))]"/>
Last Year
<filter icon="terp-go-month" string="Last Year"
domain="[('date', '>=' ,(context_today()-relativedelta(years=1)).strftime('%Y-01-01')),('date','<=',time.strftime('%Y-01-01'))]" help="last year"/>
This Year
<filter icon="terp-go-year" string="Year"
domain="[('date_from','<=', time.strftime('%Y-%m-%d')),('date_from','>=',time.strftime('%Y-01-01'))]"
help="Current Year"/>
Today Filter
<filter icon="terp-go-month" string="Today " separator="1" domain="[('date','<=', (datetime.date.today()).strftime('%Y-%m-%d')),('date','>=',(datetime.date.today()).strftime('%Y-%m-%d'))]" help="Created today"/>
OR
<filter icon="terp-go-today" string="Today" domain="[('date','<=', datetime.datetime.combine(context_today(), datetime.time(23,59,59))), ('date','>=', datetime.datetime.combine(context_today(), datetime.time(0,0,0)))]" help="Orders processed Today or planned for Today"/>
This Year
<filter string="This Year" name="year" domain="[('date','<=', time.strftime('%%Y-12-31')),('date','>=',time.strftime('%%Y-01-01'))]"/>
Last Week
<filter string="Last week" domain="[('date_order', '>=', ((context_today()+relativedelta(weeks=-2, days=1, weekday=0)).strftime('%Y-%m-%d'))),('date_order', '<=', ((context_today()+relativedelta(weeks=-1,weekday=6)).strftime('%Y-%m-%d')))]"/>
This Month
<filter icon="terp-go-month" string="Month" name="month" domain="[('date_order','<=',(datetime.date.today()+relativedelta(day=31)).strftime('%Y-%m-%d')),('date_order','>=',(datetime.date.today()-relativedelta(day=1)).strftime('%Y-%m-%d'))]" help="Current Month"/>
Current week
<filter icon="terp-go-week"
string="Current Week"
separator="1"
name="week"
domain="[('date_order','<=', (context_today() + relativedelta(weeks=0,day=7, weekday=-1)).strftime('%Y-%m-%d')),('date_order','>=',(context_today() - relativedelta(weeks=1, weekday=0)).strftime('%Y-%m-%d'))]"
help="Current Week"
context="{'group_by':'date_order'}"/>
Previous Month
<filter string="Prev Month" name="prev_month" domain="[('date_order','>=',(context_today()-relativedelta(months=1)).strftime('%Y-%m-01')),('date_order','<',time.strftime('%Y-%m-01'))]"/>
Expiry checking
<filter string="Immediate Expiry" name="od_imm" domain="[('expiry_date','>=', ((context_today()+datetime.timedelta(days=1)).strftime('%Y-%m-%d'))),('expiry_date','<=', ((context_today()+datetime.timedelta(days=45)).strftime('%Y-%m-%d')))]"/>
Yesterday
<filter string="Yesterday" domain="[('date_order','>=', ((context_today()-datetime.timedelta(days=1)).strftime('%Y-%m-%d 00:00:00'))), ('date_order','<=', ((context_today()+datetime.timedelta(days=0)).strftime('%Y-%m-%d 00:00:00')))]"/>
Tomorrow
<filter string="Tomorrow" domain="[('date_order','>=', ((context_today()+datetime.timedelta(days=0)).strftime('%Y-%m-%d 23:59:59'))), ('date_order','<=', ((context_today()+datetime.timedelta(days=1)).strftime('%Y-%m-%d 23:59:59')))]"/>
Filters for Selection Field
Eg:<filter string="Quotations" name="draft" domain="[('state','in',('draft','sent'))]" help="Sales Order that haven't yet been confirmed"/>
Eg:<filter string="To Invoice" domain="[('state','=','manual')]" help="Sales Order ready to be invoiced"/>
Filters for Boolean Field
Eg:<filter icon="terp-gtk-jump-to-ltr" string="To Review" domain="[('to_check','=',True)]" help="Journal Entries to Review"/>
Filters for Many2one Field
<filter domain="[('user_id','=',uid)]" help="My Invoices" string="My Invoices"/>
for many2one field we are usually adding group by instead of filters.
you can add filters for many2one field by hard coding ids
Eg:-<filter domain="[('partner_id','in',(1,2,9,8,22)]" help="Selected" string="Special Partners"/>
Eg:-<filter domain="[('partner_id','=',1]" help="Selected" string="My Order"/>
Filters for Date Field
This week
<filter string="This Week" name="This Week" separator="1"
domain="[('date_from','>=', ((context_today()).strftime('%Y-%m-%d'))), ('date_from','<=', ((context_today()+datetime.timedelta(days=7)).strftime('%Y-%m-%d')))]"
help="This Week"/>
Last Week
<filter string="Last Week" name="Last Week" separator="1"
domain="[('date_from','>=', ((context_today()+datetime.timedelta(days=-7)).strftime('%Y-%m-%d'))), ('date_from','<=', ((context_today()).strftime('%Y-%m-%d')))]"
help="This Week"/>
yesterday
<filter string="Yesterday" name="Yesterday" separator="1"
domain="[('date_from','>=', ((context_today()+datetime.timedelta(days=-1)).strftime('%Y-%m-%d'))), ('date_from','<=', ((context_today()+datetime.timedelta(days=-1)).strftime('%Y-%m-%d')))]"
help="Yesterday"/>
Today
<filter string="Today" name="Today" separator="1"
domain="[('date_from','>=', ((context_today()+datetime.timedelta(days=0)).strftime('%Y-%m-%d'))), ('date_from','<=', ((context_today()+datetime.timedelta(days=0)).strftime('%Y-%m-%d')))]"
help="Today"/>
Tomorrow
<filter string="Tomorrow" name="Tomorrow" separator="1"
domain="[('date_from','>=', ((context_today()+datetime.timedelta(days=1)).strftime('%Y-%m-%d'))), ('date_from','<=', ((context_today()+datetime.timedelta(days=1)).strftime('%Y-%m-%d')))]"
help="Tomorrow"/>
Expiry
<filter string="Immediate Expiry" name="Immediate Expiry" separator="1"
domain="[('date_from','>=', ((context_today()+datetime.timedelta(days=0)).strftime('%Y-%m-%d'))), ('date_from','<=', ((context_today()+datetime.timedelta(days=45)).strftime('%Y-%m-%d')))]"
help="Immediate Expiry"/>
Last Month
<filter icon="terp-go-month" string="Last Month"
domain="[('date_from','<=', (context_today()-relativedelta(day=31, months=1)).strftime('%Y-%m-%d')),
('date_from','>=',(context_today()-relativedelta(day=1,months=1)).strftime('%Y-%m-%d'))]"
help="last month"/>
Current Month
<filter string="Current Month" name="current_month" domain="[('date_from','<',(context_today()+relativedelta(months=1)).strftime('%Y-%m-01')), ('date_from','>=',time.strftime('%Y-%m-01'))]"/>
Last Year
<filter icon="terp-go-month" string="Last Year"
domain="[('date', '>=' ,(context_today()-relativedelta(years=1)).strftime('%Y-01-01')),('date','<=',time.strftime('%Y-01-01'))]" help="last year"/>
This Year
<filter icon="terp-go-year" string="Year"
domain="[('date_from','<=', time.strftime('%Y-%m-%d')),('date_from','>=',time.strftime('%Y-01-01'))]"
help="Current Year"/>
Labels:
current week,
ECommerce,
filter,
filters for selection field,
JavaScript for odoo v8,
last week,
Odoo,
odoo9,
OpenERP,
OpenERP v8,
this month,
this year,
today,
tomorrow,
Ubuntu server,
yesterday
Wednesday, 8 March 2017
How can create a new button in the header of the tree view after the "create button or 'import' "?
<t t-extend="ListView.buttons">
<t t-jquery="button.oe_list_add" t-operation="after">
<t t-if="widget.model=='your.model'">
<button class="oe_button oe_highlight" type="button"> New Buttton</button>
</t>
</t>
</t>
<t t-jquery="button.oe_list_add" t-operation="after">
<t t-if="widget.model=='your.model'">
<button class="oe_button oe_highlight" type="button"> New Buttton</button>
</t>
</t>
</t>
Labels:
button,
create,
header,
import,
module,
Odoo,
open source,
OpenERP,
OpenERP v8
Tuesday, 7 March 2017
How to access new version of Odoo studio ?
New versions of Odoo studio are hosted at http://runbot.odoo.com
The version after the current version (which today is version 10) is called master.
1. Select the Enterprise Edition in the dropdown:
2. Select a green build:
How to add Facebook Open Graph Tag in the head section?
you can add using this :
<template id="login_layout_replace1_new" inherit_id="web.layout" name="Web layout">
<xpath expr="html/head" position="replace">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Odoo</title>
<link rel="stylesheet" href="/web/static/src/css/full.css" />
<t t-raw="head or ''"/>
//you can add your code here.
</head>
</xpath>
</template>
Hope this will help you!!
Thursday, 2 March 2017
Tuesday, 2 February 2016
How can I assign Landed Costs to my cost price? | Odoo
landed cost means Product Price + Extra Price (customs, duties, taxes, insurance,..) and from this calculation we can see the actual stock valuation of product.
Lets teke example for this :
I did 2 purchases of the same product with different landed costs:
1st purchase:
Units: 50
Product cost per unit: 200
Landed costs: 400
2nd purchase:
Units 40
Product cost per unit: 300
Landed costs: 200
Now I need to get the Average Cost price of the product + landed costs:
[(50 x 200 + 400) + (40 x 300 + 200)] / (50 + 40)
10,400 + 12,200 / 90 = 251.111
In odoo Landed cost price configuration:
Configuration > Settings:
Go to Setting–>Configuration–>Warehouse
Tick “Generate accounting entries per stock movement” & “Calculate Landed Costs”
Go to Setting–>Configuration–>Purchases
Tick “Use Real Price or Average costing methods”
Configuration > Product
Start by creating products which indicates your landed costs such as freight charges, Insurance , Custom Duties etc. You can Create the product directly from warehouse. Go to Warehouse–>Configuration–>Landed Cost Type–>Click Create. Make sure that “can constitute landed cost” option is ticked , if not then tick that option. Choose Split Method according to your landed cost type. Make sure to also set “Inventory Valuation” under Accounting Tab.
Now, Calculate Landed Cost:
Go to Warehouse > Landed Cost > Landed Cost > Click Create. Select the pickings to which you want to calculate landed costs. Select the account journal in which to post the landed costs. Once you select the pickings, the product lines will be added automatically to Valuation Adjustment Block. In “Cost Lines” block , select the product indicates landed cost and you want to apply on the selected picking. Click “Compute”.Click “Validate” to confirm the landed costs attribution.
To see updated cost price of your stock :
Go to Inventory > Reports > Stock Valuation and in Inventory Value you can see the updated cost price.
Here, you can see original inventory value of your business.
Note: Landed cost type have different split methods,
Equal : Equally allocate the landed cost to products
By Quantity : Allocate cost based on the quantity of each products
By current cost : Allocate landed cost based on current cost of each products(after multiplying qty)
By weight : Allocate landed cost based on weight of each products
By Volume : Allocate landed cost based on value of each products
You can also check here how to calculate landed cost :
Wednesday, 25 November 2015
Image data not embedded in manually-sent email in odoo | OpenERP
- When manually sending am email from OpenERP v7.0 which features the company logo, the image data is not embedded properly.
# Override the regex as defined in the lxml.html.clean
- But we can resolve it by added below code in top of the openerp/tools/mail.py File.
# module in order to allow the preservation of image data.
clean._is_javascript_scheme = re.compile(
r'(?:javascript|jscript|livescript|vbscript|about|mocha):',
re.I).search
Sunday, 27 September 2015
How to override a global function? | Odoo
There are 2 ways to do this kind of programming.
1) For complete
override the global function :
For example, there is one global method "fields_get" into orm file of osv model. In order to override this global method you need to follow below steps,
- Define one global function into you custom module.
- from osv import orm
def my_fields_get(....)
.......
from osv import orm
native_fields_get = orm.fields_get
def my_fields_get(....)
....... #custome extension code.
res = native_fields_get(....)
....... #custome extension code.return res - Write down the following line for the override the basic gloal function.
orm.fields_get = my_fields_get
Note : After doing this code, It will override the basic method of the orm file.
2) For made some extension into currently available global function.
For example there is one global method
fields_get into orm file of osv model.
- Define one global function into you custom module.
- Write down the following line for the override the basic gloal function.
orm.fields_get = my_fields_get
How to show Thumbnail image in list view? | Odoo
In sale order line when i select a product it should auto-populate the product image as well. I achieved this functionality to auto-populate the image. And this image is displaying as widget until in form view of sale order line. But once when i click on "save and close" on sale order line form, in the list view of sale order it is showing as some Download(size) like thing. Even i specified as widget="image" in tree view of order line.
Now I want to show
this image as widget in list view also.
List view is designed
in such a way that will show all binary files as
Download(size) format irrespective of the file type and widget specified. To
achieve this I have modified the code in web module directly. we can also
create module for that.
The code to be added is:
The file need to be modified is: /addons/web/static/src/js/view_list.js:
The file need to be modified is: /addons/web/static/src/js/view_list.js:
Line 2066:
'button': 'instance.web.list.Button', +'field.image': 'instance.web.list.FieldBinaryImage', 'field.many2onebutton': 'instance.web.list.Many2OneButton',Line 2230:
href: download_url, size: instance.web.binary_to_binsize(value), }); } }); + +instance.web.list.FieldBinaryImage = instance.web.list.Column.extend({</br> + /** + * Return a image to the binary field of specified as widget image</br> + * + * @private + */ + _format: function (row_data, options) { + var placeholder= "/web/static/src/img/placeholder.png"; + var value = row_data[this.id].value; + var download_url; + if (value && value.substr(0, 10).indexOf(' ') == -1) { + download_url = "data:image/png;base64," + value; + } + else { + download_url = placeholder; + } + + return _.template('<image src="<%-src%>" width="30px" height="30px"/>', { + src: download_url, + }); + } +}); + instance.web.list.ProgressBar = instance.web.list.Column.extend({ /** * Return a formatted progress bar display * * @private */ _format: function (row_data, options) {
Note:
When you are trying this code to acheive functionality, don't forget to specify
widget="image" in view definition and in this post it is not allowing me to add image tag in code it is converting into image icon.
return _.template('Image tag with
src="<%-src%>" and width as 30px and height as 30 px', {
Subscribe to:
Posts (Atom)






