Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
2063 Prikazi

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

Avatar
Opusti
Best Answer

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

Avatar
Opusti
Avtor

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?

Related Posts Odgovori Prikazi Aktivnost
1
maj 24
2130
1
apr. 24
25417
2
jul. 22
2610
2
jul. 22
2508
0
jan. 22
1913