<commit_before># -*- encoding: utf-8 -*-
#########################################################################
#                                                                       #
#########################################################################
#                                                                       #
# Copyright (C) 2010 <NAME>                                     #
#                                                                       #
#This program is free software: you can redistribute it and/or modify   #
#it under the terms of the GNU General Public License as published by   #
#the Free Software Foundation, either version 3 of the License, or      #
#(at your option) any later version.                                    #
#                                                                       #
#This program is distributed in the hope that it will be useful,        #
#but WITHOUT ANY WARRANTY; without even the implied warranty of         #
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          #
#GNU General Public License for more details.                           #
#                                                                       #
#You should have received a copy of the GNU General Public License      #
#along with this program.  If not, see <http://www.gnu.org/licenses/>.  #
#########################################################################

import xmlrpclib
import netsvc

from osv import fields,osv
from tools.translate import _
from openerp.addons.base_sale_multichannels.sale import \
    ExternalShippingCreateError


class stock_picking(osv.osv):

    _inherit = "stock.picking"

    def create_ext_complete_shipping(self, cr, uid, id, external_referential_id, magento_incrementid, mail_notification=True, context=None):
        if context is None: context = {}
        conn = context.get('conn_obj', False)
        ext_shipping_id = conn.call('sales_order_shipment.create', [magento_incrementid, {}, _("Shipping Created"), mail_notification, True])
        return ext_shipping_id
    
    def add_picking_line(self, cr, uid, lines, picking_line, context=None):
        """ A line to add in the shipping is a dict with : product_id and product_qty keys."""
        line_info = {'product_id': picking_line.product_id.id,
                     'product_qty': picking_line.product_qty,
        }
        lines.append(line_info)
        return lines        

    def create_ext_partial_shipping(self, cr, uid, id, external_referential_id, magento_incrementid, mail_notification=True, context=None):
        if context is None: context = {}
        conn = context.get('conn_obj', False)
        ext_shipping_id = False
        order_items = conn.call('sales_order.info', [magento_incrementid])['items']
        product_2_item = {}
        for item in order_items:
            product_2_item.update({self.pool.get('product.product').extid_to_oeid(cr, uid, item['product_id'], external_referential_id, context={}): item['item_id']})
        picking = self.pool.get('stock.picking').browse(cr, uid, id, context)
        item_qty = {}<commit_msg>[FIX] fix shipping export<commit_after># -*- encoding: utf-8 -*-
#########################################################################
#                                                                       #
#########################################################################
#                                                                       #
# Copyright (C) 2010 <NAME>                                     #
#                                                                       #
#This program is free software: you can redistribute it and/or modify   #
#it under the terms of the GNU General Public License as published by   #
#the Free Software Foundation, either version 3 of the License, or      #
#(at your option) any later version.                                    #
#                                                                       #
#This program is distributed in the hope that it will be useful,        #
#but WITHOUT ANY WARRANTY; without even the implied warranty of         #
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          #
#GNU General Public License for more details.                           #
#                                                                       #
#You should have received a copy of the GNU General Public License      #
#along with this program.  If not, see <http://www.gnu.org/licenses/>.  #
#########################################################################

import xmlrpclib
import netsvc

from osv import fields,osv
from tools.translate import _
from openerp.addons.base_sale_multichannels.sale import \
    ExternalShippingCreateError


class stock_picking(osv.osv):

    _inherit = "stock.picking"

    def create_ext_complete_shipping(self, cr, uid, id, external_referential_id, magento_incrementid, mail_notification=True, context=None):
        if context is None: context = {}
        conn = context.get('conn_obj', False)
        ext_shipping_id = conn.call('sales_order_shipment.create', [magento_incrementid, {}, _("Shipping Created"), mail_notification, True])
        return ext_shipping_id
    
    def add_picking_line(self, cr, uid, lines, picking_line, context=None):
        """ A line to add in the shipping is a dict with : product_id and product_qty keys."""
        line_info = {'product_id': picking_line.product_id.id,
                     'product_qty': picking_line.product_qty,
        }
        lines.append(line_info)
        return lines        

    def create_ext_partial_shipping(self, cr, uid, id, external_referential_id, magento_incrementid, mail_notification=True, context=None):
        if context is None: context = {}
        conn = context.get('conn_obj', False)
        ext_shipping_id = False
        order_items = conn.call('sales_order.info', [magento_incrementid])['items']
        product_2_item = {}
        for item in order_items:
            product_2_item.update({self.pool.get('product.product').get_oeid(cr, uid, item['product_id'], external_referential_id, context={}): item['item_id']})
        picking = self.pool.get('stock.picking').browse(cr, uid, id, context)
        item_qty = {}
{'fraction_non_alphanumeric': 0.15015110545570223, 'fraction_numerical': 0.0025449339907746144, 'mean_word_length': 2.1097922848664687, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 34, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1750788', 'n_tokens_mistral': 1557, 'n_tokens_neox': 1503, 'n_words': 443}