Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2842 Lượt xem

i have created custom button to create Journal Entries in account.move her the code:

def compute_overheads(self):
if self.total_cost != 0:
print(self.total_cost)
debit_value = {
'name': 'Production Overheads',
'debit': self.total_cost,
'credit': 0.0,
'account_id': self.credit_account,
}

credit_value = {
'name': 'Production Overheads',
'debit': 0.0,
'credit': self.total_cost,
'account_id': self.credit_account,
}

values = {
# 'journal_id': self.
# 'date': self.date.today(),
'ref': 'Production Overheads Costs',
'state': 'draft',
'line_ids': [(0, 0, debit_value), (0,
}
move = self.env['account.move'].create(values)
return move

no error raised when click button but no entries created in accounting

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

At single look code seems to be fine except you have to pass the value for the journal while creating the entry. Other than this, is the code really getting executed ? if yes, what is the result you received in move variable after the create method ?


If you still need sample for reference, please search env['account.move'].create({ inside odoo source code, you will see a lot of samples.


Thanks & Regards

Ảnh đại diện
Huỷ bỏ
Tác giả

i was just need to pass the id of the accounts e.g(self.creadt_account.id).

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 9 23
2113
1
thg 3 23
2732
1
thg 7 21
3586
2
thg 9 24
885
0
thg 6 23
2611