콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
2556 화면

I created form view for bank account and i want to make record from bank account automated inserted in bank journal view (journal.account) when its created

class BankAccount(models.Model):
_name = 'bank.account'
_description = "Bank Account"

bank_id = fields.Many2one('res.bank', string="Bank")
company_id = fields.Many2one('res.company', string="Company", default=lambda self: self.env.user.company_id.id)

thanks

아바타
취소
베스트 답변

Hello, 

For this you can use following way:

1. Use default_get method

2. Add default method into M2O filed

I hope you're issue will be resolved. 

Thanks

아바타
취소
작성자

when i create new bank account so it also created record in journal
did you know what's wrong with my code below ?
def create(self, vals):
res = super(AccountJournal, self).create()
for rec in self:
vals = {
'acc_number': rec.acc_number.id,
'bank_id': rec.bank_id.id,
'bank_bic': rec.bank_bic.id,
'company_id': rec.company_id.id,
'branch_id': rec.branch_id.id,
}
self.env['bank.account.account'].create(vals)
return res

Hello Deny,

This method added into journal object?

관련 게시물 답글 화면 활동
1
5월 24
3057
1
4월 24
26636
2
7월 22
3251
2
7월 22
3079
0
1월 22
2257