Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
6847 Lượt xem

In our sales order we have a customer Purchase order number for reference, we need to customise the invoice to add this. As far as I know, this field exists only in the sales order table. So far, I can edit the RML of the invoice but the problem comes trying to pull this reference. I think* the logic should be: if origin = SO130025 (our sale order number) then char = sales_order.customer_ref (sales order table, customer_ref field) else remove node

But I'm having trouble with putting it into code.

Anyone come across this?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi Bernard,

This should not be static. You should call a function (get_customer_ref(origin)) and the function returns the correct ref after searching for the correct sale order. So in your rml you should just have something like.

[[ o.get_customer_ref(origin) or RemoveParentNode(para) ]]

Thanks,

Ảnh đại diện
Huỷ bỏ
Tác giả

So the function is declared in the python script that is used as the parser? sorry, first time developing for openerp.

Hi Bernard, yes right, you will need a parser to be written.

Tác giả

I've tried to use the following but I think my syntax is off: in RML: [[o.getcustomerPO(origin) or '' ]]

in parser.py: def getcustomerPO(self,so_num): saleorder = self.pool.get('sale.order') sale_oID = saleorder.search(self.cr, self.uid,[('name','=','so_num')],context=context) customerPO = saleorder.browse(self.cr, self.uid, sale_oID, context=context) return customerPO Really confused on where to go next...

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 3 15
5364
2
thg 2 24
11930
1
thg 12 22
4548
1
thg 8 22
4984
0
thg 8 17
2901