跳至內容
選單
此問題已被標幟
2 回覆
8855 瀏覽次數

I've made a personal module:

import datetime
import time
from openerp.osv import fields, osv
import logging

_logger = logging.getLogger("WORK2MEETING")
class project_task_work(osv.osv):
    _name = "project.task.work"
    _inherit="project.task.work"
    _columns = {
        'meeting_id': fields.many2one('crm.meeting', 'Meeting')
    }

    def create(self, cr, uid, vals, *args, **kwargs):
        _logger.debug('Create a %s with vals %s', self._name, vals)
        meeting_obj = self.pool.get('crm.meeting')
        varDeadline= datetime.date.today()#TODO deadline=date+hours
        meeting_vals = {
            'name': vals['name'],
            #'categ_ids': ,#TODO récup l'id du tag "avancement de projet"
            'duration': vals['hours'],
            'description':task_id.project_id.name+'->'+task_id.name+'->'+name,
            'user_id': vals['user_id'].id,
            'date': vals['date'],
            'end_date': varDeadline,
            'date_deadline': varDeadline,
            'state': 'open',# to block that meeting date in the calendar
        }
        meeting_id = meeting_obj.create(cr, uid, meeting_vals)
        vals['meeting_id'] = meeting_id
        return super(project_task_work,self).create(cr, uid, vals, *args, **kwargs)

When I check fields with dev mode I can see my personal field "meeting_id". But when I create a new task.work, I've no new meeting and there are no message on log file. Did I make a mistake?

頭像
捨棄
最佳答案

Everytime you make a modification to server or addons's python code, you have to restart your instance in order to re-load the codebase including your modifications.

On a side note, if you modify an XML view, you'll have to update the module (-u mymodule in launching args) to take your modifications into account.

And finally, if you modify some JS code, a simple refresh in your browser will do the trick.

頭像
捨棄

and when modifying a RML file directly, just calling the report again do the trick

Bjr Anto, j'ai modifié un bout de code python dans openerp 7, mais quand je restart tous mes serveurs postgres, python, le code n'est pas modifié dans openerp. Pour info je suis en Win 7

作者 最佳答案

I found the problem after 1 day of work. I have to restart openERP. This is the second time this solution resolve a problem and it's written nowhere in the doc. If this tips can help someone else: If nothing work : RESTART

頭像
捨棄

The question would have some sense if it was asking about some hot code reloading feature. But it is otherwise quite abvious that code changes are not visible to a running program.

作者

yes but in a web environment i use to just refresh my page to update my script(php,javascript...)

相關帖文 回覆 瀏覽次數 活動
9
3月 24
116073
1
6月 20
11040
2
3月 16
9497
1
3月 15
2919
3
3月 15
8934