From 52016c0ba728b92c913b560d0302a07f12ddfb9c Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 2 Jan 2023 14:24:45 +0700 Subject: add window purchase outstanding for check incoming qty --- indoteknik_custom/__manifest__.py | 1 + indoteknik_custom/models/__init__.py | 1 + indoteknik_custom/models/purchase_outstanding.py | 32 +++++++++++ indoteknik_custom/security/ir.model.access.csv | 3 +- indoteknik_custom/views/purchase_outstanding.xml | 72 ++++++++++++++++++++++++ 5 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 indoteknik_custom/models/purchase_outstanding.py create mode 100644 indoteknik_custom/views/purchase_outstanding.xml diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index d8bf8d4c..e8e89c1a 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -49,6 +49,7 @@ 'views/website_brand_homepage.xml', 'views/website_categories_homepage.xml', 'views/sales_target.xml', + 'views/purchase_outstanding.xml', 'report/report.xml', 'report/report_banner_banner.xml', 'report/report_banner_banner2.xml', diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index 356f69f0..f853b1ed 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -37,3 +37,4 @@ from . import mail_mail from . import website_categories_homepage from . import sales_target from . import product_spec +from . import purchase_outstanding diff --git a/indoteknik_custom/models/purchase_outstanding.py b/indoteknik_custom/models/purchase_outstanding.py new file mode 100644 index 00000000..0cdd9c39 --- /dev/null +++ b/indoteknik_custom/models/purchase_outstanding.py @@ -0,0 +1,32 @@ +from odoo import fields, models, api, tools + + +class PurchaseOutstanding(models.Model): + _name = 'purchase.outstanding' + _auto = False + _rec_name = 'product_id' + + id = fields.Integer() + order_id = fields.Many2one('purchase.order', string='Nomor PO') + partner_id = fields.Many2one('res.partner', String='Vendor') + date_order = fields.Datetime(string="Date Order") + po_state = fields.Char(string='State') + po_status = fields.Char(string='PO Status') + product_id = fields.Many2one('product.product', string='Product') + product_uom_qty = fields.Integer(string='Qty PO') + qty_received = fields.Integer(string='Qty Received') + + def init(self): + tools.drop_view_if_exists(self.env.cr, self._table) + self.env.cr.execute(""" + CREATE OR REPLACE VIEW %s AS( + select pol.id as id, po.id as order_id, po.partner_id, + po.date_order, po.state as po_state, po.po_status, + pol.product_id, pol.product_uom_qty, pol.qty_received + from purchase_order_line pol + join purchase_order po on po.id = pol.order_id + where 1=1 + and pol.product_uom_qty <> pol.qty_received + and po_status in ('sebagian','menunggu') + ) + """ % self._table) diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index 874ff7ce..8c26dd2a 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -18,4 +18,5 @@ access_website_user_cart,access.website.user.cart,model_website_user_cart,,1,1,1 access_website_user_wishlist,access.website.user.wishlist,model_website_user_wishlist,,1,1,1,1 access_website_brand_homepage,access.website.brand.homepage,model_website_brand_homepage,,1,1,1,1 access_website_categories_homepage,access.website.categories.homepage,model_website_categories_homepage,,1,1,1,1 -access_sales_target,access.sales.target,model_sales_target,,1,1,1,1 \ No newline at end of file +access_sales_target,access.sales.target,model_sales_target,,1,1,1,1 +access_purchase_outstanding,access.purchase.outstanding,model_purchase_outstanding,,1,1,1,1 \ No newline at end of file diff --git a/indoteknik_custom/views/purchase_outstanding.xml b/indoteknik_custom/views/purchase_outstanding.xml new file mode 100644 index 00000000..52003fd6 --- /dev/null +++ b/indoteknik_custom/views/purchase_outstanding.xml @@ -0,0 +1,72 @@ + + + + purchase.outstanding.tree + purchase.outstanding + + + + + + + + + + + + + + + + purchase.outstanding.form + purchase.outstanding + +
+ + + + + + + + + + + + + + + + +
+
+
+ + + purchase.outstanding.list.select + purchase.outstanding + + + + + + + + + + + Purchase Outstanding + ir.actions.act_window + purchase.outstanding + + tree,form + + + +
\ No newline at end of file -- cgit v1.2.3