<|endoftext|> Prompt: Create an Odoo model class named AccountAccount with opening_credit attribute Completion: class AccountAccount(models.Model):
    _name = "account.account"
    _inherit = ['mail.thread']
    _description = "Account"
    opening_credit = fields.Monetary(string="Opening Credit", compute='_compute_opening_debit_credit', inverse='_set_opening_credit', currency_field='company_currency_id')
    def _compute_opening_debit_credit(self):
            self.opening_debit = 0
                    self.opening_credit = 0
                    self.opening_balance = 0
                    if not self.ids:
                        return
                    self.env.cr.execute("""
                        SELECT line.account_id,
                               SUM(line.balance) AS balance,
                               SUM(line.debit) AS debit,
                               SUM(line.credit) AS credit
                          FROM account_move_line line
                          JOIN res_company comp ON comp.id = line.company_id
                         WHERE line.move_id = comp.account_opening_move_id
                           AND line.account_id IN %s
                         GROUP BY line.account_id
                    """, [tuple(self.ids)])
                    result = {r['account_id']: r for r in self.env.cr.dictfetchall()}
                    for record in self:
                        res = result.get(record.id) or {'debit': 0, 'credit': 0, 'balance': 0}
                        record.opening_debit = res['debit']
                        record.opening_credit = res['credit']
                        record.opening_balance = res['balance']
<|endoftext|>