コンテンツへスキップ
Odoo メニュー
  • サインイン
  • 無料で15日試す
  • アプリ
    財務
    • 会計
    • 請求
    • 経費
    • スプレッドシート(BI)
    • ドキュメント管理
    • 署名
    販売
    • CRM
    • 販売
    • POS店舗
    • POSレストラン
    • サブスクリプション
    • レンタル
    ウェブサイト
    • ウェブサイトビルダー
    • eコマース
    • ブログ
    • フォーラム
    • ライブチャット
    • eラーニング
    サプライチェーン
    • 在庫
    • 製造
    • 製品ライフサイクル管理 (PLM)
    • 購買
    • 整備
    • 品質
    人事業務
    • 従業員管理
    • 採用
    • 休暇管理
    • 人事評価
    • リファラル
    • フリート
    マーケティング
    • ソーシャルマーケティング
    • メールマーケティング
    • SMSマーケティング
    • イベント
    • マーケティングオートメーション
    • アンケート調査
    サービス
    • プロジェクト管理
    • タイムシート
    • フィールドサービス
    • ヘルプデスク
    • 計画
    • アポイントメント
    生産性向上ツール
    • ディスカッション
    • 承認
    • IoT
    • VoIP
    • ナレッジ
    • WhatsApp
    サードパーティアプリ Odooスタジオ Odooクラウドプラットホーム
  • インダストリー(業種別ソリューション)
    小売
    • 書店
    • アパレルショップ
    • 家具専門店
    • 食料品店
    • 金物店
    • 玩具店
    飲食・ホスピタリティ業界
    • バー・パブ
    • レストラン
    • ファストフード
    • ゲストハウス
    • 飲料販売代理店
    • ホテル
    不動産
    • 不動産会社
    • 建築事務所
    • 建設
    • 不動産管理
    • 造園
    • 住宅所有者組合
    コンサルティング
    • 会計事務所
    • Odooパートナー
    • マーケティングエージェンシー
    • 法律事務所
    • 人材派遣
    • 監査・認証
    製造
    • テキスタイル
    • 金属
    • 家具
    • 飲食
    • 醸造所
    • コーポレートギフト
    ヘルス & フィットネス
    • スポーツクラブ
    • 眼鏡店
    • フィットネスセンター
    • ウェルネス専門家
    • 薬局
    • ヘアサロン
    業種
    • 便利屋
    • IT ハードウェア・サポート
    • 太陽エネルギーシステム
    • 靴メーカー
    • クリーニングサービス
    • 空調設備サービス
    その他
    • 非営利団体
    • 環境機関
    • ビルボードレンタル
    • 写真
    • 自転車リース
    • ソフトウェアリセラー
    すべての業種を見る
  • コミュニティ
    学ぶ
    • チュートリアル
    • ドキュメンテーション
    • 認定
    • トレーニング
    • ブログ
    • ポッドキャスト
    教育サポート
    • 教育プログラム
    • Scale Up! ビジネスゲーム
    • Odooオフィス訪問
    ソフトを入手
    • ダウンロード
    • エディションを比較
    • リリース
    コラボレーション
    • Github
    • フォーラム
    • イベント
    • 翻訳
    • パートナーになる
    • パートナー様向けサービス
    • 会計事務所を登録
    サービス利用
    • パートナー一覧
    • 会計事務所一覧
    • 今すぐ相談する
    • 導入支援サービス
    • お客様一覧
    • サポート
    • アップグレード
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    製品デモを利用する
  • 料金
  • ヘルプ

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

  • CRM
  • e-Commerce
  • 会計
  • 在庫
  • PoS
  • プロジェクト
  • MRP
All apps
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
odoo accounting v14 pos v15
このフォーラムについて
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
odoo accounting v14 pos v15
このフォーラムについて
ヘルプ

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

購読

この投稿に活動があった際に通知を受け取ります

この質問にフラグが付けられました
functionodoo
2 返信
5819 ビュー
アバター
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
アバター
破棄
アバター
trung
著作者 最善の回答

Hi Hemangi Rupareliya, 

it cant be solved

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

0
アバター
破棄
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):

アバター
Hemangi Rupareliya(rupareliyahemangi145@gmail.com)
最善の回答

Hello Trung,

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

0
アバター
破棄
ディスカッションを楽しんでいますか?読むだけでなく、参加しましょう!

今すぐアカウントを作成して、限定機能を利用したり、素晴らしいコミュニティと交流しましょう!

登録
関連投稿 返信 ビュー 活動
How To Calculate Age From Birthday 解決済
function odoo odoo10.0
アバター
アバター
アバター
アバター
アバター
7
9月 21
29496
ODOO: FIELDS TYPE FUNCTION
function fields odoo
アバター
0
7月 16
5774
QWEB: How to call a function to test in odoo
function qweb odoo
アバター
アバター
アバター
2
6月 16
7557
How do I go about this error? I am trying to uninstall a module
odoo
アバター
0
11月 25
3342
production of not enough materials for a PO
function
アバター
アバター
アバター
2
9月 25
1111
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • Github
  • Runbot
  • 翻訳
サービス
  • Odoo.shホスティング
  • サポート
  • アップグレード
  • カスタム開発
  • 教育プログラム
  • 会計事務所一覧
  • パートナー一覧
  • パートナーになる
企業情報
  • 会社概要
  • ブランドアセット
  • お問い合わせ
  • 採用情報
  • イベント
  • ポッドキャスト
  • ブログ
  • お客様一覧
  • リーガル情報 • プライバシーポリシー
  • セキュリティ
الْعَرَبيّة 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(オドゥー)は、CRM、eコマース、会計、在庫管理、POS、プロジェクト管理など、企業のさまざまな業務を一つのシステムで管理できる、ベルギー発のオープンソースのERPソフトウェアです。

高機能で使いやすく、完全に統合されたERPとして、ユニークな価値を提供しています。

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