How to Extend EditListPopup in Odoo POS? - odoo

I want to add a field on EditListPopup view in Odoo POS, I make an XML file like this:
<templates id="template" xml:space="preserve">
<t t-name="EditListPopup" t-inherit="point_of_sale.EditListPopup" t-inherit-mode="extension" owl="1">
<xpath expr="//main[hasclass('list-lines')]" position="before">
<select name="list_lot" id="list_lot">
<option value="test_3">Test 3</option>
<option value="test_4">Test 4</option>
</select>
</xpath>
</t></templates>
I add my file to manifest like this:
'assets': {
'web.assets_qweb': [
'my_project_name/static/src/xml/EditListPopup.xml',
],
},
But always it returns this error:
The connection was reset
The connection to the server was reset while the page was loading.
The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer’s network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.
How Can I solve this error?

Related

Is there an easy way to make the fileupload work with IE11 without updating zk

In IE11 file upload button of ZK is not working.
I got few replies, It says after updating ZK it will fix the problem.
But we can't update ZK, So in this scenario is there any way to work out this problem any how.
If you can't upgrade ZK then you can try to "downgrade" the IE using "X-UA-Compatible" either as meta-tag or as a response header
here an example using the meta tag:
<?meta http-equiv="X-UA-Compatible" content="IE=10" ?>
<zk>
<fileupload label="upload" onUpload="alert(event.getMedia().getName())"/>
</zk>
and what it looks like in the browser (in the IE dev tools F12 you can check if the meta tag had an effect, you'll see that IE falls back to version 10):
http://screencast.com/t/ftheLA9Ud8
Finally I got the Solution.
AS IE 11 having problem to attach event for listening to open File chooser.
You just manually add the listener.
<button id="browsebtn" upload="true,maxsize=-1" visible="true" sclass="text">
<attribute w:name="doMouseDown_">
function (evt) {
}
</attribute>
</button>
Its simple and weird, However what I found is make the parent component as draggable="true"
<row draggable="true">
<div style="text-align : right;">
<label value="Image File:" />
</div>
<fileupload id="fileUpload" label="Upload" tooltiptext="Click to upload image file."/>
</row>
Now suddenly you will see your fileupload button in ZK started working correctly for IE11 as well.

Powered by Odoo footer

I need to change the "Powered" in "Powered by Odoo" footer to "Made",
So the footer of my Odoo (Formerly OpenERP) Version 8.0-aab3d9f will be "Made by Odoo"
any ideas??
Instead of changing directly in the core of odoo (which is not appreciated), you can create a new module that depends on web module.
Then you can extend template web.menu_secondary from webclient_templates.xml in web module, like this:
-> _ _openerp__.py file:
{
'name': "My Module",
# for the full list
'category': 'Web',
# any module necessary for this one to work correctly
'depends': ['web'],
# always loaded
'data': ['templates.xml'],
'demo': [],
}
-> templates.xml file:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="menu_secondary" inherit_id="web.menu_secondary">
<div class="oe_footer" position="replace">
<div class="oe_footer">
Made by <span>Odoo</span>
</div>
</div>
</template>
</data>
</openerp>
First go to your Odoo web module and open below file.
addons => web => views => webclient_templates.xml
Now find this tag <div class="oe_footer"> and edit it like
<div class="oe_footer">
Made by <span>Odoo</span>
</div>
Save it and refresh your browser. Hope you get what you want.
You can use the HTML Editor of the Website module to change your site's copyright footer:
Customize > HTML Editor
Website HTML Editor Footer Copyright
As this is a fast and clean way to accomplish what you're asking for, though changes will be saved directly to working database. If you want to replicate your changes in different databases, the best approach is to make a custom module.

Importing a New Module (openacademy example) Odoo v8

I installed Odoo v8 on my poste windows 7.
I created a new module "openacademy" , by following the tutorial "Building a Module" on the official website:
https://www.odoo.com/documentation/8.0/howtos/backend.html
then I zip my file "openacademy" ==> "openacademy.zip".
The problem: When I try to import the module, I get this error:
Import Module
WARNING odoo openerp.models: Cannot execute name_search, no _rec_name defined on base.import.module
INFO odoo werkzeug: 127.0.0.1 - - [16/Dec/2014 17:53:03] "POST /web/dataset/call_kw/base.import.module/search_read HTTP/1.1" 200 -
WARNING odoo openerp.modules.module: module openacademy: module not found
INFO odoo openerp.addons.base_import_module.models.ir_module: module openacademy: loading templates.xml
INFO odoo openerp.addons.base_import_module.models.ir_module: module openacademy: loading views/openacademy.xml
INFO odoo werkzeug: 127.0.0.1 - - [16/Dec/2014 17:53:07] "POST /longpolling/poll HTTP/1.1" 200 -
**ERROR odoo openerp.addons.base.ir.ir_ui_view: Model not found: openacademy.course**
Error context:
View 'course.form'
[view_id: 1030, xml_id: n/a, model: openacademy.course, parent_id: n/a]
The model "openacademy.course" is not found, but it already exists in "models.py" !!!
This my code :
models.py :
from openerp import models, fields
class Course(models.Model):
_name = 'openacademy.course'
name = fields.Char(string='Title', required=True)
description = fields.Text()
views/openacademy.xml :
<openerp>
<data>
<record model="ir.ui.view" id="course_form_view">
<field name="name">course.form</field>
<field name="model">openacademy.course</field>
<field name="arch" type="xml">
<form string="Course Form">
<sheet>
<group>
<field name="name"/>
<field name="description"/>
</group>
</sheet>
</form>
</field>
</record>
<!-- window action -->
<!--
The following tag is an action definition for a "window action",
that is an action opening a view or a set of views
-->
<record model="ir.actions.act_window" id="course_list_action">
<field name="name">Courses</field>
<field name="res_model">openacademy.course</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Create the first course
</p>
</field>
</record>
<!-- top level menu: no parent -->
<menuitem id="main_openacademy_menu" name="Open Academy"/>
<!-- A first level in the left side menu is needed
before using action= attribute -->
<menuitem id="openacademy_menu" name="Open Academy"
parent="main_openacademy_menu"/>
<!-- the following menuitem should appear *after*
its parent openacademy_menu and *after* its
action course_list_action -->
<menuitem id="courses_menu" name="Courses" parent="openacademy_menu"
action="course_list_action"/>
<!-- Full id location:
action="openacademy.course_list_action"
It is not required when it is the same module -->
</data>
</openerp>
__init.py__:
import models
Rename your models.py into course.py
course.py :
from openerp import models, fields
class Course(models.Model):
_name = 'openacademy.course'
name = fields.Char(string='Title', required=True)
description = fields.Text()
And change your __init__.py into this:
import models
I think model file's name should match the class name. You must make different model for each table.
A part from goFrendiAsgard answer, try with this:
Run "Update Apps List" in Odoo interface:
To see this option, you have to turn on the "Technical Feature" going to Settings –> Users, edit your user, and click on "Technical Feature".
Restart Odoo server:
I don't know how to do it in Windows, in Linux is sudo service odoo-server restart
For people facing this issue in a linux environment, can also try:
Check your module files and folder have the right owner and group:
Compare with the rest of modules and change if necesary. For example sudo chown -R odoo:odoo openacademy/
Check your module files and folder permissions:
Usually 755, so you can run sudo chmod -R 755 openacademy/

Could not find client action (openERP 8/Odoo)

I was trying to follow this guide of building a web-module: https://doc.openerp.com/trunk/web/module/
I created the following files according to guide:
// static/src/js/first_module.js
openerp.web_example = function (instance) {
instance.web.client_actions.add('example.action', 'instance.web_example.action');
instance.web_example.action = function (parent, action) {
console.log("Executed the action", action);
};
};
openerp.py
# __openerp__.py
{
'name': "Web Example",
'description': "Basic example of a (future) web module",
'category': 'Hidden',
'depends': ['web'],
'data': ['web_example.xml'],
'js': ['static/src/js/first_module.js'],
}
web_example.xml
<!-- web_example/web_example.xml -->
<openerp>
<data>
<record model="ir.actions.client" id="action_client_example">
<field name="name">Example Client Action</field>
<field name="tag">example.action</field>
</record>
<menuitem action="action_client_example"
id="menu_client_example"/>
</data>
</openerp>
init.py is empty.
Now the "Example Client Action" link appears to the topbar of the admin-panel like it should but when I click it I get a notification saying "Could not find client action example.action"
I have checked my code few times to ensure it's similar to guide's. Am I just blind to some minor error, is there a misconception or what could be the problem? Should there be something in the init.py file? If yes, then what?
In v8 adding of static files is different as v7.
You must define static files in view, where you inheriting core views.
1. in module folder create folder named views
2. create in where file named: you_module_name.xml
3. in openerp.py add: 'data': ['views/you_module_name.xml']
4. in you_module_name.xml add:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend" name="you_module_name assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/you_module_name/static/src/css/you_module_name.css"/>
<script type="text/javascript" src="/you_module_name/static/src/js/you_module_name.js"></script>
</xpath>
</template>
</data>
if you haven't find any way, then please follow below step for OpenERP8/odoo.
Add below contain in your web_example module.
web_example
└── views
└──document.xml
In document.xml add below contain.
<data>
<template id="web_example_assets_backend" name="web_example assets" inherit_id="web.assets_backend">`enter code here`
<xpath expr="." position="inside">
<script type="text/javascript" src="/web_example/static/src/js/first_module.js"></script>
</xpath>
</template>
</data>
Now,modify openerp.py
openerp.py
{
'name': "Web Example",
'description': "Basic example of a (future) web module",
'category': 'Hidden',
'depends': ['web'],
'data': ['web_example.xml','views/document.xml'],
}
Thats it.
now,your js file is loaded in v8/odoo. :)
same way you can add your css file in document.xml
Thank You.
I am taking my first steps into biulding a web client, and just tried this tutorial yesterday. So I'm not sure my answer is right, but, is the name of your module "web_example"? If not, you should instantiate it with the name of your module in your js file. (it's working for me and got through the tutorial and got the timer working).
Good luck!

Save password prompt disappears when changing location

I'm running a login form, which - in case of success - forwards the user to a specific page via JS location.href. The browsers correctly recognize the form as a login form and offer to save the password. Now only in Google Chrome, the prompt disappears once the location changes. So the prompt is visible for just a split second, making it impossible to save the password.Is there any solution for this? Refreshing after login success is a common thing, so there should be a way to fix this..
Edit:
This is what the form looks like:
<form id="loginform" action="process.php" target="processframe" method="POST">
<input id="login_name" name="name" type="text" placeholder="Username"><br>
<input id="login_password" name="password" type="password" placeholder="Password"><br>
<button>Submit</button>
</form>
<iframe src="" id="processframe" name="processframe" style="display:none;"></iframe>
So the request is processed in an iframe. process.php then calls a javascript function:
window.setTimeout("parent.loginsuccess()", 1000);
The loginsuccess() function:
function loginsuccess()
{
location.href="/home.php";
}