Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
5528 Vizualizări

Hi, Community and Master of Odoo

Please Help  me


I Have Custome Module named "Cash Advance" and I want to send/post  my data from Cash Advance to Journal Entries, which is you can do that on Invoice to post on Journal Entries automaticly.  Data will  be send to Journal Entries when state my data on the module approved.

My question is, what method  i need to do to send my data from my custom module to Journal Entries  just like Invoice to Journal Entries ?


Thanks Community please help me...

Imagine profil
Abandonează
Cel mai bun răspuns

Hi,

If you are looking to create a journal entry you can directly call the create method of the corresponding model and pass the values into it.


Please see this sample code,

debit_vals = {
'name': self.reason,
'debit': abs(self.amount),
'credit': 0.0,
'account_id': self.debit_account_id.id,
'tax_line_id': adjustment_type == 'debit' and self.tax_id.id or False,
}
credit_vals = {
'name': self.reason,
'debit': 0.0,
'credit': abs(self.amount),
'account_id': self.credit_account_id.id,
'tax_line_id': adjustment_type == 'credit' and self.tax_id.id or False,
}
vals = {
'journal_id': self.journal_id.id,
'date': self.date,
'state': 'draft',
'line_ids': [(0, 0, debit_vals), (0, 0, credit_vals)]
}
move = self.env['account.move'].create(vals)


Thanks

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
mai 24
6833
5
mar. 20
12704
3
ian. 18
3188
1
dec. 22
4580
1
mai 18
5120