Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

3

How to make OpenERP take my python code modifications into account?

By
Bonnet Denis
on 2/12/13, 11:38 AM 2,812 views

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?

8

Antonin Bourguignon (abo)

--Antonin Bourguignon (abo)--
912
| 0 0 0
--Antonin Bourguignon (abo)--
Murder simulators enthusiast. http://gaming.stackexchange.com/users/15726/anto
Antonin Bourguignon (abo)
On 2/14/13, 12:09 PM

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

Quentin De Paoli (qdp)
on 2/15/13, 12:21 PM

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

vita soa
on 7/16/13, 5:40 AM
1

Bonnet Denis

--Bonnet Denis--
925
| 5 6 8
Vannes, France
--Bonnet Denis--

Engeneer at MGS Consulting Ouest at Vannes, FRANCE

Bonnet Denis
On 2/12/13, 12:49 PM

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.

Vo Minh Thu
on 2/15/13, 6:48 AM

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

Bonnet Denis
on 2/15/13, 9:28 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 2/12/13, 11:38 AM
Seen: 2812 times
Last updated: 3/16/15, 8:10 AM