odoo-8

How to assign current date to a date field in odoo v8?

半腔热情 提交于 2019-12-06 07:42:21
问题 I wanted to assign the current date to a date field 'start_date' in the following code: calendar_obj.create(cr,uid, {'name' : rec_res.act_ion, 'user_id' : rec_res.asgnd_to.id, 'start_date' : lambda *a:datetime.today().strftime('%m-%d-%Y'), 'stop_date' : rec_res.due_date, 'allday' : True, 'partner_ids' : [(6,0, [rec_res.asgnd_to.partner_id.id])] }, context=context) How to set or assign the current date value to the start_date field ? 回答1: The Date field includes a today() method, just for

In odoo 8 server “--auto-reload” when work

巧了我就是萌 提交于 2019-12-06 05:23:15
问题 Actually In the command of start odoo 8 server. It will provide "--auto-reload" option But actually i don't know how it works and when to work. Please if give me some guideline for that 回答1: Normally if you change your python code means, you need to restart the server in order to apply the new changes. --auto-reload parameter is enabled means, you don't need to restart the server. It enables auto-reloading of python files and xml files without having to restart the server. It required

Compute method is called multiple times?

僤鯓⒐⒋嵵緔 提交于 2019-12-06 03:52:17
I found out that this probably isn't concurrency problem as the method is recalled JUST WHEN I TRY TO UPDATE THE sync.test.subject.b 's separated_chars FIELD (at the end of the method). So I can't solve this with thread locking as the method actually waits for itself to be called again. I don't get it this is a totally bizarre behavior. I found a weird behavior while updating computed fields. In this case codes are better than words: Models: from openerp import models, fields, api, _ class sync_test_subject_a(models.Model): _name = "sync.test.subject.a" name = fields.Char('Name') sync_test

Why my pdf report is not taking the CSS styles well in Odoo?

别说谁变了你拦得住时间么 提交于 2019-12-05 22:40:30
I am using Odoo 10 in Ubuntu Server. I am trying to print my quotation report in pdf format using wkhtmltopdf. But the design doesn't look nice. It looks like the CSS is not working I have tried to change some XML file inside mypath/addons but it doesn't work Here's my quotation pdf file: 1st Possible Reason If your report doesn't have styles try to add some of these parameters in Settings > Parameters > System parameters : web.base.url : <IP address>:<Port> web.base.url.freeze : True . If this parameter is not used then if the administrator log in Odoo the web.base.url parameter is updated

How to migrate an Openerp v7 database to Odoo v8?

筅森魡賤 提交于 2019-12-05 19:53:38
I have a dump file of database backup(openerp-7). Now I want to continue my work in Odoo, the database is in openerp-7 format so I am not able to restore it in Odoo. How to convert this database to Odoo version in order to start working on it? You must do a data migration. That's not an easy task. You can use some of this migration tools: OpenUpgrade . Or you can use some ETL tool such as Odoo ETL If you only want migrate some table you can export it in a CSV file and import it in Odoo choosing the right columns. Using pgadmin3,we can export the tables and import in our desired database of

How to use if in Odoo template language

十年热恋 提交于 2019-12-05 17:57:36
I'm trying to use the same functionality as in Django: <div class="item {% if condition == True %}active{% endif %}"> In Odoo I have: <t t-foreach="list" t-as="l"> <a t-attf-href="/downloads/{{l.id}}" class="list-group-item"><t t-esc="l.name"/></a> </t> And I need to append class "active" if "c.id = cat_id" how it's done in Odoo? I'm using: <t t-foreach="categories" t-as="c"> <t t-if="c.id == category_id"> <a t-attf-href="/downloads/{{c.id}}" class="list-group-item active"><t t-esc="c.name"/></a> </t> <t t-if="c.id != category_id"> <a t-attf-href="/downloads/{{c.id}}" class="list-group-item">

how to integrate Odoo with MySQL

随声附和 提交于 2019-12-05 15:52:15
I am trying to integrate Odoo(openerp-8) with MySQL on ubuntu server, to get the database access instead of postgresql. But I am unable to figure out the correct way to do that. I tried this link, but it didn't help me http://openerp-team.blogspot.de/2009/08/open-erp-server-with-mysql.html Any better ideas on configuring odoo with MySQL? In Odoo apps Store One Free module Available name is "External Database Sources" This module allows you to define connections to foreign databases using ODBC, Oracle Client or SQLAlchemy. Database sources can be configured in Settings > Configuration -> Data

Changing the Filename of a Uploaded Binary File Field

荒凉一梦 提交于 2019-12-05 12:31:50
I'm using Odoo8 I have a question I used the fields.binary to upload a file/s in Odoo. But when I try to download it the filename of the uploaded file is the model name. Is it possible to change the filename of the file? And second the filters attribute in fields does not work. Black and White My Solution to this matter/problem, create first a compute field and its function .py filename = fields.Char('file name', readonly = True,store = False,compute ='legacy_doc1_getFilename') @api.one def legacy_doc1_getFilename(self): if len(self.employee_number) > 0: self.filename = str(self.employee

How to get JSON data in an Odoo controller using type='json'?

跟風遠走 提交于 2019-12-05 07:45:52
A few days ago I did a similar question here: How to get JSON data in an Odoo controller? But now, I need to create a controller which receives only JSON data. So, I am doing the request from a Python console, this way: import requests import json url = 'http://localhost:8069/odoo/test' headers = {'Content-Type': 'application/json'} data = { 'name': 'Jane', 'email': 'jane.doe@gmail.com', } data_json = json.dumps(data) r = requests.post(url=url, data=data_json, headers=headers) I have created a controller which listens to http://localhost:8069/odoo/test , this way: import openerp.http as http

One2many field on_change function can't change its own value?

若如初见. 提交于 2019-12-05 07:12:52
问题 I have these two fields. 'name' : fields.char('Name'), 'addresses' : fields.one2many('res.partner.address', 'partner','Addresses'), This function: def addresses_change(self, cr, uid, ids, name, addresses, context=None): value = {} new_addresses = [] address_pool = self.pool.get('res.partner.address') for address in address_pool.browse(cr, uid, addresses[0][2], context=context): new_addresses.append((1,address.id,{'street':'wall street','zip':'7777','partner': ids[0],'active':True})) value