odoo

Sum times odoo 9

回眸只為那壹抹淺笑 提交于 2019-12-22 10:05:12
问题 When use compute in tree view sum is not visible. When use onChange sum is visible any solution how fix it. I need compute after insert data from .csv automaticly populate time_total fields. Example: Source: class my_data(models.Model): _name = "my.data" _description = "My Data" user = fields.Char(string = 'User') date = fields.Date(string = 'Date') start_time = fields.Datetime(string='Start', placeholder="Start", default="2016-01-01 00:00:00.624139") finish_time = fields.Datetime(string=

odoo 模型与ORM

♀尐吖头ヾ 提交于 2019-12-22 01:41:12
型号属性 在/模型添加activity.py文件 class ActivityEvent(models.Model): _name = 'activity.event' _inherit = 'event.event' _rec_name = 'test_field' # 字段 test_field = fields.Char(string="字段名称") # 多对多的关联表 employee_ids = fields.Many2many('files.employee', 'activity_event_files_employee_rel', string='与会员工') event_type_id = fields.Many2one( 'activity.type', string='Category', readonly=False, states={'done': [('readonly', True)]}, oldname='type') model属性详解::类型 _name唯一标识,类非继承父类时必须指定。 _rec_name:数据显示名称,如设置则返回其指定的字段值,不设置默认显示字段为name的字段值,如无名字段则显示“模块名,ID”;详见BaseModel.name_get方法。 _log_access:是否自动增加日志字段(create_uid,create

Odoo: How to override original function

雨燕双飞 提交于 2019-12-21 21:27:38
问题 In Odoo, the quantities of a product are calculated each time the products form is opened. This happens in model product.product ==> function _product_available. This function returns a dictionary called res. Example: res = {8: {'qty_available': 5000.0, 'outgoing_qty': 1778.5, 'virtual_available': 3221.5, 'incoming_qty': 0.0}} Now I want to modify those values. I've managed to do this by coding it directly in the original function _product_available. Since this is not the correct way to do

Odoo Web Service API

人盡茶涼 提交于 2019-12-21 21:00:19
来自 Odoo Web服务暴露出相关的服务,路由分别是 /xmlrpc/ /xmlrpc/2/ /jsonrpc 根据 services 调用 后端对应服务的 方法method 【定义 openerp\http.py 之 dispatch_rpc()】,然后再将结果从python dict 转换为 xml-rpc 格式 或者 json-rpc 返回 service 对应的后端服务分别是 common, openerp.service.common db,openerp.service.db object , openerp.service.model report, openerp.service.report 各服务提供的方法如下 service method 说明 common login authenticate version about set_loglevel db create_database duplicate_database drop dump restore rename change_admin_password migrate_database db_exist list list_lang list_countries server_version object execute execute_kw execute_workflow report

How to inherit a template with no ID in Odoo?

雨燕双飞 提交于 2019-12-21 17:19:30
问题 I am trying to show the date a change was made in a task. To do this, I need to inherit the template of the widget "mail_thread". That template hasn't an id in its definition. This is it: <?xml version="1.0" encoding="UTF-8"?> <template> <!-- mail.Widget template used to namespace the css --> <t t-name="mail.Root"> <div class="oe_mail"> </div> </t> ... <span t-att-title="widget.date"> <t t-if="widget.timerelative" t-esc="widget.timerelative"/> <t t-if="!widget.timerelative" t-raw="widget

Odoo9.0模块开发全流程

泄露秘密 提交于 2019-12-21 15:34:29
构建Odoo模块 模块组成 业务对象 业务对象声明为Python类, 由Odoo自己主动加载. 数据文件 XML或CSV文件格式, 在当中声明了元数据(视图或工作流)、配置数据(模块參数)、演示数据等. Web控制器 处理Web浏览器发来的requests. 静态web数据 Web用到的图像, CSS或JavaScript文件. 模块结构 一个Odoo模块也是一个Python模块, 存放在一个文件夹中, 包括一个__init__.py文件, 用于导入其它Python模块. from . import mymodule odoo.py提供了一个子命令scaffold能够方便地创建一个空的模块. $ odoo.py scaffold <module name> <where to put it> 命令运行后, 将会创建一个子文件夹而且当中包含了Odoo模块所需的一些基本文件. 练习 #1 运行 ./odoo.py scaffold openacademy addons, 在addons文件夹下创建一个名为openacademy的模块, 生成的文件夹文件结构例如以下. openacademy ├── __init__.py ├── __openerp__.py ├── controllers.py ├── demo.xml ├── models.py ├── security │ └──

(08)odoo继承机制

夙愿已清 提交于 2019-12-21 06:07:30
* 全局的引用 所有的的模型定义外,都在注册中心注册了,我们可以用全局变量来引用这些模型 self.env[mode name] 比如得到合作伙伴这个模型 self.evn['res.partner'] * 三种常用继承 (在model中操作) _inherit 没重定义_name 这样数据库不会新建对象表,用被继承的表 _inherit 重定义_name 这样数据库会创建新的对象表存储 _inherits 是复合继承,有模型对象,有字段对象 示例: class MyModelExtended(Model): _inherit = 'a.model' # direct heritage _inherit = ['a.model, 'a.other.model'] # direct heritage _inherits = {'a.model': 'field_name'} # polymorphic heritage * 增加field from openerp import models,fields,api class TodoTask(models.Model) _inherit = 'todo.task' user_id = fields.Many2one('res.users',string='Response') date_deadline = fields.Date(

Odoo: How to inherit menu items (make menu items invisible)

允我心安 提交于 2019-12-21 03:03:06
问题 I need to remove (or make invisible) a menu item. I guess this should be done with an inherit and xpath. But I'm not sure which name, model and inherit_id I should use. Where can I find the correct values for these? I also don't know how to use xpath correctly for this. As far as I know, there are only expressions for pages, groups and fields? (http://www.odoo.yenthevg.com/xpath-expressions-in-odoo-8/) The menu that has to be removed is Product Variants: In addons/product/product_view.xml I

Openerp 7 to Odoo 8 - how to convert the database

梦想的初衷 提交于 2019-12-20 06:42:11
问题 I am trying to migrate my openerp7 to odoo 8. Do you know how can I convert the database version 7 to newer version 8? thanks. 回答1: Option 1: Ask odoo company to do it from openupgrade through a valid contract by paying them money Option 2:Try using Import/Export option from csv file Option 3:Use odoo etl tool link. You can find videos on you tube for odoo etl Option 4: Use migration tool available from github link is here Option 5: Use migration script use this link. If you are on ubuntu

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.