def write(self, cr, uid, ids, vals, context=None): if context is None: context = {} if isinstance(ids, (int, long)): ids = [ids] if context.has_key('magento'): if vals.has_key('name'): vals['name'] = _unescape(vals['name']) if vals.has_key('description'): vals['description'] = _unescape(vals['description']) if vals.has_key('description_sale'): vals['description_sale'] = _unescape(vals['description_sale']) if vals.has_key('category_ids') and vals.get('category_ids'): categ_ids = list(set(vals.get('category_ids'))) vals['categ_id'] = max(categ_ids) categ_ids.remove(max(categ_ids)) vals['categ_ids'] = [(6, 0, categ_ids)] if vals.has_key('mage_id'): vals.pop('mage_id') map_obj = self.pool.get('magento.product.template') for temp_id in ids: temp_map_ids = map_obj.search(cr, uid, [('template_name', '=', temp_id)]) if temp_map_ids: if not context.has_key('magento'): map_obj.write(cr, uid, temp_map_ids[0], {'need_sync':'Yes'}, context) elif context.has_key('magento'): map_obj.write(cr, uid, temp_map_ids[0], {'need_sync':'No'}, context) return super(product_template, self).write(cr, uid, ids, vals, context)
def write(self, cr, uid, ids, vals, context=None): context = dict(context or {}) if isinstance(ids, (int, long)): ids = [ids] if context.has_key('magento'): if context.get('image'): vals['image'] = context.get('image') context.pop('image') if vals.has_key('name'): vals['name'] = _unescape(vals['name']) if vals.has_key('description'): vals['description'] = _unescape(vals['description']) if vals.has_key('description_sale'): vals['description_sale'] = _unescape(vals['description_sale']) if vals.has_key('category_ids') and vals.get('category_ids'): categ_ids = list(set(vals.get('category_ids'))) vals['categ_id'] = max(categ_ids) categ_ids.remove(max(categ_ids)) vals['categ_ids'] = [(6, 0, categ_ids)] if vals.has_key('mage_id'): vals.pop('mage_id') map_obj = self.pool.get('magento.product.template') for temp_id in ids: temp_map_ids = map_obj.search(cr, uid, [('template_name', '=', temp_id)]) if temp_map_ids: if not context.has_key('magento'): for temp_map_ids in temp_map_ids: map_obj.write(cr, uid, temp_map_ids, {'need_sync': 'Yes'}, context) elif context.has_key('magento'): map_obj.write(cr, uid, temp_map_ids[0], {'need_sync': 'No'}, context) return super(product_template, self).write(cr, uid, ids, vals, context)
def extra_order_line(self, cr, uid, data, context=None): """create sale order line by any webservice like xmlrpc. @param data: dictionary of Odoo Order ID and line information. @param context: A standard dictionary @return: line_id """ if context is None: context = {} line_dic = {} sale_order_line = self.pool.get('sale.order.line') product_id = 0 if context.has_key('instance_id') and data['name'].startswith('S'): route_id = self.pool.get('magento.configure').browse(cr, uid, context['instance_id']).route_id.id line_dic['route_id'] = int(route_id) if data.has_key('shipping_product_id'): product_id = data['shipping_product_id'] else: product_id = self._get_virtual_product_id(cr, uid, data) line_dic['product_id'] = product_id line_dic['order_id'] = data['order_id'] line_dic['name'] = _unescape(data['description']) line_dic['price_unit'] = data['price_unit'] line_dic['product_uom_qty'] = 1 line_dic['product_uom'] = self.pool.get('product.product').browse(cr, uid, product_id).uom_id.id or 1 if data.has_key('tax_id'): taxes = data.get('tax_id') if type(taxes) != list: taxes = [data.get('tax_id')] line_dic['tax_id'] = [(6,0,taxes)] else: line_dic['tax_id'] = False line_id = sale_order_line.create(cr, uid, line_dic, context) return line_id
def extra_order_line(self, cr, uid, data, context=None): """create sale order line by any webservice like xmlrpc. @param data: dictionary of Odoo Order ID and line information. @param context: A standard dictionary @return: line_id """ context = dict(context or {}) line_dic = {} sale_order_line = self.pool.get('sale.order.line') product_id = 0 if data.has_key('shipping_product_id'): product_id = data['shipping_product_id'] else: product_id = self._get_virtual_product_id(cr, uid, data) if context.has_key('instance_id') and data['name'].startswith('S'): route_id = self.pool.get('magento.configure').browse( cr, uid, context['instance_id']).route_id.id line_dic['route_id'] = int(route_id) product_obj = self.pool.get('product.product').browse( cr, uid, product_id) name = product_obj.name consignee_id = 0 carrier_obj = self.pool.get('sale.order').browse( cr, uid, data['order_id']).carrier_id if carrier_obj: if carrier_obj.name == "Transporte gratis": supplier = self.pool.get('res.partner').search( cr, uid, [('name', '=', 'Transporte Go Web')]) if supplier: consignee_id = supplier[0] if not consignee_id: seller_ids = product_obj.seller_ids for seller_id in seller_ids: consignee_id = seller_id.name.id break self.pool.get('sale.order').write(cr, uid, data['order_id'], {'consignee_id': consignee_id}) line_dic['product_id'] = product_id line_dic['order_id'] = data['order_id'] line_dic['name'] = _unescape(data['description']) line_dic['price_unit'] = data['price_unit'] line_dic['product_uom_qty'] = 1 line_dic['product_uom'] = self.pool.get('product.product').browse( cr, uid, product_id).uom_id.id or 1 if data.has_key('tax_id'): taxes = data.get('tax_id') if type(taxes) != list: taxes = [data.get('tax_id')] line_dic['tax_id'] = [(6, 0, taxes)] else: line_dic['tax_id'] = False line_id = sale_order_line.create(cr, uid, line_dic, context) return line_id
def create(self, cr, uid, vals, context=None): if context is None: context = {} if context.has_key('magento'): vals['name'] = _unescape(vals['name']) vals['partner_id'] = self.pool.get('res.users').browse(cr, uid, uid).company_id.partner_id.id vals['product_id'] = self.pool.get('bridge.backbone')._get_virtual_product_id(cr,uid,{'name':'Shipping'}) return super(delivery_carrier, self).create(cr, uid, vals, context=context)
def create(self, cr, uid, vals, context=None): if context is None: context = {} mage_id = 0 attr_val_ids = [] if context.has_key('magento'): if vals.has_key('default_code'): vals['default_code'] = _unescape(vals['default_code']) if vals.has_key('category_ids') and vals.get('category_ids'): categ_ids = list(set(vals.get('category_ids'))) categ_id = self.get_product_internal_category(cr, uid, categ_ids) vals['categ_id'] = categ_id categ_ids.remove(categ_id) vals['categ_ids'] = [(6, 0, categ_ids)] vals.pop('category_ids') if vals.has_key('value_ids'): attr_val_ids = vals.get('value_ids') vals['attribute_value_ids'] = [(6,0,attr_val_ids)] if vals.has_key('mage_id'): mage_id = vals.get('mage_id') vals.pop('mage_id') product_id = super(product_product, self).create(cr, uid, vals, context=context) if context.has_key('magento'): mapping_pool = self.pool.get('magento.product') mage_temp_pool = self.pool.get('magento.product.template') attribute_val_pool = self.pool.get('product.attribute.value') attribute_line_pool = self.pool.get('product.attribute.line') template_id = self.browse(cr, uid, product_id).product_tmpl_id.id if template_id: if attr_val_ids: for attr_val_id in attr_val_ids: attr_id = attribute_val_pool.browse(cr, uid, attr_val_id).attribute_id.id search_ids = attribute_line_pool.search(cr, uid, [('product_tmpl_id','=',template_id),('attribute_id','=',attr_id)]) if search_ids: attribute_line_pool.write(cr, uid, search_ids,{'value_ids':[(4,attr_val_id)]}, context) if mage_id: search_ids = mage_temp_pool.search(cr, uid, [('erp_template_id','=', template_id)]) if not search_ids: price = 0 if vals.has_key('list_price'): price = vals['list_price'] mage_temp_pool.create(cr, uid, { 'template_name':template_id, 'erp_template_id':template_id, 'mage_product_id':mage_id, 'base_price':price, 'instance_id':context.get('instance_id'), 'created_by':'Magento' }) else: mage_temp_pool.write(cr, uid,search_ids[0], {'need_sync':'No'}, context) mapping_pool.create(cr, uid, {'pro_name':product_id,'oe_product_id':product_id,'mag_product_id':mage_id,'instance_id':context.get('instance_id'),'created_by':'Magento'}) return product_id
def write(self, cr, uid, ids, vals, context=None): context = dict(context or {}) if isinstance(ids, (int, long)): ids = [ids] if context.has_key('magento'): if vals.has_key('default_code'): vals['default_code'] = _unescape(vals['default_code']) if vals.has_key('category_ids') and vals.get('category_ids'): categ_ids = list(set(vals.get('category_ids'))) categ_id = self.get_product_internal_category( cr, uid, categ_ids) vals['categ_id'] = categ_id categ_ids.remove(categ_id) vals['categ_ids'] = [(6, 0, categ_ids)] vals.pop('category_ids') if vals.has_key('mage_id'): vals.pop('mage_id') product_map_pool = self.pool.get('magento.product') template_map_pool = self.pool.get('magento.product.template') for pro_id in ids: map_ids = [] if context.has_key('instance_id'): map_ids = product_map_pool.search( cr, uid, [('pro_name', '=', pro_id), ('instance_id', '=', context['instance_id'])]) else: map_ids = product_map_pool.search(cr, uid, [('pro_name', '=', pro_id)]) if map_ids: if not context.has_key('magento'): _logger.info("Updating Product %r Need Sync......", pro_id) product_map_pool.write(cr, uid, map_ids[0], {'need_sync': 'Yes'}, context) elif context.has_key('magento'): ress = product_map_pool.write(cr, uid, map_ids[0], {'need_sync': 'No'}, context) template_id = self.browse(cr, uid, pro_id).product_tmpl_id.id temp_map_ids = template_map_pool.search( cr, uid, [('template_name', '=', template_id)]) for temp_map_id in temp_map_ids: if not context.has_key('magento'): template_map_pool.write(cr, uid, temp_map_id, {'need_sync': 'Yes'}, context) elif context.has_key('magento'): template_map_pool.write(cr, uid, temp_map_id, {'need_sync': 'No'}, context) return super(product_product, self).write(cr, uid, ids, vals, context=context)
def create(self, cr, uid, vals, context=None): context = dict(context or {}) if context.has_key('magento'): vals['name'] = _unescape(vals['name']) vals['partner_id'] = self.pool.get('res.users').browse( cr, uid, uid).company_id.partner_id.id vals['product_id'] = self.pool.get( 'bridge.backbone')._get_virtual_product_id( cr, uid, {'name': 'Shipping'}) return super(delivery_carrier, self).create(cr, uid, vals, context=context)
def customer_array(self, cr, uid, data, context=None): context = dict(context or {}) dic = {} if data.has_key('country_code'): country_ids = self.pool.get('res.country').search( cr, uid, [('code', '=', data.get('country_code'))]) data.pop('country_code') if country_ids: data['country_id'] = country_ids[0] if data.has_key('region') and data['region']: region = _unescape(data.get('region')) state_ids = self.pool.get('res.country.state').search( cr, uid, [('name', '=', region)]) if state_ids: data['state_id'] = state_ids[0] else: dic['name'] = region dic['country_id'] = country_ids[0] dic['code'] = region[:2].upper() state_id = self.pool.get('res.country.state').create( cr, uid, dic) data['state_id'] = state_id data.pop('region') if data.has_key('tag') and data["tag"]: tag = _unescape(data.get('tag')) tag_ids = self.pool.get('res.partner.category').search( cr, uid, [('name', '=', tag)], limit=1) if not tag_ids: tag_id = self.pool.get('res.partner.category').create( cr, uid, {'name': tag}) else: tag_id = tag_ids[0] data['category_id'] = [(6, 0, [tag_id])] data.pop('tag') if data.has_key('wk_company'): data['wk_company'] = _unescape(data['wk_company']) if data.has_key('name') and data['name']: data['name'] = _unescape(data['name']) if data.has_key('email') and data['email']: data['email'] = _unescape(data['email']) if data.has_key('street') and data['street']: data['street'] = _unescape(data['street']) if data.has_key('street2') and data['street2']: data['street2'] = _unescape(data['street2']) if data.has_key('city') and data['city']: data['city'] = _unescape(data['city']) return data
def create(self, cr, uid, vals, context=None): context = dict(context or {}) mage_id = 0 if context.has_key('magento'): if vals.has_key('name'): vals['name'] = _unescape(vals['name']) if vals.has_key('description'): vals['description'] = _unescape(vals['description']) if vals.has_key('description_sale'): vals['description_sale'] = _unescape(vals['description_sale']) if vals.has_key('category_ids') and vals.get('category_ids'): categ_ids = list(set(vals.get('category_ids'))) vals['categ_id'] = max(categ_ids) categ_ids.remove(max(categ_ids)) vals['categ_ids'] = [(6, 0, categ_ids)] vals.pop('category_ids') if vals.has_key('mage_id'): mage_id = vals.get('mage_id') vals.pop('mage_id') template_id = super(product_template, self).create(cr, uid, vals, context=context) if context.has_key('magento') and context.has_key('configurable'): mapping_pool = self.pool.get('magento.product.template') mapping_data = { 'template_name': template_id, 'erp_template_id': template_id, 'mage_product_id': mage_id, 'base_price': vals['list_price'], 'is_variants': True, 'instance_id': context.get('instance_id'), 'created_by': 'Magento' } mapping_pool.create(cr, uid, mapping_data) self._inactive_default_variant(cr, uid, template_id, context) return template_id
def create(self, cr, uid, vals, context=None): if context is None: context = {} mage_id = 0 if context.has_key('magento'): if vals.has_key('name'): vals['name'] = _unescape(vals['name']) if vals.has_key('description'): vals['description'] = _unescape(vals['description']) if vals.has_key('description_sale'): vals['description_sale'] = _unescape(vals['description_sale']) if vals.has_key('category_ids') and vals.get('category_ids'): categ_ids = list(set(vals.get('category_ids'))) vals['categ_id'] = max(categ_ids) categ_ids.remove(max(categ_ids)) vals['categ_ids'] = [(6, 0, categ_ids)] vals.pop('category_ids') if vals.has_key('mage_id'): mage_id = vals.get('mage_id') vals.pop('mage_id') #_logger.info("Template Attribute: %r", vals) template_id = super(product_template, self).create(cr, uid, vals, context=context) if context.has_key('magento') and context.has_key('configurable'): mapping_pool = self.pool.get('magento.product.template') mapping_data = { 'template_name':template_id, 'erp_template_id':template_id, 'mage_product_id':mage_id, 'base_price':vals['list_price'], 'is_variants':True, 'instance_id':context.get('instance_id'), 'created_by':'Magento' } mapping_pool.create(cr, uid, mapping_data) self._inactive_default_variant(cr, uid, template_id, context) return template_id
def write(self, cr, uid, ids, vals, context=None): if context is None: context = {} if isinstance(ids, (int, long)): ids = [ids] if context.has_key('magento'): if vals.has_key('name'): vals['name'] = _unescape(vals['name']) if not context.has_key('magento'): category_map_pool = self.pool.get('magento.category') for id in ids: map_ids = category_map_pool.search(cr, uid, [('oe_category_id', '=', id)]) if map_ids: category_map_pool.write(cr, uid, map_ids[0], {'need_sync':'Yes'}, context) return super(product_category,self).write(cr, uid, ids, vals, context=context)
def customer_array(self, cr, uid, data, context=None): dic = {} if data.has_key('country_code'): country_ids = self.pool.get('res.country').search(cr, uid,[('code','=',data.get('country_code'))]) data.pop('country_code') if country_ids: data['country_id'] = country_ids[0] if data.has_key('region') and data['region']: region = _unescape(data.get('region')) state_ids = self.pool.get('res.country.state').search(cr, uid,[('name', '=', region)]) if state_ids: data['state_id'] = state_ids[0] else: dic['name'] = region dic['country_id'] = country_ids[0] dic['code'] = region[:2].upper() state_id = self.pool.get('res.country.state').create(cr, uid,dic) data['state_id'] = state_id data.pop('region') if data.has_key('tag') and data["tag"]: tag = _unescape(data.get('tag')) tag_ids = self.pool.get('res.partner.category').search(cr,uid,[('name','=',tag)], limit=1) if not tag_ids: tag_id = self.pool.get('res.partner.category').create(cr,uid,{'name':tag}) else: tag_id = tag_ids[0] data['category_id'] = [(6,0,[tag_id])] data.pop('tag') if data.has_key('wk_company'): data['wk_company'] = _unescape(data['wk_company']) if data.has_key('name') and data['name']: data['name'] = _unescape(data['name']) if data.has_key('email') and data['email']: data['email'] = _unescape(data['email']) if data.has_key('street') and data['street']: data['street'] = _unescape(data['street']) if data.has_key('street2') and data['street2']: data['street2'] = _unescape(data['street2']) if data.has_key('city') and data['city']: data['city'] = _unescape(data['city']) return data # END
def create_order_line(self, cr, uid, data, context=None): """create sale order line by any webservice like xmlrpc. @param data: dictionary of Odoo Order ID and line information. @param context: A standard dictionary @return: line_id """ context = dict(context or {}) line_dic = {} product = self.pool.get('product.product') sale_order_line = self.pool.get('sale.order.line') if context.has_key('instance_id'): route_id = self.pool.get('magento.configure').browse( cr, uid, context['instance_id']).route_id.id line_dic['route_id'] = int(route_id) if data.has_key('product_id'): line_dic['product_id'] = data.get('product_id') # for route_id in product.browse(cr, uid, data.get('product_id')).route_ids: # line_dic['route_id'] = int(route_id) # break purchase_price = product.browse( cr, uid, data.get('product_id')).standard_price if purchase_price: line_dic['purchase_price'] = purchase_price if data.has_key('name') and data['name']: line_dic['name'] = _unescape(data.get('name')) if data.has_key('product_uom_qty'): line_dic['product_uom_qty'] = data.get('product_uom_qty') line_dic['product_uom'] = 1 if data.has_key('price_unit'): line_dic['price_unit'] = data.get('price_unit') if data.has_key('discount'): line_dic['discount'] = data.get('discount') if data.has_key('order_id'): line_dic['order_id'] = data.get('order_id') if data.has_key('tax_id'): taxes = data.get('tax_id') if type(taxes) != list: taxes = [data.get('tax_id')] line_dic['tax_id'] = [(6, 0, taxes)] else: line_dic['tax_id'] = False line_id = sale_order_line.create(cr, uid, line_dic, context) return line_id
def create_order_line(self, cr, uid, data, context=None): """create sale order line by any webservice like xmlrpc. @param data: dictionary of Odoo Order ID and line information. @param context: A standard dictionary @return: line_id """ if context is None: context = {} line_dic = {} product = self.pool.get('product.product') sale_order_line = self.pool.get('sale.order.line') if context.has_key('instance_id'): route_id = self.pool.get('magento.configure').browse(cr, uid, context['instance_id']).route_id.id line_dic['route_id'] = int(route_id) if data.has_key('product_id'): line_dic['product_id'] = data.get('product_id') # for route_id in product.browse(cr, uid, data.get('product_id')).route_ids: # line_dic['route_id'] = int(route_id) # break purchase_price = product.browse(cr, uid, data.get('product_id')).standard_price if purchase_price: line_dic['purchase_price'] = purchase_price if data.has_key('name') and data['name']: line_dic['name'] = _unescape(data.get('name')) if data.has_key('product_uom_qty'): line_dic['product_uom_qty'] = data.get('product_uom_qty') line_dic['product_uom'] = 1 if data.has_key('price_unit'): line_dic['price_unit'] = data.get('price_unit') if data.has_key('discount'): line_dic['discount'] = data.get('discount') if data.has_key('order_id'): line_dic['order_id'] = data.get('order_id') if data.has_key('tax_id'): taxes = data.get('tax_id') if type(taxes) != list: taxes = [data.get('tax_id')] line_dic['tax_id'] = [(6,0,taxes)] else: line_dic['tax_id'] = False line_id = sale_order_line.create(cr, uid, line_dic, context) return line_id
def write(self, cr, uid, ids, vals, context=None): context = dict(context or {}) if isinstance(ids, (int, long)): ids = [ids] if context.has_key('magento'): if vals.has_key('name'): vals['name'] = _unescape(vals['name']) if not context.has_key('magento'): category_map_pool = self.pool.get('magento.category') for id in ids: map_ids = category_map_pool.search( cr, uid, [('oe_category_id', '=', id)]) if map_ids: category_map_pool.write(cr, uid, map_ids[0], {'need_sync': 'Yes'}, context) return super(product_category, self).write(cr, uid, ids, vals, context=context)
def write(self, cr, uid, ids, vals, context=None): if context is None: context = {} if isinstance(ids, (int, long)): ids = [ids] if context.has_key('magento'): if vals.has_key('default_code'): vals['default_code'] = _unescape(vals['default_code']) if vals.has_key('category_ids') and vals.get('category_ids'): categ_ids = list(set(vals.get('category_ids'))) categ_id = self.get_product_internal_category(cr, uid, categ_ids) vals['categ_id'] = categ_id categ_ids.remove(categ_id) vals['categ_ids'] = [(6, 0, categ_ids)] vals.pop('category_ids') if vals.has_key('mage_id'): vals.pop('mage_id') product_map_pool = self.pool.get('magento.product') template_map_pool = self.pool.get('magento.product.template') for pro_id in ids: map_ids = [] if context.has_key('instance_id'): map_ids = product_map_pool.search(cr, uid, [('pro_name', '=', pro_id),('instance_id', '=', context['instance_id'])]) else: map_ids = product_map_pool.search(cr, uid, [('pro_name', '=', pro_id)]) if map_ids: if not context.has_key('magento'): product_map_pool.write(cr, uid, map_ids[0], {'need_sync':'Yes'}, context) elif context.has_key('magento'): ress = product_map_pool.write(cr, uid, map_ids[0], {'need_sync':'No'}, context) template_id = self.browse(cr, uid, pro_id).product_tmpl_id.id temp_map_ids = template_map_pool.search(cr, uid, [('template_name', '=', template_id)]) if temp_map_ids: if not context.has_key('magento'): template_map_pool.write(cr, uid, temp_map_ids[0], {'need_sync':'Yes'}, context) elif context.has_key('magento'): template_map_pool.write(cr, uid, temp_map_ids[0], {'need_sync':'No'}, context) return super(product_product,self).write(cr, uid, ids, vals, context=context)
def create(self, cr, uid, vals, context=None): context = dict(context or {}) mage_id = 0 attr_val_ids = [] if context.has_key('magento'): if vals.has_key('default_code'): vals['default_code'] = _unescape(vals['default_code']) if vals.has_key('category_ids') and vals.get('category_ids'): categ_ids = list(set(vals.get('category_ids'))) categ_id = self.get_product_internal_category( cr, uid, categ_ids) vals['categ_id'] = categ_id categ_ids.remove(categ_id) vals['categ_ids'] = [(6, 0, categ_ids)] vals.pop('category_ids') if vals.has_key('value_ids'): attr_val_ids = vals.get('value_ids') vals['attribute_value_ids'] = [(6, 0, attr_val_ids)] if vals.has_key('mage_id'): mage_id = vals.get('mage_id') vals.pop('mage_id') product_id = super(product_product, self).create(cr, uid, vals, context=context) if context.has_key('magento'): mapping_pool = self.pool.get('magento.product') mage_temp_pool = self.pool.get('magento.product.template') attribute_val_pool = self.pool.get('product.attribute.value') attribute_line_pool = self.pool.get('product.attribute.line') template_id = self.browse(cr, uid, product_id).product_tmpl_id.id if template_id: if attr_val_ids: for attr_val_id in attr_val_ids: attr_id = attribute_val_pool.browse( cr, uid, attr_val_id).attribute_id.id search_ids = attribute_line_pool.search( cr, uid, [('product_tmpl_id', '=', template_id), ('attribute_id', '=', attr_id)]) if search_ids: attribute_line_pool.write( cr, uid, search_ids, {'value_ids': [(4, attr_val_id)]}, context) if mage_id: search_ids = mage_temp_pool.search( cr, uid, [('erp_template_id', '=', template_id)]) if not search_ids: price = 0 if vals.has_key('list_price'): price = vals['list_price'] mage_temp_pool.create( cr, uid, { 'template_name': template_id, 'erp_template_id': template_id, 'mage_product_id': mage_id, 'base_price': price, 'instance_id': context.get('instance_id'), 'created_by': 'Magento' }) else: mage_temp_pool.write(cr, uid, search_ids[0], {'need_sync': 'No'}, context) mapping_pool.create( cr, uid, { 'pro_name': product_id, 'oe_product_id': product_id, 'mag_product_id': mage_id, 'instance_id': context.get('instance_id'), 'created_by': 'Magento' }) return product_id