cashin.balance(<NewId 0x7f1d848e6e80>,).total
This is my errror
.py file
from odoo import api, models, fields
class CashinBalance(models.Model):
_name = 'cashin.balance'
_description = 'Cash-in Balance'
atk = fields.Integer('TK.1000')
btk = fields.Integer('TK.500')
ctk = fields.Integer('TK.100')
dtk = fields.Integer('TK.50')
etk = fields.Integer('TK.20')
ftk = fields.Integer('TK.10')
gtk = fields.Integer('TK.5')
htk = fields.Integer('TK.2')
date = fields.Date(required=True, default=fields.Date.context_today)
total = fields.Integer(compute='_compute_amount')
@api.depends('atk', 'btk', 'ctk', 'dtk', 'etk', 'ftk', 'gtk', 'htk')
def _compute_amount(self):
A = self.atk * 1000
B = self.btk * 500
C = self.ctk * 100
D = self.dtk * 50
E = self.etk * 20
F = self.ftk * 10
G = self.gtk * 5
H = self.htk * 2
R = A + B + C + D + E + F + G + H
return R
class CashoutBalance(models.Model):
_name = 'cashout.balance'
_description = 'Cash-out Balance'
a = fields.Integer('TK.1000')
b = fields.Integer('TK.500')
c = fields.Integer('TK.100')
d = fields.Integer('TK.50')
e = fields.Integer('TK.20')
f = fields.Integer('TK.10')
g = fields.Integer('TK.5')
h = fields.Integer('TK.2')
date = fields.Date(required=True, default=fields.Date.context_today)
amount = fields.Integer(compute='compute_amount')
@api.depends('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h')
def compute_amount(self):
A = self.a * 1000
B = self.b * 500
C = self.c * 100
D = self.d * 50
E = self.e * 20
F = self.f * 10
G = self.g * 5
H = self.h * 2
r = A + B + C + D + E + F + G + H
return r
.xml file<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!-- Tree view -->
<record id="cashin_tree_view" model="ir.ui.view">
<field name="name">cashin.tree.view</field>
<field name="model">cashin.balance</field>
<!-- <field name="view_type">form</field>-->
<!-- <field name="view_mode">tree</field>-->
<field name="arch" type="xml">
<tree string="Cash">
<field name="atk"/>
<field name="btk"/>
<field name="ctk"/>
<field name="dtk"/>
<field name="etk"/>
<field name="ftk"/>
<field name="gtk"/>
<field name="htk"/>
<field name="date"/>
<field name="total"/>
</tree>
</field>
</record>
<!-- End Tree View -->
<!-- Form View for -->
<record id="cashin_form_view" model="ir.ui.view">
<field name="name">cashin.form.view</field>
<field name="model">cashin.balance</field>
<!-- <field name="view_type">form</field>-->
<!-- <field name="view_mode">form</field>-->
<field name="arch" type="xml">
<form>
<sheet>
<group style="text-align:center" string="Yuko Leather Goods Ltd.">
</group>
<group style="text-align:center" string="Cash-In Details">
</group>
<group>
<group string="Tk-Quantity">
</group>
</group>
<group>
<group>
<field name="atk"/>
<br/>
<field name="btk"/>
<br/>
<field name="ctk"/>
<br/>
<field name="dtk"/>
<br/>
<field name="etk"/>
<br/>
<field name="ftk"/>
<br/>
<field name="gtk"/>
<br/>
<field name="htk"/>
<br/>
<field name="date"/>
<br/>
</group>
<group>
<field name="total"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="action_cashin" model="ir.actions.act_window" >
<field name="name"> Cash </field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">cashin.balance</field>
<!-- <field name="view_type">form</field>-->
<field name="view_mode">tree,form</field>
</record>
<menuitem id="Cash_root" name="Cash Management" sequence="1" action="action_cashin"/>
<!-- <menuitem id="cash_sub" name="Total" parent="Cash_root"/>-->
</odoo>