Browse Source

añadido el manejador para modulo de productos

robert2206 8 years ago
parent
commit
4111c162b4
5 changed files with 20 additions and 3 deletions
  1. 2 2
      controllers/http_handler.py
  2. BIN
      controllers/http_handler.pyc
  3. 8 1
      controllers/resources.json
  4. 10 0
      models/models.py
  5. BIN
      models/models.pyc

+ 2 - 2
controllers/http_handler.py

@@ -119,8 +119,8 @@ class ApiManager(http.Controller):
     # Restify your request
     # --------------------------------------------------------------------------
     @http.route([
-                    '/api/<any(customers, leads, opportunities):resource>',
-                    '/api/<any(customers, leads, opportunities):resource>/<int:uid>'
+                    '/api/<any(customers, leads, opportunities, products):resource>',
+                    '/api/<any(customers, leads, opportunities, products):resource>/<int:uid>'
                 ],
                 type = 'http',
                 auth = 'none',

BIN
controllers/http_handler.pyc


+ 8 - 1
controllers/resources.json

@@ -15,12 +15,19 @@
 		],
 		"module": "crm"
 	},
-		"opportunities": {
+	"opportunities": {
 		"model": "crm.lead",
 		"filters": [
 			["type", "=", "opportunity"],
 			["active", "=", true]
 		],
 		"module": "crm"
+	},
+	"products": {
+		"model": "product.product",
+		"filters": [
+			["active", "=", true]
+		],
+		"module": "sale"
 	}
 }

+ 10 - 0
models/models.py

@@ -71,3 +71,13 @@ class crm_lead(models.Model):
             'campaign_id': self.campaign_id.id,
             'country_id': self.country_id.id
         }
+'''
+'''
+class product_product(models.Model):
+    _inherit = 'product.product'
+
+    def dump(self):
+        return {
+            'id': self.id,
+            'name': self.name
+        }

BIN
models/models.pyc