/** * @param \Magento\Sales\Api\Data\OrderInterface $mageOrder * @return int */ public function _extractWarehouseIdOdoo(\Magento\Sales\Api\Data\OrderInterface $mageOrder) { $storeId = $mageOrder->getStoreId(); $stockId = $this->_manStock->getStockIdByStoreId($storeId); $warehouse = $this->_repoWarehouse->getById($stockId); $result = $warehouse->getOdooRef(); return $result; }
/** @inheritdoc */ public function create($data) { /** @var $result AggWarehouse */ $result = null; $def = $this->_manTrans->begin(); try { $wrhsData = $this->_repoWrhsAggWarehouse->create($data); /* create odoo related entries */ $bind = [EntityWarehouse::ATTR_MAGE_REF => $wrhsData->getId(), EntityWarehouse::ATTR_ODOO_REF => $data->getOdooId()]; $this->_repoEntityWarehouse->create($bind); $this->_manTrans->commit($def); /* compose result from warehouse module's data and odoo module's data */ $result = $this->_manObj->create(AggWarehouse::class); $result->setData($wrhsData); $result->setOdooId($data->getOdooId()); } finally { $this->_manTrans->end($def); } return $result; }