Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
odoo
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-foodcoops
odoo
Commits
ce8930fb
Commit
ce8930fb
authored
Jun 03, 2022
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add lacagette_categories (Dev for Graoucoop shop custom)
parent
7f7eeed7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
0 deletions
+65
-0
__init__.py
lacagette_addons/lacagette_categories/__init__.py
+4
-0
__openerp__.py
lacagette_addons/lacagette_categories/__openerp__.py
+27
-0
__init__.py
lacagette_addons/lacagette_categories/models/__init__.py
+2
-0
categories.py
lacagette_addons/lacagette_categories/models/categories.py
+32
-0
No files found.
lacagette_addons/lacagette_categories/__init__.py
0 → 100644
View file @
ce8930fb
# -*- coding: utf-8 -*-
from
.
import
models
\ No newline at end of file
lacagette_addons/lacagette_categories/__openerp__.py
0 → 100644
View file @
ce8930fb
# -*- coding: utf-8 -*-
{
'name'
:
"La Cagette Categories"
,
'summary'
:
"""
Retrieve data from internal categories"""
,
'description'
:
"""
"""
,
'author'
:
"fracolo"
,
'website'
:
"https://lacagette-coop.fr"
,
# Categories can be used to filter modules in modules listing
# Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml
# for the full list
'category'
:
'Product'
,
'version'
:
'0.0.1'
,
# any module necessary for this one to work correctly
'depends'
:
[
'base'
,
'product'
],
# always loaded
'data'
:
[
],
'installable'
:
True
,
}
lacagette_addons/lacagette_categories/models/__init__.py
0 → 100644
View file @
ce8930fb
# -*- coding: utf-8 -*-
from
.
import
categories
lacagette_addons/lacagette_categories/models/categories.py
0 → 100644
View file @
ce8930fb
# -*- coding: utf-8 -*-
from
openerp
import
_
,
api
,
models
,
fields
class
LaCagetteCategories
(
models
.
Model
):
_name
=
"lacagette.categories"
@api.model
def
get_all_with_products_count
(
self
):
res
=
{}
try
:
sql
=
"""
SELECT
categ_id, count(*) as nb
FROM product_template
WHERE
active=true AND sale_ok=true
GROUP BY categ_id;
"""
self
.
env
.
cr
.
execute
(
sql
)
res
[
'list'
]
=
{}
req_res
=
self
.
env
.
cr
.
dictfetchall
()
for
u
in
req_res
:
for
attr
in
u
.
keys
():
if
u
[
attr
]
is
None
:
u
[
attr
]
=
''
res
[
'list'
][
str
(
u
[
'categ_id'
])]
=
u
[
'nb'
]
except
Exception
as
e
:
res
[
'error'
]
=
str
(
e
)
return
res
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment