make_to_order product policy not repsected in order import

Bug #601909 reported by Piotr Buszka
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Magento OpenERP Connector
Fix Released
Medium
Unassigned

Bug Description

When importing orders order lines are always created with make_to_stock policy independently of the setting in the product.

I modified some code in sale.py so that it retrieves the correct information.

I am new to openerp and don't know well neither python nor coding standards in openerp so leave it to you to introduce into the branch if you think it's OK.

sale.py line in def get_order_lines

                    if line_tax_vat > 0:
                        line_tax_ids = self.pool.get('account.tax').search(cr, uid, [('type_tax_use', '=', 'sale'), ('amount', '>='$
                        if line_tax_ids and len(line_tax_ids) > 0:
                            defaults_line['tax_id'] = [(6, 0, [line_tax_ids[0]])]
# PB begin
                    line_to_add = self.oevals_from_extdata(cr, uid, external_referential_id, line_data, 'item_id', mapping_lines, defaults_line, context)
                    if line_to_add['product_id']:
                         ol_product = self.pool.get('product.product').read(cr, uid, line_to_add['product_id'])
                         line_to_add['type'] = ol_product['procure_method']
                    lines_vals.append((0, 0, line_to_add))
#PB end
                res['order_line'] = lines_vals
        return res

Related branches

Revision history for this message
Kyle Waid (midwest) wrote :

Raphael can you confirm this?

Changed in magentoerpconnect:
importance: Undecided → Medium
Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

Piotr,

thanks for reporting, I applied a similar patch (I actually found the solution to a duplicate bug by Kyle Waid before remembering this bug and reading your patch, it does happen).
Anyway should be fixed. One could always find a better system where MTO/MTS could be overriden by some custom mapping from Magento order lines, but at the moment it just takes the setting of the product which should be good enough for most use cases.

Changed in magentoerpconnect:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.