コンテンツへスキップ
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
このフォーラムについて
ヘルプ

TypeError: populate_statement() takes at least 4 arguments (2 given)

購読

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

この質問にフラグが付けられました
typeError
1 返信
6581 ビュー
アバター
Koffi KPONOUGLO

Hi, Please can you help me to correct this error

class account_voucher_populate_statement(models.TransientModel):
_name = "account.voucher.populate.statement"
_description = "Account Voucher Populate Statement"

journal_id = fields.Many2one(
'account.journal',
'Journal',
required=True
)
line_ids = fields.Many2many(
'account.payment',
'account_payment_line_rel',
'payment_id', 'line_id',
'Payment',
domain="[('journal_id', '=', journal_id), ('state', '=', 'posted'), ('bank_statement_line_ids', '=', False)]"
)

def get_statement_line_new(self, cr, uid, payment, statement, context=None):
# Override thi method to modifiy the new statement line to create
ctx = context.copy()
ctx['date'] = payment.date
amount = self.pool.get('res.currency').compute(cr, uid, payment.currency_id.id,
statement.currency.id, payment.amount, context=ctx)

sign = payment.type == 'payment' and -1.0 or 1.0
type = payment.type == 'payment' and 'supplier' or 'customer'
account_id = payment.type == 'payment' and payment.partner_id.property_account_payable.id or payment.partner_id.property_account_receivable.id
return {
'name': payment.reference or payment.number or '?',
'amount': sign * amount,
'type': type,
'partner_id': payment.partner_id.id,
'account_id': account_id,
'statement_id': statement.id,
'ref': payment.name,
'payment_id': payment.id,
'journal_entry_id': payment.move_id.id,
}

def populate_statement(self, cr, uid, ids, context=None):
statement_obj = self.env['account.bank.statement']
statement_line_obj = self.env['account.bank.statement.line']
payment_obj = self.env['account.payment']

if context is None:
context = {}
data = self.read(cr, uid, ids, [], context=context)[0]
payments_ids = data['line_ids']
if not payments_ids:
return {'type': 'ir.actions.act_window_close'}
statement = statement_obj.browse(
cr, uid, context['active_id'], context=context)
for payment in payment_obj.browse(cr, uid, payment_ids, context=context):
statement_line_obj.create(cr, uid,
self.get_statement_line_new(cr, uid, payment, statement, context=context), context=context)
payment_obj.write(
cr, uid, payment_ids, {'is_bank_voucher': True}, context=context)
return {'type': 'ir.actions.act_window_close'}

0
アバター
破棄
アバター
Mohit Ghodasara (mgh)
最善の回答

looks like You are only passing two parameters and the method expects at least 4.
where is the call of this method? populate_statement()
try to give the same parameters calling time 


ok try to do some change like this

def populate_statement(self):
        cr = self._cr
        uid = self._uid
        ids = self._ids
        context = self._context

or

read directly without cr ids etc.

self.read()[0]

do the same with browse, create

you won't get an error

0
アバター
破棄
Koffi KPONOUGLO
著作者

I am calling it in the view like this.

<button name="populate_statement" string="ADD" type="object" class="oe_highlight"/>

How can i do it?

Mohit Ghodasara (mgh)

ok, I think you won't get cr uid etc from the button click.

you can pass parameters in context also but it's not useful in your scenario

what exactly you want to do? maybe you need to find another way

Koffi KPONOUGLO
著作者

I want to get invoice payments directly in the bank.statement line as transaction. Another way is welcome. It is so urgent for me. Please.

Mohit Ghodasara (mgh)

ok I've updated my answer try if it is helpful

Koffi KPONOUGLO
著作者

Thanks. I try it and i get this error

File "C:\Program Files (x86)\Odoo 10.0\server\odoo\addons\account_bank_voucher\wizard\bank_statement_populate.py", line 60, in populate_statement

TypeError: read() takes at most 3 arguments (6 given)

Mohit Ghodasara (mgh)

oh you are using v10

read directly without cr ids etc.

self.read()[0]

do the same with browse, create

Koffi KPONOUGLO
著作者

I did it is working. Thanks a lot. but now i have a new error with the first function

def get_statement_line_new(self, cr, uid, payment, statement, context=None)

-------------------------------------------Error Details ----------------------------

File "C:\Program Files (x86)\Odoo 10.0\server\odoo\addons\account_bank_voucher\wizard\bank_statement_populate.py", line 31, in get_statement_line_new

File "C:\Program Files (x86)\Odoo 10.0\server\odoo\addons\base\res\res_currency.py", line 160, in compute

AttributeError: 'int' object has no attribute 'round'

Mohit Ghodasara (mgh)

don't use type, a type is a keyword in python.

remove that three variable and give direct value and try. something mess over there

and don't forget to tick right mark if the first question is helpful thanks

Koffi KPONOUGLO
著作者

Thanks Mohit. Your help is so great. I am not developper that why i have more difficult do fix bug.

I try what you said by doing this :

typee = payment.type == 'payment' and 'supplier' or 'customer'

but i still get the same error (AttributeError: 'int' object has no attribute 'round).

I don't know if i do exactly what so ask me. Thanks in advance.

Mohit Ghodasara (mgh)

just give direct value to the directory like this 'type': 'payment',

for all sign, type, account_id, and name. make it static first then you could do dynamic

Koffi KPONOUGLO
著作者

Thanks dear Mohit. It is working now.

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

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

登録
関連投稿 返信 ビュー 活動
Database Manager unresponsive 解決済
typeError JS
アバター
アバター
アバター
2
2月 25
2063
TypeError: can't access property "classList"
typeError v15
アバター
0
3月 23
3734
TypeError: <lambda>() takes exactly 4 arguments (1 given)
lambda typeError
アバター
アバター
1
6月 22
7374
Odoo12 TypeError like loop but i have not it any yet
typeError odooV12
アバター
アバター
2
4月 19
3258
Uncaught TypeError: Cannot read properties of null (reading 'CodeMirror') 解決済
chrome error typeError
アバター
1
2月 23
7648
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • 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