Skip to Content
Menu
This question has been flagged
1 Reply
7750 Views

We run an ecommerce shop (Magento with the OCA Connector) and use Odoo for inventory management and purchasing. We now want Odoo to create purchase orders for all incoming sales orders where the stock is not available. I managed that by creating reordering rules for alle products and by assigning suppliers to all products. Our process is that we order once a day with our production partners, therefore Odoo automatically merges multiple purchase orders to one order. This behavior is fine, but I have now the problem that I don't know which purchase order line belongs to which sales order. How can I add the sales order reference to each purchase order line?

Avatar
Discard
Author Best Answer

we finally found a solution. there is a great plugin out there that allows exactly that functionality:


https://apps.openerp.com/apps/modules/8.0/stock_mts_mto_rule/

Avatar
Discard

No module is needed, just put inherit the _make_po_get_domain function and put the origin field in the domain.

soon it starts to create purchase orders linked to the sales order.

def _make_po_get_domain(self, partner):

gpo = self.rule_id.group_propagation_option

group = (gpo == 'fixed' and self.rule_id.group_id) or \

(gpo == 'propagate' and self.group_id) or False

# import ipdb; ipdb.set_trace()

domain = (

('partner_id', '=', partner.id),

('state', '=', 'draft'),

('origin', '=', self.origin),

('picking_type_id', '=', self.rule_id.picking_type_id.id),

('company_id', '=', self.company_id.id),

('dest_address_id', '=', self.partner_dest_id.id))

if group:

domain += (('group_id', '=', group.id),)

return domain

Related Posts Replies Views Activity
0
Nov 23
266
0
Jun 22
873
0
May 22
2340
4
Apr 19
9228
0
Jun 16
2338