Merge lp:~camptocamp/magentoerpconnect/oerp6.1-oldstable-fix-1131157 into lp:magentoerpconnect/oerp6.1-oldstable

Proposed by Alexandre Fayolle - camptocamp
Status: Needs review
Proposed branch: lp:~camptocamp/magentoerpconnect/oerp6.1-oldstable-fix-1131157
Merge into: lp:magentoerpconnect/oerp6.1-oldstable
Diff against target: 25 lines (+11/-0)
1 file modified
magentoerpconnect/stock.py (+11/-0)
To merge this branch: bzr merge lp:~camptocamp/magentoerpconnect/oerp6.1-oldstable-fix-1131157
Reviewer Review Type Date Requested Status
MagentoERPConnect core editors Pending
Review via email: mp+149802@code.launchpad.net

Description of the change

[FIX] flag pickings of SO without magento id as not exportable

To post a comment you must log in.

Unmerged revisions

671. By Alexandre Fayolle - camptocamp

[FIX] flag pickings of SO without magento id as not exportable

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'magentoerpconnect/stock.py'
--- magentoerpconnect/stock.py 2012-06-27 15:44:07 +0000
+++ magentoerpconnect/stock.py 2013-02-21 11:28:26 +0000
@@ -76,10 +76,21 @@
76 """76 """
77 Create the shipping on Magento. It can be a partial or a complete shipment.77 Create the shipping on Magento. It can be a partial or a complete shipment.
7878
79 This method raises ExternalShippingCreateError in case there
80 it cannot create the shipping, so that the picking will be
81 flagged as 'do_not_export' and not be considered for export
82 again
83
79 :param str picking_type: 'partial' or 'complete'84 :param str picking_type: 'partial' or 'complete'
80 :return: the picking id on magento85 :return: the picking id on magento
81 """86 """
82 sale = self.browse(cr, uid, id, context=context).sale_id87 sale = self.browse(cr, uid, id, context=context).sale_id
88 if not sale.magento_incrementid:
89 # the sale order was probably manually created on OpenERP
90 # and is not linked to a Magento sale order. Raise
91 # ExternalShippingCreateError to flag the picking as not
92 # exportable
93 raise ExternalShippingCreateError('The sale order %s has no magento_incrementid' % sale.name)
83 magento_incrementid = sale.magento_incrementid94 magento_incrementid = sale.magento_incrementid
84 carrier_id = self.read(cr, uid, id, ['carrier_id'], context)['carrier_id']95 carrier_id = self.read(cr, uid, id, ['carrier_id'], context)['carrier_id']
85 if carrier_id:96 if carrier_id: