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
a9ec8fc3
Commit
a9ec8fc3
authored
Oct 04, 2022
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create sql request in purchase module to get orders between 2 dates
parent
990ebe79
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletions
+25
-1
__openerp__.py
lacagette_addons/lacagette_purchase/__openerp__.py
+1
-1
purchase_order.py
lacagette_addons/lacagette_purchase/models/purchase_order.py
+24
-0
No files found.
lacagette_addons/lacagette_purchase/__openerp__.py
View file @
a9ec8fc3
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
Customization of Purchase process"""
,
Customization of Purchase process"""
,
'description'
:
"""
'description'
:
"""
Customization of Purchase process
Customization of Purchase process
& orders export method
"""
,
"""
,
'author'
:
"cooperatic"
,
'author'
:
"cooperatic"
,
...
...
lacagette_addons/lacagette_purchase/models/purchase_order.py
View file @
a9ec8fc3
...
@@ -40,3 +40,27 @@ class PurchaseOrder(models.Model):
...
@@ -40,3 +40,27 @@ class PurchaseOrder(models.Model):
export_url
+=
'/export/'
+
str
(
self
.
id
)
export_url
+=
'/export/'
+
str
(
self
.
id
)
requests
.
get
(
export_url
)
requests
.
get
(
export_url
)
return
res
return
res
@api.multi
def
get_received_orders_between_dates
(
self
,
date_from
,
date_to
):
res
=
{}
sql
=
"""
SELECT po.name as id_po, sp.date_done, po.amount_untaxed, po.amount_total, po.state, rp.name as supplier_name
FROM purchase_order as po
LEFT JOIN stock_picking as sp ON po.name=sp.origin
LEFT JOIN res_partner as rp ON po.partner_id=rp.id
WHERE sp.date_done IS NOT NULL
AND sp.date_done > '{date_from}'
AND sp.date_done < '{date_to}'
ORDER BY sp.date_done ASC
"""
sql
=
sql
.
format
(
date_from
=
date_from
,
date_to
=
date_to
)
try
:
self
.
env
.
cr
.
execute
(
sql
)
res
[
"data"
]
=
self
.
env
.
cr
.
dictfetchall
()
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