Skip to content
Snippets Groups Projects
Commit a8ed0c00 authored by Krupal Oza's avatar Krupal Oza Committed by Barad Mahendra
Browse files

[FIX] purchase_stock: Fix traceback while accessing purcase report

Since recent commit[1], from the report 'purchase.report' inherited in
purchase_stock, `effective_date` field is moved out from the query and
is placed inside the domain. However, `effective_date` field is not
available in 'purchase.report' and is part of the 'purchase.order'
and so moving it inside the domain results into a traceback.

This commit fixes the issue by adding this field from purchase.order to
purchase.report so domain works as expcted.

commit[1] - https://github.com/odoo/odoo/pull/49999/commits/b7115cc006fb15c935ceef41e8372b1d3ceb1462#diff-34545aa3f96ecc997188c974620118ee



closes odoo/odoo#52103

Taskid: 2263566
Closes: #52103
Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
parent 7686e1bc
No related branches found
No related tags found
No related merge requests found
......@@ -16,15 +16,16 @@ class PurchaseReport(models.Model):
'Average Receipt Delay', digits=(16, 2), readonly=True, store=False, # needs store=False to prevent showing up as a 'measure' option
help="Amount of time between expected and effective receipt date. Due to a hack needed to calculate this, \
every record will show the same average value, therefore only use this as an aggregated value with group_operator=avg")
effective_date = fields.Datetime(string="Effective Date")
def _select(self):
return super(PurchaseReport, self)._select() + ", spt.warehouse_id as picking_type_id"
return super(PurchaseReport, self)._select() + ", spt.warehouse_id as picking_type_id, po.effective_date as effective_date"
def _from(self):
return super(PurchaseReport, self)._from() + " left join stock_picking_type spt on (spt.id=po.picking_type_id)"
def _group_by(self):
return super(PurchaseReport, self)._group_by() + ", spt.warehouse_id"
return super(PurchaseReport, self)._group_by() + ", spt.warehouse_id, effective_date"
@api.model
def read_group(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment