summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/automatic_purchase.py
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models/automatic_purchase.py')
-rw-r--r--indoteknik_custom/models/automatic_purchase.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py
index 0b2f7d1b..3035ceab 100644
--- a/indoteknik_custom/models/automatic_purchase.py
+++ b/indoteknik_custom/models/automatic_purchase.py
@@ -744,7 +744,10 @@ class SaleNotInMatchPO(models.Model):
select distinct coalesce(posm.sale_line_id,0)
from purchase_order_sales_match posm
join purchase_order po on po.id = posm.purchase_order_id
+ join purchase_order_line pol on pol.order_id = posm.purchase_order_id and pol.product_id = posm.product_id
+ join stock_move sm on sm.purchase_line_id = pol.id
where po.state not in ('cancel')
+ and sm.state not in ('cancel')
)
)
""" % self._table) \ No newline at end of file