odoo-10

Odoo onchange not working correctly

时光总嘲笑我的痴心妄想 提交于 2019-12-24 02:22:16
问题 I'm inherit purchase.order.line and try change value in field. For product_qty I can change value but for price_unit I can't change value. My custom .py file: class PurchaseOrderLine(models.Model): _inherit = 'purchase.order.line' @api.onchange('product_id') def my_fucn(self): for rec in self: rec.product_qty = 10 #WORKING rec.price_unit = 1 #NOT WORKING Maybe is problem because in original purcahase.py odoo file also have @api.onchange('product_id'). Any solution? 回答1: You can't predict

Odoo disabled edit button depending on state

一世执手 提交于 2019-12-24 00:21:35
问题 this question already asked by someone, this in an example question How to hide the edit button form only when invoice' state is 'paid' Odoo v8? but i dont get true answer, somebody can help me, i really need to hide or disabled this button. For your information im using odoo v.10 Thanks in advance 回答1: The only way to this is by Javascript you need to add this behavior to your form view build a custom addon and just add this javascript file to your backend assets template //file: static/src

Odoo 10 - Conditional hide/show of kanban view image

无人久伴 提交于 2019-12-23 05:32:19
问题 I am trying to hide the product image based on the status of default_code field. If default_code is empty, I want to hide it. If not, I want to show image. So far I have modified the kanban view like this: <record id="conditional_product_kanban_view" model="ir.ui.view"> <field name="name">Kanban Extended View</field> <field name="inherit_id" ref="product.product_template_kanban_view"/> <field name="model">product.template</field> <field name="arch" type="xml"> <xpath expr="//div[@class='o

odoo 10 how to create Snippets Javascript option

坚强是说给别人听的谎言 提交于 2019-12-22 00:14:29
问题 I'm trying to Create Snippets in odoo 10 according to https://www.odoo.com/documentation/10.0/howtos/themes.html#create-snippets I created the snippets and add the js option, the code from the example (function() { 'use strict'; var website = odoo.website; website.odoo_website = {}; website.snippet.options.snippet_testimonial_options = website.snippet.Option.extend({ on_focus: function() { alert("On focus!"); } }) })(); fails since odoo.website is not defined see Please help 回答1: here is the

Can we able to inherit and change the noupdate=“1” in odoo?

六月ゝ 毕业季﹏ 提交于 2019-12-21 05:30:21
问题 Is it possible to inherit from one xml and to change its updatable. I tried to inherit "Check Action Rules" to change the "interval_number" from 4 to 1 hours. To make it run every single hour. I don't think it may work because of noupdate="1". Anyone have any idea about this? 回答1: Yes you can change the noupdate file by the help of hook. In the manifest file next to data add 'post_init_hook': 'post_init_hook', create hooks.py file def post_init_hook(cr, registry): env = api.Environment(cr,

Odoo10 - How to do javascript

会有一股神秘感。 提交于 2019-12-20 06:26:09
问题 I must be doing something completely wrong: odoo.define('my_module.popups', function (require) { 'use strict'; var ajax = require('web.ajax'); var core = require('web.core'); var _t = core._t; var qweb = core.qweb; ajax.loadXML('/my_module/static/xml/templates.xml', qweb); var data = {modal_title: 'This is a popup!',modal_body: 'testtest'}; var p = qweb.render("my_module.popup1_template", data); p.prependTo('body'); }); I'm not sure I understand this. The code inside define is never executed.

Add npm pckage in odoo

岁酱吖の 提交于 2019-12-14 03:35:27
问题 I want to use a npm package in odoo so that I can use that in odoo widget. I have seen that odoo web add on somehow uses underscore js and query. But I am not able to use npm package in odoo. I have tried to load it by creating package.json file inside the addon folder but it is not working. Please Help!! 回答1: The common pattern is to put all dependencies directly copied in the static/src/lib/ folder of the addon, and enable them in a templates/assets.xml file. Using npm would be

how to write events for formview inside header buttons? odoo 10

為{幸葍}努か 提交于 2019-12-12 14:32:13
问题 I have tried this code in odoo10 community but not working, what is my fault? Or Can anyone guide me how to do it? openerp.module_name= function (instance) { var _t = instance.web._t, QWeb = instance.web.qweb; instance.web.FormView = instance.web.FormView.include({ init: function() { this._super.apply(this, arguments); console.log("test"+this.getParent().dataset.model); }, events: { 'click #target': 'button_clicked', }, button_clicked : function(ev) { console.log("test333555555"); ev

why is pip freeze not showing a module although pip install says it's already installed

◇◆丶佛笑我妖孽 提交于 2019-12-12 04:06:49
问题 I'm following these instructions to install odoo on mac. It required that I install all the python modules for the user like so: $ sudo pip install -—user -r requirements.txt (*note about the --user part) However when I run odoo, I get this error: $ ./odoo-bin Traceback (most recent call last): File "./odoo-bin", line 5, in <module> __import__('pkg_resources').declare_namespace('odoo.addons') File "/Library/Python/2.7/site-packages/setuptools-36.5.0-py2.7.egg/pkg_resources/__init__.py", line

How to change the title in Odoo 10?

拜拜、爱过 提交于 2019-12-12 03:44:16
问题 I have changed the Odoo 10 login page title by using website builder app but it does not work on the other pages after login. After login when I access different installed apps then the page title shows Odoo with apps name like "Products - Odoo" or "Customers - Odoo". 回答1: In Odoo 10 , we need to edit below JS file addons/web/static/src/js/abstract_web_client.js Change this code: this.set('title_part', {"zopenerp": "Odoo"}); With this one: this.set('title_part', {"zopenerp": "YourPageTitle"})