Odoo Help

0

Where is created the procurement order in the Python code?

By
Pascal Tremblay
on 2/24/16, 9:48 AM 748 views

Hello all,

I have two questions for my Odoo 8.

When we confirm a sale order, where is created the procurement order in the Python code?

When we confirm a pos order, where is created the procurement order in the Python code?

Thanks to help

1

Axel Mendoza

--Axel Mendoza--
11023
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 2/24/16, 1:50 PM

Hi Pascal

For sales the procurement is created on the action_ship_create method, specifically this line build the values for the procurement and create it

vals = self._prepare_order_line_procurement(cr, uid, order, line, group_id=order.procurement_group_id.id, context=context)

ctx = context.copy()

ctx['procurement_autorun_defer'] = True

proc_id = procurement_obj.create(cr, uid, vals, context=ctx)

At /openerp/addons/sale/sale.py

For purchases the procurement is created on the make_po method, specifically this code build the values for the procurement and create it

po_vals = {

'name': name,

'origin': procurement.origin,

'partner_id': partner.id,

'location_id': procurement.location_id.id,

'picking_type_id': procurement.rule_id.picking_type_id.id,

'pricelist_id': partner.property_product_pricelist_purchase.id,

'currency_id': partner.property_product_pricelist_purchase and partner.property_product_pricelist_purchase.currency_id.id or procurement.company_id.currency_id.id,

'date_order': purchase_date.strftime(DEFAULT_SERVER_DATETIME_FORMAT),

'company_id': procurement.company_id.id,

'fiscal_position': po_obj.onchange_partner_id(cr, uid, None, partner.id, context=context)['value']['fiscal_position'],

'payment_term_id': partner.property_supplier_payment_term.id or False,

'dest_address_id': procurement.partner_dest_id.id,

}

po_id = self.create_procurement_purchase_order(cr, SUPERUSER_ID, procurement, po_vals, line_vals, context=context)

Hope this helps

Thanks Axel. For the pos order, I imagine that action_ship_create method is also used. like a sale order. I will verify.

Pascal Tremblay
on 2/24/16, 2:20 PM

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.

Register

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

1 follower(s)

Stats

Asked: 2/24/16, 9:48 AM
Seen: 748 times
Last updated: 2/24/16, 2:21 PM