How i retrieve data from total field and summation of total field value will show?
def get_data(self):
query = """select total(this is field name)from cashin_balance(database model name)"""
self.env.cr.execute(query)
query_result = self.env.cr.dictfetchall()
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Boekhouding
- Voorraad
- PoS
- Project
- MRP
Deze vraag is gerapporteerd
I think you want to fetch the sum of the total field form the database table.
Try the following query:
SELECT SUM(total) FROM cashin_balance
Sir where i write query and what is the code to get data and how to view
.py file
from odoo import api, models, fields
class CashinBalance(models.Model):
_name = 'cashin.balance'
# _inherit = 'mail.thread'
_description = 'Cash-in Details'
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()
total = fields.Integer(compute='total_cash', store=True)
# cash = fields.Integer(compute='_get_users', store=True)
@api.depends('a','b','c','d','e','f','g','h')
def total_cash(self):
for expense in self:
expense.total = expense.a * 1000 + expense.b*500 + expense.c*100 + expense.d*50 +expense.e*20 + expense.f*10 + expense.g*5 + expense.h*2
please give the code which will be right
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
AanmeldenGerelateerde posts | Antwoorden | Weergaven | Activiteit | |
---|---|---|---|---|
Data for relations table
Opgelost
|
|
1
apr. 24
|
2219 | |
|
1
aug. 22
|
2998 | ||
|
0
mei 17
|
7649 | ||
|
1
mrt. 15
|
4067 | ||
|
2
mrt. 15
|
4607 |