openerp

How to calculate the difference between two dates in OpenERP?

安稳与你 提交于 2019-12-23 05:26:19
问题 In my custom module I am unable to calculate difference between two dates. My field is 'date_s':fields.datetime('Start Date'), 'date_e':fields.datetime('End Date'), I want to calculate the difference automatically in my duration field: 'Duration':fields.char('Duration'), 回答1: this is a simple function I have written. Hope it will help you. def onchange_return_date(self, cr, uid, ids, issuedate, returndate): a=datetime.strptime(issuedate,"%Y-%m-%d") b=datetime.strptime(returndate,"%Y-%m-%d")

Database schema changed; now odoo won't run

可紊 提交于 2019-12-23 04:43:15
问题 I have a problem when I want to start Odoo my local server (localhost). What happens is I made a change in the database and deleted a field because i didn't need it anymore. But the field was in a tree view and I cannot start the server because the view does not find the field that I removed. The error is as follows: 2016-04-20 11:46:10,863 3393 INFO prueba3 werkzeug: 127.0.0.1 - - [20/Apr/2016 11:46:10] "GET /favicon.ico HTTP/1.1" 500 - 2016-04-20 11:46:10,903 3393 ERROR prueba3 werkzeug:

OpenERP modeling / views: related object inline

自古美人都是妖i 提交于 2019-12-23 04:28:33
问题 I have installed the built in OpenERP 6.1 module crm. As a result, I now have res.lead active and visible at "Sales->Opportunities". I'd like to edit this object / view to show the partner's billing address. Since I want to do this on the Opporunities form, there is already a partner_id. Copying another module, I defined my new module like this: class crm_lead(osv.osv): _name = _inherit = 'crm.lead' _columns = { 'billing_address_id': fields.many2one('res.partner.address', 'Partner Billing

Create two graph view for one model openerp

此生再无相见时 提交于 2019-12-23 03:46:16
问题 I want Create two graph view for one model openerp, I like to define Two menu for each one display a graph view, exemple one content graph by country the ather by gender 回答1: You need to create two graph view in xml. <record id="country_graph_id" model="ir.ui.view"> <field name="name">country.graph</field> <field name="model">your.model</field> <field name="arch" type="xml"> <graph string="By Country" type="bar"> <field name="your fields"/> <field name="your_field2"/> </graph> </field> <

Removing the panel that appears on the right hand side of OpenERP main page

戏子无情 提交于 2019-12-23 01:44:37
问题 How can we remove the panel that appears on right hand side of openERP's main page ,which shows ACTIONS ,LINKS,OTHER OPTIONS.From which file in openERP web server can we remove that. Thanks, Sameer 回答1: serch for main_sidebar in web/addons/openerp/controllers/templates/form.mako you can hide the toolbar using this css file: web/addons/openerp/static/css/screen.cs 来源: https://stackoverflow.com/questions/8148821/removing-the-panel-that-appears-on-the-right-hand-side-of-openerp-main-page

Removing the panel that appears on the right hand side of OpenERP main page

本小妞迷上赌 提交于 2019-12-23 01:44:09
问题 How can we remove the panel that appears on right hand side of openERP's main page ,which shows ACTIONS ,LINKS,OTHER OPTIONS.From which file in openERP web server can we remove that. Thanks, Sameer 回答1: serch for main_sidebar in web/addons/openerp/controllers/templates/form.mako you can hide the toolbar using this css file: web/addons/openerp/static/css/screen.cs 来源: https://stackoverflow.com/questions/8148821/removing-the-panel-that-appears-on-the-right-hand-side-of-openerp-main-page

Get images from db by fields.function on QWeb report - Odoo 8

泪湿孤枕 提交于 2019-12-23 01:37:50
问题 I want to print an image getting it by a fields.function for any image in my database. I am trying the following: def _get_image(self, cr, uid, ids, name, args, context=None): res = dict.fromkeys(ids) for record_browse in self.browse(cr, uid, ids): partner = self.pool.get('res.partner').browse(cr,uid,6,context=None).image res[record_browse.id] = base64.encodestring(partner) return res _columns = { 'image': fields.function(_get_image, string="Image", type="binary"), } but in qweb report I got:

Get File path from binary data

自作多情 提交于 2019-12-22 17:36:09
问题 Is it possible to get the path of a file from binary data? I have only binary data which came from reading the file, but have no information of file path. Does the binary data have the information of path? if yes then How can I get it. I need to read xlsx file using python xlrd lib, which requires the file path, but i only have binary data. Can anyone shed light on it? 回答1: I have Done this before like, def read_file(self, cr, uid, ids, context=None): if not context: context = {} rec = self

openerp override onchange behavior without affecting base

岁酱吖の 提交于 2019-12-22 14:59:10
问题 I have inherited from purchase.order.line. I have added a bunch of related fields. They are all related to fields in product.product via product_id in order_line. What I want to achieve is that when a user selects or changes a product in the purchase order line form, the related fields should get refreshed/updated/populated with values of the selected product. I have written the onchange method for this but I'm not sure how to invoke it from the inherited view? The product_id field was

TypeError: create() got multiple values for keyword argument 'context'

穿精又带淫゛_ 提交于 2019-12-22 14:18:43
问题 I got an error like this: TypeError: create () got multiple values ​​for keyword argument 'context' This is the code: mov_id = self.create(cr, uid, ids, {'so_ids':so, 'product_ids':product},context=context) What's the problem? 回答1: To create a record, the parameters are cursor, user_id, dictionary of values and context. for example mov_id = self.create(cr, uid, {'so_ids': so, 'product_ids': product},context=context) create doesnt take any ids, if you are trying to use copy, then use mov_id =