Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

cant call this func odoo, error :TypeError: update_groups() missing 1 required positional argument: 'uids'.

Naroči se

Get notified when there's activity on this post

This question has been flagged
functionodoo
2 Odgovori
5816 Prikazi
Avatar
trung

i make a module profile to add groups into profile. when make a new user, we can add profile for user profiles and user will auto authorized groups in profile. but i cant make user auto add groups from profile. cant someone help me pls. thanks a lot. i had thit error: TypeError: update_groups() missing 1 required positional argument: 'uids'.

There is my code: profile.py



# -*- coding: utf-8 -*- from odoo import models,fields, api,tools import string from odoo.tools.translate import _ class Users(models.Model): _inherit = 'res.users' profile_id = fields.Many2one('res.profiles',string="Profile") profiles_ids = fields.Many2many('res.profiles','profile_user_rel','user_id','profile_id', string='Profile Name') def update_groups(self,uids): users_pool = self.env["res.profiles"] if uids: for user in users_pool.browse(uids): if not user.profiles_ids and user.id != 2: user.write({'groups_id':[[6,0,[]]]}) if user.profiles_ids: sql = """UPDATE FROM res_groups_users_rel WHERE uid = %s"""%(user.id) self._cr.execute(sql) groups_ids = [] for profile in user.profiles_ids: groups_ids += [x.id for x in profile.groups_ids if x.id not in groups_ids] user.write({'groups_id':[[6,0,groups_ids]]}) return True def update_profile(self): self.env["user.profiles"].update_groups(self.ids) return True class GroupInherit(models.Model): _inherit = 'res.groups' profiles_groups_ids = fields.Many2many('res.profiles','profile_group_rel','group_id','profile_id', string='Profile Name') class UserProfile(models.Model): _name = 'res.profiles' _description = 'Profile Record' _rec_name = 'profile_name' _sql_constraints = [('name_uniq','unique(name)', 'Profile name must be unique!'),] _order = "profile_name" profile_name = fields.Char(string='Name', required=True) groups_ids = fields.Many2many('res.groups','profile_group_rel','profile_id','group_id',string='Authorized Group') user_ids = fields.Many2many('res.users','profile_user_rel','profile_id','user_id', string='User Name') ``` profile.xml: ``` <?xml version="1.0" encoding="UTF-8"?> <odoo> <!-- tree view --> <record id="profile_tree" model="ir.ui.view"> <field name="name">user.profile.tree</field> <field name="model">res.profiles</field> <field name="arch" type="xml"> <tree string= "profile"> <field name="profile_name"/> <field name="user_ids"/> <field name="groups_ids"/> </tree> </field> </record> <!-- view form --> <record id="student_form" model="ir.ui.view"> <field name="name">user.profile.form</field> <field name="model">res.profiles</field> <field name="arch" type="xml"> <form string="Profile"> <sheet> <div class="oe_title"> </div> <group> <group><field name="profile_name"/></group> <group><field name="user_ids" widget="many2many_tags"/></group> <group><field name="groups_ids"/></group> </group> </sheet> </form> </field> </record> <!--action of the student menu--> <record id="action_profile" model="ir.actions.act_window"> <field name="name">Profile</field> <field name="type">ir.actions.act_window</field> <field name="res_model">res.profiles</field> <field name="view_mode">tree,form</field> <field name="help" type="html"> <p class="o_view_nocontent_smiling_face"> Create First profile ! </p> </field> </record> <!-- profile name in group view --> <record id="group_inherit" model="ir.ui.view"> <field name="name">group.inherit</field> <field name="model">res.groups</field> <field name="inherit_id" ref="base.view_groups_form"></field> <field name="arch" type="xml"> <field name="name" position="after"> <field name="profiles_groups_ids"/> </field> </field> </record> <!-- profile name in user view --> <record id="user_inherit" model="ir.ui.view"> <field name="name">user.inherit</field> <field name="model">res.users</field> <field name="inherit_id" ref="base.view_users_form"></field> <field name="arch" type="xml"> <field name="login" position="after"> <field name="profiles_ids"/> </field> <field name="profiles_ids" position="after"> <div class='oe_button_box' name="button_box"><button name='update_groups' type="object" class="oe_stat_button" string="update"></button></div> </field> <button name="action_show_groups" position="attributes"> <attribute name="invisible">1</attribute> </button> <field name="groups_count" position="attributes"> <attribute name="invisible">1</attribute> </field> </field> </record> <menuitem id="profiles" name="User Profile" parent="base.menu_users" sequence="4" action="action_profile"/> <menuitem id="user_root" name="Profile" sequence="0"/> <menuitem id="user_profile" name ="Profile" parent="user_root" action="action_profile"/> </odoo> ```
0
Avatar
Opusti
Avatar
trung
Avtor Best Answer

Hi Hemangi Rupareliya, 

it cant be solved

i think my browse is wrong but i dont no how to fix

0
Avatar
Opusti
Hemangi Rupareliya(rupareliyahemangi145@gmail.com)

Hello Trung,

Have you renamed the argument in following all lines?

1. def update_groups(self,uids):

users_pool = self.env["res.profiles"]

2. if uids:

3. for user in users_pool.browse(uids):

Avatar
Hemangi Rupareliya(rupareliyahemangi145@gmail.com)
Best Answer

Hello Trung,

Try to use another argument name instead of 'uids'.

0
Avatar
Opusti
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
How To Calculate Age From Birthday Solved
function odoo odoo10.0
Avatar
Avatar
Avatar
Avatar
Avatar
7
sep. 21
29496
ODOO: FIELDS TYPE FUNCTION
function fields odoo
Avatar
0
jul. 16
5772
QWEB: How to call a function to test in odoo
function qweb odoo
Avatar
Avatar
Avatar
2
jun. 16
7555
How do I go about this error? I am trying to uninstall a module
odoo
Avatar
0
nov. 25
3340
production of not enough materials for a PO
function
Avatar
Avatar
Avatar
2
sep. 25
1110
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now