diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2025-05-23 09:23:09 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2025-05-23 09:23:09 +0700 |
| commit | 43313db30da73b87843425c01c723f66ee982886 (patch) | |
| tree | 1f6dc6e9518c27ac3a867c42f25f56eed6f8cae0 /indoteknik_custom/models/automatic_purchase.py | |
| parent | f6f59e660af6c4229ada54f7313d68867df1ba15 (diff) | |
| parent | 46e4c80e1b530274c01cca5603f3e1be873820f6 (diff) | |
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into odoo-backup
# Conflicts:
# indoteknik_custom/models/sale_order.py
Diffstat (limited to 'indoteknik_custom/models/automatic_purchase.py')
| -rw-r--r-- | indoteknik_custom/models/automatic_purchase.py | 45 |
1 files changed, 33 insertions, 12 deletions
diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index b66121e1..ff10b814 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -696,21 +696,42 @@ class SaleNotInMatchPO(models.Model): purchase_tax_id = fields.Many2one('account.tax', string='Purchase Tax') note_procurement = fields.Many2one(string='Note Procurement') + # 1. yang bug + # def init(self): + # tools.drop_view_if_exists(self.env.cr, self._table) + # self.env.cr.execute(""" + # CREATE OR REPLACE VIEW %s AS( + # select apsm.id, apsm.automatic_purchase_id, apsm.automatic_purchase_line_id, apsm.sale_id, apsm.sale_line_id, + # apsm.picking_id, apsm.move_id, apsm.partner_id, + # apsm.partner_invoice_id, apsm.salesperson_id, apsm.product_id, apsm.qty_so, apsm.qty_po, apsm.create_uid, + # apsm.create_date, apsm.write_uid, apsm.write_date, apsm.purchase_price, + # apsm.purchase_tax_id, apsm.note_procurement + # from automatic_purchase_sales_match apsm + # where apsm.sale_line_id not in ( + # 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 + # where po.state not in ('cancel') + # ) + # ) + # """ % self._table) + def init(self): tools.drop_view_if_exists(self.env.cr, self._table) self.env.cr.execute(""" CREATE OR REPLACE VIEW %s AS( - select apsm.id, apsm.automatic_purchase_id, apsm.automatic_purchase_line_id, apsm.sale_id, apsm.sale_line_id, - apsm.picking_id, apsm.move_id, apsm.partner_id, - apsm.partner_invoice_id, apsm.salesperson_id, apsm.product_id, apsm.qty_so, apsm.qty_po, apsm.create_uid, - apsm.create_date, apsm.write_uid, apsm.write_date, apsm.purchase_price, - apsm.purchase_tax_id, apsm.note_procurement - from automatic_purchase_sales_match apsm - where apsm.sale_line_id not in ( - 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 - where po.state not in ('cancel') + SELECT apsm.id, apsm.automatic_purchase_id, apsm.automatic_purchase_line_id, + apsm.sale_id, apsm.sale_line_id, apsm.picking_id, apsm.move_id, + apsm.partner_id, apsm.partner_invoice_id, apsm.salesperson_id, + apsm.product_id, apsm.qty_so, apsm.qty_po, apsm.create_uid, + apsm.create_date, apsm.write_uid, apsm.write_date, apsm.purchase_price, + apsm.purchase_tax_id, apsm.note_procurement + FROM automatic_purchase_sales_match apsm + WHERE apsm.sale_line_id NOT IN ( + SELECT posm.sale_line_id + FROM purchase_order_sales_match posm + JOIN purchase_order po ON po.id = posm.purchase_order_id + WHERE po.state NOT IN ('cancel') ) ) - """ % self._table) + """ % self._table)
\ No newline at end of file |
