Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
7506 Vistas

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

Avatar
Descartar
Mejor respuesta

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

Avatar
Descartar
Autor

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

Publicaciones relacionadas Respuestas Vistas Actividad
0
mar 15
3733
1
mar 15
7105
2
mar 21
9533
2
feb 16
4763
2
mar 15
5815