コンテンツへスキップ
メニュー
この質問にフラグが付けられました

Greetings,

I'm currently trying to create a couple reports for my company, and one of the required fields is the counterpart field from the account.move.line model. Currently I'm writing a Python script for the PostgreSQL backend that Odoo uses, because my company requires some additional things in the report Odoo can't provide, and furthermore, I'm not comfortable with module development yet (and would like to avoid it anyways, for this task at least). The counterpart field is the only field that's missing, the report is otherwise finished completely.

So, my question is, how is the counterpart field calculated / chosen? If it's not too complicated, I'd like to do it myself for reasons stated above.

Thank you very much in advance!

アバター
破棄

Please explain "Counterpart account". Perhaps with examples.

著作者

The "Counterpart" can be found when you go to Accounting > Adviser > Journal Items. On the far right, perhaps some horizontal scrolling is needed, there is a field named counterpart. Its description says: "Compute the counter part accounts of this journal item for this journal entry. This can be needed in reports." The field shows the account number(s) related to a given journal item of a journal entry. https://i.imgur.com/nVlaQX6.png

I am unsure if I can easily replicate its function in a script, but my current idea is to just copy and store its content to a new field, that I can then access from postgres. I will keep this thread updated.

著作者 最善の回答

Update on the issue:

I managed to circumvent it by creating an external field that references the counterpart field, copies its content and saves it, which is just enough for my uses. I did this because I did not want to tamper with Odoo's base fields too much.

アバター
破棄

Hi Max,

Can you explain more from code level?

最善の回答

The field counterpart in the model account.move.line got the information about the other account used in the journal entry. A journal entry must always balance Credit and Debit. So if the journal item is a credit posting, the counterpart field will have the debit account. 

In some cases there can be many counterpart accounts.   

If you need this information I think it is better to access it from Account.move

アバター
破棄
関連投稿 返信 ビュー 活動
1
9月 24
2858
1
6月 24
1570
1
2月 24
1676
2
1月 17
11562
2
3月 15
7740