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

hello everyone 


i created one module in this module i create invoice . i add smart button in form . when i select res.partner and create invoice so in this smart button i got all of invoice of this res.partner ..

but i want only this invoice which is create by this form like sale module .


anyone know how can i do this 


thank you in advance .

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

Add record id of object created from that form as well in invoice and filter out invoices with partner and record id in your smart button method

อวตาร
ละทิ้ง

Thank you.

คำตอบที่ดีที่สุด

Hello  Ra_one_1_11,

Please find code in comment. 

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

อวตาร
ละทิ้ง

*Add source code in your module as per below example.

def _compute_invoice_count(self)
for rec in self:
rec.invoice_count = len(rec.invoice_ids)

invoice_count = field.Integer("Invoice Count", compute="_compute_invoice_count")
invoice_ids = field.One2Many("account.move", "sale_id")

def method_name(self):
return {
"name": "Invoice",
"type": "ir.actions.act_window",
"view_mode": "tree,form",
"res_model": "account.move",
"domain": [("sale_id", "=", self.id)],
}

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มิ.ย. 22
3044
1
พ.ค. 22
3350
1
ธ.ค. 21
2663
4
มี.ค. 25
51078
1
เม.ย. 24
5058