Odoo Help


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.


[Odoo 8] override function

on 7/29/15, 10:37 PM 410 views

On Puchase.py

 def make_po(self, cr, uid, ids, context=None):

available_draft_po_ids = po_obj.search(cr, uid, [

('partner_id', '=', partner.id), ('state', '=', 'draft'), ('picking_type_id', '=', procurement.rule_id.picking_type_id.id),
('location_id', '=', procurement.location_id.id), ('company_id', '=', procurement.company_id.id), ('dest_address_id', '=', procurement.partner_dest_id.id)], context=context)


i want set value of available_draft_po_ids is null but i don't want modify base code on purchase.py

So how to override it?

(sorry i speak English very bad)

Abdul wahid
On 7/30/15, 1:47 AM

def _prepare_invoice(self, cr, uid, order, lines, context=None):

res=super(CLASS NAME, self)._prepare_invoice(cr, uid, order, lines, context=context)

print order.order_policy

inv_obj = self.pool.get('account.invoice.line')

inv_obj.write(cr, uid, lines, {'Order': order.Order.id}, context=context)

inv_obj.write(cr, uid, lines, {'staff': order.staff.id}, context=context)

return res

here i am overriding _prepare_invoice from  sale/sale.py.AND not changing the current execution of that function

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

2 follower(s)


Asked: 7/29/15, 10:37 PM
Seen: 410 times
Last updated: 7/30/15, 1:47 AM