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

Proposed by Alexandre Fayolle - camptocamp on 2013-02-21
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 2013-02-21 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 on 2013-02-21

[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
1=== modified file 'magentoerpconnect/stock.py'
2--- magentoerpconnect/stock.py 2012-06-27 15:44:07 +0000
3+++ magentoerpconnect/stock.py 2013-02-21 11:28:26 +0000
4@@ -76,10 +76,21 @@
5 """
6 Create the shipping on Magento. It can be a partial or a complete shipment.
7
8+ This method raises ExternalShippingCreateError in case there
9+ it cannot create the shipping, so that the picking will be
10+ flagged as 'do_not_export' and not be considered for export
11+ again
12+
13 :param str picking_type: 'partial' or 'complete'
14 :return: the picking id on magento
15 """
16 sale = self.browse(cr, uid, id, context=context).sale_id
17+ if not sale.magento_incrementid:
18+ # the sale order was probably manually created on OpenERP
19+ # and is not linked to a Magento sale order. Raise
20+ # ExternalShippingCreateError to flag the picking as not
21+ # exportable
22+ raise ExternalShippingCreateError('The sale order %s has no magento_incrementid' % sale.name)
23 magento_incrementid = sale.magento_incrementid
24 carrier_id = self.read(cr, uid, id, ['carrier_id'], context)['carrier_id']
25 if carrier_id: