[英]RML report openerp 7
How to get the field which is present in sale.order in invoice report. 如何获取发票报表中sales.order中存在的字段。 So invoice report use the model account.invoice, if i add a function in report.py it allow only self.cr,self.uid because we are not using osv.memory.
因此,发票报告使用模型account.invoice,如果我在report.py中添加一个函数,则它仅允许self.cr,self.uid,因为我们没有使用osv.memory。 So how to get the value of cust_ref_value from sale.order to invoice report.
因此,如何从sale.order到发票报告中获取cust_ref_value的值。
We can track from the Source Document
我们可以从
Source Document
追踪
In report.py
we need to make a function and pass origin in it. 在
report.py
我们需要创建一个函数并在其中传递原点。
def __init__(self, cr, uid, name, context):
super(your_report_calss_name, self).__init__(cr, uid, name, context)
self.localcontext.update({
'time': time,
'get_cust_ref_val': self._get_cust_ref_val,
})
This method will check like origin is SO or PO or OUT/###:SO### or IN/###:PO### so following case be here 此方法将检查原点是SO还是PO或OUT / ###:SO ###或IN / ###:PO ###,所以以下情况在这里
def _get_cust_ref_val(self, origin)
if 'SO' in origin:
if 'OUT/' in origin:
so_name = str(origin).split(':')[1]
sale_id = self.pool.get('sale.order').search(self.cr, self.uid, [('name', '=', so_name)]
if sale_id:
sale = self.pool.get('sale.order').browse(self.cr, self.uid, sale_id)
return sale.cust_ref_value
else:
sale_id = self.pool.get('sale.order').search(self.cr, self.uid, [('name', '=', origin)]
if sale_id:
sale = self.pool.get('sale.order').browse(self.cr, self.uid, sale_id)
return sale.cust_ref_value
else:
return ''
and from the rml side 从RML方面
[[ get_cust_ref_val(inv.origin) ]]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.