Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
5171 Vues

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
Ignorer
Meilleure réponse

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
Ignorer
Publications associées Réponses Vues Activité
1
mai 24
6039
5
mars 20
12440
3
janv. 18
3000
1
déc. 22
4324
1
mai 18
4851