Odoo Help


[Odoo 8] override function

on 7/29/15, 10:37 PM 757 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

About This Community

This platform 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 Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


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