Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
8863 Tampilan

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?

Avatar
Buang
Jawaban Terbai

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.

Avatar
Buang

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

Penulis Jawaban Terbai

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

Avatar
Buang

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.

Penulis

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

Post Terkait Replies Tampilan Aktivitas
9
Mar 24
116081
1
Jun 20
11045
2
Mar 16
9497
1
Mar 15
2919
3
Mar 15
8938