我想开立余下的余额使用功能在odoo-11中的合作伙伴分类帐报告中的date_from和date_to。我怎么能得到?
class OpeningBalance(models.Model):
_inherit = 'res.partner'
# _inherit = 'account.common.partner.report'
def opbal(self, partner_id,date):
query = """
SELECT partner_id, SUM(debit) AS sumdr, SUM(credit) AS sumcr
FROM account_move_line AS aml
WHERE
aml.partner_id = %s
AND aml.date < '%s' %(partner_id,date)"""
self.env.cr.execute(query)
get = cr.fetchall()
get[0].sumcr
get[0].sumdr
bal = sumdr - sumcr
return bal
我希望bal返回输入的最新期初余额。