| Line 73... |
Line 73... |
| 73 |
|
73 |
|
| 74 |
if item is None:
|
74 |
if item is None:
|
| 75 |
#print "[ADDING:]{0} {1} {2} {3} to our catalogue.".format(product_group, brand, model_number, color)
|
75 |
#print "[ADDING:]{0} {1} {2} {3} to our catalogue.".format(product_group, brand, model_number, color)
|
| 76 |
new_items.append(rownum)
|
76 |
new_items.append(rownum)
|
| 77 |
item = Item()
|
77 |
item = Item()
|
| - |
|
78 |
item.product_group = product_group
|
| - |
|
79 |
item.brand = our_brand
|
| - |
|
80 |
item.model_number = our_model_number
|
| - |
|
81 |
item.model_name = model_name
|
| 78 |
item.status = status.IN_PROCESS
|
82 |
item.status = status.IN_PROCESS
|
| 79 |
item.status_description = "This item is in process"
|
83 |
item.status_description = "This item is in process"
|
| 80 |
item.addedOn = updatedOn
|
84 |
item.addedOn = updatedOn
|
| 81 |
item.hotspotCategory = category
|
85 |
item.hotspotCategory = category
|
| 82 |
|
86 |
|
| Line 107... |
Line 111... |
| 107 |
# If there is no similar item in the database from before,
|
111 |
# If there is no similar item in the database from before,
|
| 108 |
# use the entity_id_generator
|
112 |
# use the entity_id_generator
|
| 109 |
entity_id = EntityIDGenerator.query.first()
|
113 |
entity_id = EntityIDGenerator.query.first()
|
| 110 |
item.catalog_item_id = entity_id.id + 1
|
114 |
item.catalog_item_id = entity_id.id + 1
|
| 111 |
entity_id.id = entity_id.id + 1
|
115 |
entity_id.id = entity_id.id + 1
|
| - |
|
116 |
|
| - |
|
117 |
|
| 112 |
else:
|
118 |
else:
|
| 113 |
#If a similar item already exists for a product group, brand and model_number, set it as same.
|
119 |
#If a similar item already exists for a product group, brand and model_number, set it as same.
|
| 114 |
item.catalog_item_id = similar_item.catalog_item_id
|
120 |
item.catalog_item_id = similar_item.catalog_item_id
|
| 115 |
item.category = similar_item.category
|
121 |
item.category = similar_item.category
|
| 116 |
item.status = similar_item.status
|
122 |
item.status = similar_item.status
|
| 117 |
item.status_description = similar_item.status_description
|
123 |
item.status_description = similar_item.status_description
|
| - |
|
124 |
#Use the same brand, model name and model number as in similar item in database
|
| - |
|
125 |
item.brand = similar_item.brand
|
| - |
|
126 |
item.model_name = similar_item.model_name
|
| - |
|
127 |
item.model_number = similar_item.model_number
|
| 118 |
else:
|
128 |
else:
|
| 119 |
# If this item already existed and one of its price parameters has changed
|
129 |
# If this item already existed and one of its price parameters has changed
|
| 120 |
# in which case we add it to the list of updated items for reporting.
|
130 |
# in which case we add it to the list of updated items for reporting.
|
| 121 |
if item.status == status.PHASED_OUT:
|
131 |
if item.status == status.PHASED_OUT:
|
| 122 |
item.status = status.IN_PROCESS #Not the ideal choice but we don't know whether content has been generated for it beforehand.
|
132 |
item.status = status.IN_PROCESS #Not the ideal choice but we don't know whether content has been generated for it beforehand.
|
| Line 126... |
Line 136... |
| 126 |
vendor_item_pricing = VendorItemPricing(vendor=vendor, item=item)
|
136 |
vendor_item_pricing = VendorItemPricing(vendor=vendor, item=item)
|
| 127 |
session.add(vendor_item_pricing)
|
137 |
session.add(vendor_item_pricing)
|
| 128 |
|
138 |
|
| 129 |
if item.mrp != mrp or vendor_item_pricing.dealerPrice != dp or vendor_item_pricing.transfer_price != xfer_price or item.sellingPrice != sp:
|
139 |
if item.mrp != mrp or vendor_item_pricing.dealerPrice != dp or vendor_item_pricing.transfer_price != xfer_price or item.sellingPrice != sp:
|
| 130 |
updated_items.append(sheet.row_values(rownum)[0:19] + [item.mrp, item.dealerPrice, item.transfer_price])
|
140 |
updated_items.append(sheet.row_values(rownum)[0:19] + [item.mrp, item.dealerPrice, item.transfer_price])
|
| 131 |
|
- |
|
| 132 |
item.product_group = product_group
|
- |
|
| 133 |
item.brand = our_brand
|
141 |
|
| 134 |
item.model_number = our_model_number
|
142 |
#In future we will provide the option to edit color in CMS
|
| 135 |
item.color = our_color
|
143 |
item.color = our_color
|
| 136 |
|
144 |
|
| 137 |
if category_id !=None and category_id != "":
|
145 |
if category_id !=None and category_id != "":
|
| 138 |
item.category = int(category_id)
|
146 |
item.category = int(category_id)
|
| 139 |
|
147 |
|
| Line 173... |
Line 181... |
| 173 |
elif item.startDate == None or item.startDate == '':
|
181 |
elif item.startDate == None or item.startDate == '':
|
| 174 |
#If start date is not specified and item's start date is not set, set it to current time
|
182 |
#If start date is not specified and item's start date is not set, set it to current time
|
| 175 |
item.startDate = datetime.datetime.now()
|
183 |
item.startDate = datetime.datetime.now()
|
| 176 |
|
184 |
|
| 177 |
item.sellingPrice = sp
|
185 |
item.sellingPrice = sp
|
| 178 |
item.model_name = model_name
|
- |
|
| 179 |
|
186 |
|
| 180 |
if weight != "":
|
187 |
if weight != "":
|
| 181 |
item.weight = weight
|
188 |
item.weight = weight
|
| 182 |
|
189 |
|
| 183 |
# item.bestDealText = deal_text
|
190 |
# item.bestDealText = deal_text
|