Odooers论坛

欢迎!

该社区面向专业人士和我们产品和服务的爱好者。
分享和讨论最好的内容和新的营销理念,建立您的专业形象,一起成为更好的营销人员。


0

how to count invoice in smart button in odoo 15 ?

形象
odoo
形象
丢弃
2 答案
0
形象
odoo
最佳答案

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

形象
丢弃
0
形象
odoo
最佳答案

Hello  Ra_one_1_11,

Please find code in comment. 

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

1 备注
形象
丢弃
形象
odoo
-

*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)],
}