Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
1929 มุมมอง

My model in record.py

from odoo import fields,models,api
class RecCounts(models.Model):
_name = "rec.counts"
_description = "Records Creation Analysis"

sale_module = fields.Integer(string="Sales Module")

def import_rec_counts(self):
self.sale_module = 10
​ return self
.sale_module


My record in record.xml file 


    
Import Records
ir.actions.server


code
model.import_rec_counts()

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hii Nano,

You need to change following code in your xml and py.

Please find code in comment. 

I hope it will be useful to you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

อวตาร
ละทิ้ง

Please find code here :-

XML->

-- model.import_rec_counts()
++ records.import_rec_counts()

Reason-Server actions are performed on records.There may be multiple records or an single record.

py->

-- def import_rec_counts(self):
self.sale_module = 10
return self.sale_module

++ def import_rec_counts(self):
for record in self:
record.sale_module=10
return record.sale_module

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
มี.ค. 21
3118
0
ธ.ค. 24
2032
1
ก.ค. 25
2397
2
ก.ค. 25
7888
2
ก.ค. 25
4295