Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
7511 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 3 15
3733
1
thg 3 15
7108
2
thg 3 21
9536
2
thg 2 16
4763
2
thg 3 15
5816