Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
2523 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Autor

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 Odpovědi Zobrazení Aktivita
1
kvě 24
3031
1
dub 24
26590
2
čvc 22
3228
2
čvc 22
3055
0
led 22
2244