Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

using RML to Pull data from other tables

By
bernard
on 4/1/13, 11:38 PM 2,613 views

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?

0

Naresh Soni (nch)

--Naresh Soni (nch)--
Tiny ERP Pvt Ltd
http://www.odoo.com
1281
| 2 2 4
India
--Naresh Soni (nch)--

Team Lead, Odoo(Formerly OpenERP) Support & OPW

Naresh Soni (nch)
On 4/2/13, 5:01 AM

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,

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

bernard
on 4/3/13, 3:12 AM

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

Naresh Soni (nch)
on 4/3/13, 4:30 AM

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...

bernard
on 4/15/13, 5:17 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 4/1/13, 11:38 PM
Seen: 2613 times
Last updated: 3/16/15, 8:10 AM