Order placed from Bahmni syncs with ODOO if Order Type-Shop mapping does not have specific location mapping.
But the sync fails moment Location is specified in Order Type-Shop mapping.
Order placed from Bahmni syncs with ODOO if Order Type-Shop mapping does not have specific location mapping.
But the sync fails moment Location is specified in Order Type-Shop mapping.
Modified _get_shop_and_local_shop_id function in /opt/bahmni-erp/bahmni-addons/bahmni_atom_feed/models/order_save_service.py as follows to resolve this issue. @ajeenckya.
@api.model
def _get_shop_and_local_shop_id(self, orderType, location_name):
_logger.info("\n\n _get_shop_and_local_shop_id().... Called.....")
_logger.info("orderType %s",orderType)
_logger.info("location_name %s",location_name)
OrderTypeShopMap = self.env['order.type.shop.map']
SaleShop = self.env['sale.shop']
if (location_name):
shop_list_with_orderType = OrderTypeShopMap.search([('order_type', '=', orderType), ('location_name', '=', location_name)])
_logger.info("shop_list_with_orderType %s",shop_list_with_orderType)
#_logger.info("shop_list_with_orderType %s",shop_list_with_orderType[0])
#_logger.info("Len of shop_list_with_orderType %s", len(shop_list_with_orderType))
if not shop_list_with_orderType:
shop_list_with_orderType = OrderTypeShopMap.search([('order_type', '=', orderType), ('location_name', '=', None)])
if not shop_list_with_orderType:
return (False, False)
else:
_logger.info("In First ELSE.....shop_list_with_orderType %s", shop_list_with_orderType)
order_type_map_object = shop_list_with_orderType[0]
if order_type_map_object.shop_id:
shop_id = order_type_map_object.shop_id.id
else:
shop_records = SaleShop.search(cr, uid, [], context=context)
first_shop = shop_records[0]
shop_id = first_shop.id
if order_type_map_object.local_shop_id:
local_shop_id = order_type_map_object.local_shop_id.id
else:
local_shop_id = False
return (shop_id, local_shop_id)
@ramashish can you please create a card for this and raise a PR?
Yes we will do the needful. Could you please confirm that this is the link https://github.com/Bahmni/odoo-modules for our current odoo implementation?
Yes. thats the one.
Here is the patch to fix this.
Can you create a PR against https://github.com/Bahmni/odoo-modules