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

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

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
maj 24
6825
5
mar 20
12701
3
sty 18
3186
1
gru 22
4577
1
maj 18
5118