Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
5510 Tampilan

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...

Avatar
Buang
Jawaban Terbai

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

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
1
Mei 24
6830
5
Mar 20
12703
3
Jan 18
3186
1
Des 22
4578
1
Mei 18
5120