Skip to Content
Menu
This question has been flagged
1 Reply
1615 Views
in the accounting dashboard, how can I tell if one journal or another was selected. How to know if the invoice journal or a credit memo journal was selected, I need to take an action according to the selected journal.
I located the action of the button, but I don't identify where the sales journal differs.
<t t-name="JournalBodySalePurchase" id="account.JournalBodySalePurchase">
<div class="col-xs-6 o_kanban_primary_left">
<t t-if="journal_type == 'sale'">
<button type="object" name="action_boleta_venta1" class="btn btn-primary btn-sm o_invoice_new">
<span>New Inv444444oice</span>
</button>
</t>
Please your support.

Avatar
Discard
Best Answer

Hi,

If you need to make this comparison inside the function named action_boleta_venta1 , using the self you can access the corresponding journal. If you need to check the type of the journal inside this function use this code,

if self.type == "cash":
#do something
elif self.type == "bank"
#do something


Thanks

Avatar
Discard
Author

How could I refer to the type of sale, but credit note.

Thanks

Author

Because within the sale type, there are several definitions. Example: invoice journal, invoice credit note, and all of the sale type.

from self you can get the account.journal record, then using the .operator you can access the corresponding field inside the model

Author

Thank you so much for everything

Related Posts Replies Views Activity
2
Nov 24
267
1
Oct 24
335
4
Oct 24
325
2
Oct 24
362
2
Dec 24
670