Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie

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!

Awatar
Odrzuć

Please explain "Counterpart account". Perhaps with examples.

Autor

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.

Autor Najlepsza odpowiedź

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.

Awatar
Odrzuć

Hi Max,

Can you explain more from code level?

Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
wrz 24
2641
1
cze 24
1494
1
lut 24
1603
2
sty 17
11445
2
mar 15
7657