#51 feat: registrar categorias en admin y documentar endpoints
Issue #51: discriminacion y administracion de categorias de productos. - ProductCategoryAdmin con list_display/filtro por active - doc/requests.org: GET/PATCH product_categories, import_from_external, deactivate, activate
This commit is contained in:
@@ -137,3 +137,49 @@ post importar_productos_de_tryton
|
|||||||
#+begin_src json
|
#+begin_src json
|
||||||
[]
|
[]
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
*** Categorías de productos
|
||||||
|
La fuente de categorías es Tryton. name y external_id son solo lectura; Don
|
||||||
|
Confiao administra description, alternative_name y active.
|
||||||
|
|
||||||
|
**** Listar categorías
|
||||||
|
get product_categories/?active=all
|
||||||
|
get product_categories/?active=true
|
||||||
|
get product_categories/?active=false
|
||||||
|
|
||||||
|
**** Actualizar campos administrados por Don Confiao
|
||||||
|
patch product_categories/1/
|
||||||
|
|
||||||
|
#+begin_src json
|
||||||
|
{
|
||||||
|
"description": "Granos enteros",
|
||||||
|
"alternative_name": "Cereales",
|
||||||
|
"active": false
|
||||||
|
}
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
**** Importar categorías desde Tryton
|
||||||
|
Solo importa las categorías asociadas a productos salables; no borra
|
||||||
|
categorías locales. Requiere administrador.
|
||||||
|
|
||||||
|
post product_categories/import_from_external
|
||||||
|
|
||||||
|
{}
|
||||||
|
|
||||||
|
**** Desactivar categorías
|
||||||
|
post product_categories/deactivate/
|
||||||
|
|
||||||
|
#+begin_src json
|
||||||
|
{
|
||||||
|
"ids": [1, 2]
|
||||||
|
}
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
**** Activación de categorías
|
||||||
|
post product_categories/activate/
|
||||||
|
|
||||||
|
#+begin_src json
|
||||||
|
{
|
||||||
|
"ids": [1, 2]
|
||||||
|
}
|
||||||
|
#+end_src
|
||||||
|
|||||||
@@ -77,6 +77,12 @@ class ProductAdmin(admin.ModelAdmin):
|
|||||||
search_fields = ("id", "name",)
|
search_fields = ("id", "name",)
|
||||||
list_filter = ("name", "id")
|
list_filter = ("name", "id")
|
||||||
|
|
||||||
admin.site.register(ProductCategory)
|
|
||||||
|
@admin.register(ProductCategory)
|
||||||
|
class ProductCategoryAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ("id", "name", "alternative_name", "active", "external_id")
|
||||||
|
search_fields = ("name", "alternative_name", "external_id")
|
||||||
|
list_filter = ("active",)
|
||||||
|
|
||||||
admin.site.register(Payment)
|
admin.site.register(Payment)
|
||||||
admin.site.register(ReconciliationJar)
|
admin.site.register(ReconciliationJar)
|
||||||
|
|||||||
Reference in New Issue
Block a user