예제 #1
0
 def export_quantity_url(self, url, key, filters, quantity):
     api = PrestaShopWebServiceDict(url, key)
     response = api.search(self._prestashop_model, filters)
     for stock_id in response:
         res = api.get(self._prestashop_model, stock_id)
         first_key = res.keys()[0]
         stock = res[first_key]
         stock['quantity'] = int(quantity)
         try:
             api.edit(self._prestashop_model,
                      {self._export_node_name: stock})
         except ElementTree.ParseError:
             pass
예제 #2
0
    def search(self, filters=None):
        result = super(SaleOrderAdapter, self).search(filters=filters)

        shop_ids = self.session.search(
            'prestashop.shop', [('backend_id', '=', self.backend_record.id)])
        shops = self.session.browse('prestashop.shop', shop_ids)
        for shop in shops:
            if not shop.default_url:
                continue

            api = PrestaShopWebServiceDict('%s/api' % shop.default_url,
                                           self.prestashop.webservice_key)
            result += api.search(self._prestashop_model, filters)
        return result
예제 #3
0
 def export_quantity_url(self, url, key, filters, quantity):
     api = PrestaShopWebServiceDict(url, key)
     response = api.search(self._prestashop_model, filters)
     for stock_id in response:
         res = api.get(self._prestashop_model, stock_id)
         first_key = res.keys()[0]
         stock = res[first_key]
         stock['quantity'] = int(quantity)
         try:
             api.edit(self._prestashop_model, {
                 self._export_node_name: stock
             })
         except ElementTree.ParseError:
             pass
예제 #4
0
    def search(self, filters=None):
        result = super(SaleOrderAdapter, self).search(filters=filters)

        shop_ids = self.session.search('prestashop.shop', [
            ('backend_id', '=', self.backend_record.id)
        ])
        shops = self.session.browse('prestashop.shop', shop_ids)
        for shop in shops:
            if not shop.default_url:
                continue

            api = PrestaShopWebServiceDict(
                '%s/api' % shop.default_url, self.prestashop.webservice_key
            )
            result += api.search(self._prestashop_model, filters)
        return result