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.

0

Emergency please, New user preference don't show !!!

By
Mohsen Javid
on 5/9/16, 8:55 PM 328 views

Hi, i'm newbie in using of Odoo and i understood that in version 9 of Odoo, massive changes applied to this and concurrently don't generated any documentation for this.

I try to add a checkbox on the settings > users > an user > preferences part below of language, all code ran correct and no exception raise but, no any element adding below language. and in debug menu > Fields View Get i see that my field not added.

i show related parts of my module for you

_openerp_.py:

# -*- coding: utf-8 -*-

{

    'name': "JalaliDateView",

    'summary': """Show dates and date-picker as Jalali date""",

    'description': "Show dates and date-picker as Jalali date",

    'author': "Mohsen Javidpanah",

    'website': "http://www.xyz.ir",

    'category': 'Uncategorized',

    'version': '0.1',

    'depends': ['base', 'web'],

    'data': [

        'security/ir.model.access.csv',

        'views/views.xml',

        'views/templates.xml',

        'views/user_profile.xml',

    ],

    'demo': [

        'demo/demo.xml',

    ],

}


__init__.py:

from . import models, user_profile


user_profile.py:

from openerp import models, fields

import werkzeug.local

_request_stack = werkzeug.local.LocalStack()

request = _request_stack()

class res_users(models.Model):

     _inherit = "res.users"

    _name = "jdv.users"

    context_jdv = fields.Boolean(string='Show calendar as Jalali?', help="Using jalali calendar throughout views.")

    _defaults = {

        'context_jdv': True,

    }

res_users()


userprofile.xml:

<?xml version="1.0" encoding="UTF-8"?>

<openerp>

     <data>

        <record model="ir.rule" id="ir_values_jdv_users_rule">

             <field name="name">Jalali Date view Users Rules</field>

             <field name="model_id" ref="model_jdv_users"/>

             <field name="domain_force">[('field','operator','value'),('user_id','=',user.id)]</field>

             <field name="perm_read" eval="True"/>

             <field name="perm_write" eval="True"/>

             <field name="perm_unlink" eval="True"/>

            <field name="perm_create" eval="True"/>

        </record>

        <record id="jdv_users_conf_simple_modif" model="ir.ui.view">

            <field name="name">res.users.preferences.form.jdv</field>

            <field name="model">jdv.users</field>

            <field name="inherit_id" ref="base.view_users_form_simple_modif"/>

            <field name="priority" eval="120"></field>

            <field name="arch" type="xml">

               <data>

                   <xpath expr='//group[@name="preferences"]' position="after">

                       <field name="context_jdv" string="Show Jalali Calculator?" readonly="0"/>

                   </xpath>

               </data>

           </field>

        </record>

        <record id="jdv_users_conf" model="ir.ui.view">

            <field name="name">res.users.preferences.form.jdv</field>

            <field name="model">jdv.users</field>

            <field name="inherit_id" ref="base.view_users_form"/>

            <field name="priority" eval="220"></field>

            <field name="arch" type="xml">

                <data>

                    <xpath expr='//field[@name="lang"]' position="after">

                        <field name="context_jdv" string="Show Jalali Calculator?" readonly="0"/>

                    </xpath>

               </data>

            </field>

        </record>

    </data>

</openerp>

1

Ahmed M.Elmubarak

--Ahmed M.Elmubarak--
2988
| 5 3 5
Sudan
--Ahmed M.Elmubarak--


Ahmed M.Elmubarak
On 5/10/16, 2:29 AM

Hello,

If you'd like to add a new filed to the res.user in the original model; I think you don't need to add 

_name = "jdv.users"

So try to remove it from the 

user_profile.py & your views

also use res.users instead of jdv.users in the xml views:

<field name="model">jdv.users</field>
to be 

<field name="model">res.users</field>

Hope this will helps




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

1 follower(s)

Stats

Asked: 5/9/16, 8:55 PM
Seen: 328 times
Last updated: 5/10/16, 6:35 AM