تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
7517 أدوات العرض

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

الصورة الرمزية
إهمال
أفضل إجابة

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.

المنشورات ذات الصلة الردود أدوات العرض النشاط
0
مارس 15
3733
1
مارس 15
7109
2
مارس 21
9537
2
فبراير 16
4766
2
مارس 15
5816