I am using odoo now since 7 or 8 months, i did built a quite big custom module based on the CRM module of odoo for the need of a customer. And here is the problem:
- i update a field in my python file .py, for example.
class cdn_courses(osv.Model):
_name = 'cdn.courses'
_order = 'id asc'
def get_total_quantity_intakes(self, cr, uid, ids, field, args, context=None):
res = {}
for lead in self.browse(cr, uid, ids, context=context):
res[lead.id] = 0
for x in lead.intake_ids:
res[lead.id] = res[lead.id] + 1
return res
_columns = {
'id': fields.integer('ID', readonly=True),
'department' : fields.many2one('cdn.course_department', 'Course Department', required=True, select=True, help='The course department of this course'),
'level' : fields.many2one('cdn.course_level', 'Course Level', required=True, select=True, help='The course level of this course'),
'mode' : fields.many2one('cdn.course_mode','Course Mode', required=True, help='The course mode of this course'),
'name':fields.char('name', size=64 ,required=True, help='The name of the course', translate=True),
'description' : fields.text('description', size=512, required=True, help='The description associate to this course', translate=True),
'updator_uid' : fields.float('Updator UID',required=False, help='The UID of the last updator'),
'intake_ids': fields.one2many('cdn.intakes', 'course_id', 'Intakes'),
#here is the update (i make this field translatable)
'website_link' : fields.char('Website link', help='The link to the description of this course on the website.', translate=True),
'portfolio_required' : fields.boolean('Portfolio required', required=False, help='To check if the portfolio is required for this course.'),
'total_quantity_intakes': fields.function(get_total_quantity_intakes, type='float', method = True, string='Total Quantity of intakes for that course', readonly = True),
}
_sql_constraints = [
('uniq_name', 'unique(name)', "A Course with this name or id alread exist, please try again and change the name. If the error persist, please contact the administrator!"),
]
-> Here is my related view for the form:
<record model="ir.ui.view" id="cdn_courses_form">
<field name="name">CDN - Courses form</field>
<field name="model">cdn.courses</field>
<field name="arch" type="xml">
<form string="courses" version="7.0">
<group col="4">
<field name="id" string="ID" readonly='True'/>
<newline />
<field name="name" placeholder='Course Name' string='Course Name' />
<newline/>
<field name="description" placeholder='Course Description' string='Course Description' />
<newline />
<field name="website_link" required='True' placeholder='Course URL' string='Course URL' />
<newline/>
<field name="level" required='True' placeholder="Course Level" string="Course Level" />
<newline/>
<field name="mode" required='True' placeholder="Course Mode" string="Course Mode"/>
<newline/>
<field name="department" required='True' placeholder="Course Department" string="Course Department" />
<newline />
<field name="portfolio_required" placeholder="Portfolio required?" string="Portfolio required?" />
<newline />
<field name="total_quantity_intakes" string="Number Of Actual Planned Out Intakes This Year" readonly='True'/>
</group>
</form>
</field>
</record>
- i deploy my module on my production environment
- i restart odoo
- i upgrade my module
And surprise:
The field website_link is not translatable! I double checked and if i make some changes on production such as change a string name on the view; this is working (meaning my file odoo.conf /etc/odoo/openerp-server.conf is pointing on the good addons files).This is just an example among several, that's only happened in the .py files.
I tried several options such as (https://coderwall.com/p/4zvxiw/how-to-clear-view-cache-in-openerp-7-0) thinking that this might be due to a cache issue but nothing change.
Is someone have any idea on what can be the cause of that?
Many thanks.