콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

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
3월 15
3806
1
3월 15
7176
2
3월 21
9631
2
2월 16
4842
2
3월 15
5924