odoo-8

how to set a different message for an email template in odoo?

人走茶凉 提交于 2019-12-22 17:54:13
问题 I created a custom module and had used the calendar object to create an event and the code is as follows def create_calender_event(self,cr,uid,ids,context=None): calendar_obj = self.pool.get('calendar.event') for rec in self.browse(cr,uid,ids,context=context): if rec.action: for rec_res in rec.action: calendar_obj.create(cr,uid,{'name' : rec_res.act_ion, 'user_id' : rec_res.asgnd_to.id, 'start_date' : rec_res.due_date, 'stop_date' : rec_res.due_date, 'allday' : True, 'partner_ids' : [(6,0,

Addition in General Settings of Odoo

不羁岁月 提交于 2019-12-22 00:24:40
问题 I am writing as custom Odoo module, with some configuration that can be set by the user. I want to add some setting in Settings -> Configuration -> General Settings Therefore, I created a .py containing: from openerp.osv import fields, osv class mymodule_configuration(osv.osv_memory): _inherit = 'res.config.settings' 'test_field': fields.char( string='Test Field', required=True, ) .XML <record id="custom_id" model="ir.ui.view"> <field name="name">General Settings</field> <field name="model"

How to add button in tree view header near “Create” and “Import” buttons Odoo 8?

守給你的承諾、 提交于 2019-12-21 21:08:47
问题 I can successfully add buttons in form view header or in tree view rows, but I want to add a custom button in the treeview header near "Create" and "Import" buttons in Odoo 8. How can I do this? 回答1: I find the solution to my problem! I replace the create button if I use project.project model. 1) I create some js script ( static/src/js/task_list.js ) with click listener for my button : openerp.project = function (instance){ var QWeb = openerp.web.qweb; _t = instance.web._t; var self = this;

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,

How to recompute stored functional field values in Odoo?

一世执手 提交于 2019-12-21 02:26:09
问题 Sometimes stored fields must be recomputed, but triggers can not be launched (e.g. in case of SQL injection). How to recompute them an easy way? 回答1: (Because I came here via google:) You can also do this from the Odoo Shell: # python odoo.py shell -c openerp-server.conf -d <database> >>> model = env['account.invoice'] >>> env.add_todo(model._fields['amount_total'], model.search([])) >>> model.recompute() >>> env.cr.commit() Odoo shell is available in 9, 10 and via an OCA module in 8. 回答2: In

Odoo throws a MissingError On treeview Second line record

醉酒当歌 提交于 2019-12-20 05:15:52
问题 How can i solve this error Odoo throws a MissingError on TreeView Second line button when clicked . The first Record line works but i need such that for each record on the tree the code below will be able to pass the contexts and open the appropriate view . Kindly assist Here is the code called on the button @api.multi def action_four_weeks_schedule_form(self): self.ensure_one() res = {} ids = self._ids cr = self._cr uid = self._uid context = self._context.copy() for id in self.browse(self

Override python function in odoo

别说谁变了你拦得住时间么 提交于 2019-12-20 04:49:36
问题 I make some changes in the read_group function which is located in the odoo/server/openerp/models . What I need now is to override this function in my own module. So I copy this function in the .py file of my module but this doesn't work for me. Can any one tell me how to do that? 回答1: Please find the example as below from openerp import models def read_group(): #YOUR OVERRIDDEN Function models.BaseModel.read_group = read_group For New API and old API compatibility issue you can also use

How to get JSON data in an Odoo controller?

左心房为你撑大大i 提交于 2019-12-20 02:08:33
问题 I am trying to send some JSON data to an Odoo controller, but when I send the request, I always get 404 as response. This is the code of my controller: import openerp.http as http import logging _logger = logging.getLogger(__name__) class Controller(http.Controller): @http.route('/test/result', type='json', auth='public') def index(self, **args): _logger.info('The controller is called.') return '{"response": "OK"}' Now, I type the URL ( http://localhost:8069/test/result ) on the browser to

How to get JSON data in an Odoo controller?

…衆ロ難τιáo~ 提交于 2019-12-20 02:07:25
问题 I am trying to send some JSON data to an Odoo controller, but when I send the request, I always get 404 as response. This is the code of my controller: import openerp.http as http import logging _logger = logging.getLogger(__name__) class Controller(http.Controller): @http.route('/test/result', type='json', auth='public') def index(self, **args): _logger.info('The controller is called.') return '{"response": "OK"}' Now, I type the URL ( http://localhost:8069/test/result ) on the browser to

Set default value while creating record from one2many field - odoo

杀马特。学长 韩版系。学妹 提交于 2019-12-19 05:09:31
问题 I want to set default value for multiple fields while creating records from one2many field, in that default value will be taken from the parent model. Odoo Model Structure class purchase_order(models.Model): _inherit='purchase.order' cash_forecast_ids = fields.One2many(comodel_name='cash.forecast', inverse_name='purchase_order_id', string='Payment Schedules') class cash_forecast(models.Model): _name='cash.forecast' purchase_order_id = fields.Many2one(comodel_name='purchase.order', string='PO'