From f9f4b55c57461fa7cb0a4d3fb6fc9e85f53fe9c2 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 26 Dec 2022 17:39:05 +0700 Subject: window sales target --- indoteknik_custom/__manifest__.py | 1 + indoteknik_custom/models/__init__.py | 1 + indoteknik_custom/models/product_template.py | 16 ++++++++ indoteknik_custom/models/sales_target.py | 54 ++++++++++++++++++++++++++ indoteknik_custom/security/ir.model.access.csv | 3 +- indoteknik_custom/views/sales_target.xml | 51 ++++++++++++++++++++++++ 6 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 indoteknik_custom/models/sales_target.py create mode 100644 indoteknik_custom/views/sales_target.xml diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index 633d407b..d8bf8d4c 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -48,6 +48,7 @@ 'views/dunning_run.xml', 'views/website_brand_homepage.xml', 'views/website_categories_homepage.xml', + 'views/sales_target.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 dc85ce96..c8cd85b5 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -35,3 +35,4 @@ from . import website_user_wishlist from . import website_brand_homepage from . import mail_mail from . import website_categories_homepage +from . import sales_target diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 9ddaf91c..dbbd4ad4 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -36,6 +36,14 @@ class ProductTemplate(models.Model): search_rank = fields.Integer(string='Search Rank', default=0) search_rank_weekly = fields.Integer(string='Search Rank Weekly', default=0) supplier_url = fields.Char(string='Vendor URL') + # custom field for support Trusco products + maker_code = fields.Char(string='Maker Code') + maker_name = fields.Char(string='Maker Name') + origin = fields.Char(string='Origin') + features = fields.Char(string='Features') + usage = fields.Char(string='Usage') + specification = fields.Char(string='Specification') + material = fields.Char(string='Material') # def write(self, vals): # if 'solr_flag' not in vals and self.solr_flag == 1: @@ -182,6 +190,14 @@ class ProductProduct(models.Model): 'Qty Stock Vendor', compute='_compute_stock_vendor', help="Stock Vendor") solr_flag = fields.Integer(string='Solr Flag', default=0) + # custom field for support Trusco products + maker_code = fields.Char(string='Maker Code') + maker_name = fields.Char(string='Maker Name') + origin = fields.Char(string='Origin') + features = fields.Char(string='Features') + usage = fields.Char(string='Usage') + specification = fields.Char(string='Specification') + material = fields.Char(string='Material') # def write(self, vals): # if 'solr_flag' not in vals: diff --git a/indoteknik_custom/models/sales_target.py b/indoteknik_custom/models/sales_target.py new file mode 100644 index 00000000..5d2d6310 --- /dev/null +++ b/indoteknik_custom/models/sales_target.py @@ -0,0 +1,54 @@ +from odoo import fields, models, api +from datetime import datetime, timedelta +import logging + +_logger = logging.getLogger(__name__) + + +class SalesTarget(models.Model): + _name = 'sales.target' + + partner_id = fields.Many2one('res.partner', string='Customer') + period = fields.Integer(string='Periode') + omset_last_year = fields.Float(string='Omset Tahun Lalu') + ongoing_omset_odoo = fields.Float(string='Omset Berjalan Odoo', compute='_compute_ongoing_omset') + ongoing_omset_accurate = fields.Float(string='Omset Berjalan Accurate') + ongoing_omset_adempiere = fields.Float(string='Omset Berjalan ADempiere') + ongoing_omset_total = fields.Float(string='Total Omset', compute='_compute_total_omset') + + def _compute_total_omset(self): + for target in self: + target.ongoing_omset_total = target.ongoing_omset_odoo + target.ongoing_omset_accurate + target.ongoing_omset_adempiere + + def _compute_ongoing_omset(self): + for target in self: + target.ongoing_omset_odoo = 0 + if not target.ids: + return True + + partners = [] + if target.partner_id.parent_id: + parent_id = target.partner_id.parent_id + else: + parent_id = target.partner_id + partners += parent_id.child_ids + partners.append(parent_id) + + datefrom = datetime(target.period, 1, 1, 00, 00) + # datefrom = datefrom.strftime('%Y-%m-%d %H:%M:%S') + dateto = datetime(target.period, 12, 31, 23, 59) + # dateto = dateto.strftime('%Y-%m-%d %H:%M:%S') + + total_omset = 0 + for partner in partners: + domain = [ + ('partner_id', '=', partner.id), + ('state', 'not in', ['draft', 'cancel']), + ('move_type', 'in', ('out_invoice', 'out_refund')), + ('invoice_date', '>=', datefrom), + ('invoice_date', '<=', dateto) + ] + invoices = target.env['account.move'].search(domain) + for invoice in invoices: + total_omset += invoice.amount_untaxed + target.ongoing_omset_odoo = total_omset diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index 295da4ee..874ff7ce 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -17,4 +17,5 @@ access_dunning_run_line,access.dunning.run.line,model_dunning_run_line,,1,1,1,1 access_website_user_cart,access.website.user.cart,model_website_user_cart,,1,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 \ No newline at end of file +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 diff --git a/indoteknik_custom/views/sales_target.xml b/indoteknik_custom/views/sales_target.xml new file mode 100644 index 00000000..39462ad7 --- /dev/null +++ b/indoteknik_custom/views/sales_target.xml @@ -0,0 +1,51 @@ + + + + + Sales Target + sales.target + tree,form + + + + Sales Target + sales.target + + + + + + + + + + + + Sales Target + sales.target + +
+ + + + + + + + + + + + +
+
+
+ +
+
\ No newline at end of file -- cgit v1.2.3 From 0e8be12adad9943dd4a86a31fc0bdf64a74f5db0 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 26 Dec 2022 17:51:33 +0700 Subject: add missing field target in window sales target --- indoteknik_custom/models/sales_target.py | 1 + indoteknik_custom/views/sales_target.xml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/indoteknik_custom/models/sales_target.py b/indoteknik_custom/models/sales_target.py index 5d2d6310..ac6405e5 100644 --- a/indoteknik_custom/models/sales_target.py +++ b/indoteknik_custom/models/sales_target.py @@ -15,6 +15,7 @@ class SalesTarget(models.Model): ongoing_omset_accurate = fields.Float(string='Omset Berjalan Accurate') ongoing_omset_adempiere = fields.Float(string='Omset Berjalan ADempiere') ongoing_omset_total = fields.Float(string='Total Omset', compute='_compute_total_omset') + target = fields.Float(string='Target') def _compute_total_omset(self): for target in self: diff --git a/indoteknik_custom/views/sales_target.xml b/indoteknik_custom/views/sales_target.xml index 39462ad7..6ccea260 100644 --- a/indoteknik_custom/views/sales_target.xml +++ b/indoteknik_custom/views/sales_target.xml @@ -16,6 +16,7 @@ + @@ -34,6 +35,7 @@ + -- cgit v1.2.3 From 80cbff436261c85af8b826317037fc5ee07b2d86 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 29 Dec 2022 15:36:37 +0700 Subject: add custom column for support trusco product --- indoteknik_custom/views/product_template.xml | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/indoteknik_custom/views/product_template.xml b/indoteknik_custom/views/product_template.xml index b9b6ba0b..5fcb8b05 100755 --- a/indoteknik_custom/views/product_template.xml +++ b/indoteknik_custom/views/product_template.xml @@ -46,13 +46,30 @@ - - + + + + + + + - + + Product Product + product.product + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3 From 9d4ec4d054858368d21a1efc9f58f1fbd080baaf Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 2 Jan 2023 11:28:12 +0700 Subject: change logic for po status and add table for product spec trusco --- indoteknik_custom/models/__init__.py | 1 + indoteknik_custom/models/product_spec.py | 19 +++++++++++++++++++ indoteknik_custom/models/purchase_order.py | 20 +++++++++++++++----- indoteknik_custom/views/purchase_order.xml | 1 - 4 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 indoteknik_custom/models/product_spec.py diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index c8cd85b5..356f69f0 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -36,3 +36,4 @@ from . import website_brand_homepage from . import mail_mail from . import website_categories_homepage from . import sales_target +from . import product_spec diff --git a/indoteknik_custom/models/product_spec.py b/indoteknik_custom/models/product_spec.py new file mode 100644 index 00000000..161438b6 --- /dev/null +++ b/indoteknik_custom/models/product_spec.py @@ -0,0 +1,19 @@ +from odoo import fields, models, api +from datetime import datetime, timedelta +import logging + +_logger = logging.getLogger(__name__) + + +class ProductTemplateSpec(models.Model): + _name = 'product.template.spec' + product_tmpl_id = fields.Many2one('product.template', string='Product Template') + attribute = fields.Char(string='Attribute', help='Attribute of Product') + value = fields.Char(string='Values', help='Value of Attribute') + + +class ProductVariantSpec(models.Model): + _name = 'product.variant.spec' + product_variant_id = fields.Many2one('product.product', string='Product Variant') + attribute = fields.Char(string='Attribute', help='Attribute of Product') + value = fields.Char(string='Values', help='Value of Attribute') diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index a816038e..b4d671b6 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -70,19 +70,29 @@ class PurchaseOrder(models.Model): def calculate_po_status(self): purchases = self.env['purchase.order'].search([ ('po_status', '!=', 'terproses'), + # ('id', '=', 213), ]) for order in purchases: sum_qty_received = sum_qty_po = 0 + + have_outstanding_pick = False + for pick in order.picking_ids: + if pick.state == 'draft' or pick.state == 'assigned' or pick.state == 'confirmed' or pick.state == 'waiting': + have_outstanding_pick = True + for po_line in order.order_line: sum_qty_po += po_line.product_uom_qty sum_qty_received += po_line.qty_received - if order.summary_qty_po == order.summary_qty_receipt: - order.po_status = 'terproses' - elif order.summary_qty_po > order.summary_qty_receipt > 0: - order.po_status = 'sebagian' + if have_outstanding_pick: + # if order.summary_qty_po == order.summary_qty_receipt: + # order.po_status = 'terproses' + if order.summary_qty_po > order.summary_qty_receipt > 0: + order.po_status = 'sebagian' + else: + order.po_status = 'menunggu' else: - order.po_status = 'menunggu' + order.po_status = 'terproses' _logger.info("Calculate PO Status %s" % order.id) def _compute_summary_qty(self): diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index fcd38677..c4a06a6c 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -71,7 +71,6 @@ - -- cgit v1.2.3 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 From 0d5114af051fed9575bc0d108a0fa14a13875f1b Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 2 Jan 2023 15:11:16 +0700 Subject: add so status for filter outstanding sales --- indoteknik_custom/models/sale_order.py | 63 +++++++++++++++++++++++++++++++++- indoteknik_custom/views/sale_order.xml | 12 +++++++ 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index f21a80fe..7f25f946 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -1,9 +1,11 @@ from odoo import fields, models, api, _ from odoo.exceptions import AccessError, UserError, ValidationError from odoo.tools.misc import formatLang, get_lang - +import logging import warnings +_logger = logging.getLogger(__name__) + class SaleOrder(models.Model): _inherit = "sale.order" @@ -42,6 +44,65 @@ class SaleOrder(models.Model): domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", help="Dipakai untuk alamat tempel") fee_third_party = fields.Float('Fee Pihak Ketiga') + so_status = fields.Selection([ + ('terproses', 'Terproses'), + ('sebagian', 'Sebagian Diproses'), + ('menunggu', 'Menunggu Diproses'), + ]) + + def calculate_so_status_beginning(self): + so_state = ['sale'] + sales = self.env['sale.order'].search([ + ('state', 'in', so_state),# must add validation so_status + ]) + for sale in sales: + sum_qty_ship = sum_qty_so = 0 + have_outstanding_pick = False + + for pick in sale.picking_ids: + if pick.state == 'draft' or pick.state == 'assigned' or pick.state == 'confirmed' or pick.state == 'waiting': + have_outstanding_pick = True + + for so_line in sale.order_line: + sum_qty_so += so_line.product_uom_qty + sum_qty_ship += so_line.qty_delivered + + if have_outstanding_pick: + if sum_qty_so > sum_qty_ship > 0: + sale.so_status = 'sebagian' + else: + sale.so_status = 'menunggu' + else: + sale.so_status = 'terproses' + _logger.info('Calculate SO Status %s' % sale.id) + + def calculate_so_status(self): + so_state = ['sale'] + so_status = ['sebagian', 'menunggu'] + sales = self.env['sale.order'].search([ + ('state', 'in', so_state), + ('so_status', 'in', so_status), + ]) + for sale in sales: + sum_qty_ship = sum_qty_so = 0 + have_outstanding_pick = False + + for pick in sale.pciking_ids: + if pick.state == 'draft' or pick.state == 'assigned' or pick.state == 'confirmed' or pick.state == 'waiting': + have_outstanding_pick = True + + for so_line in sale.order_line: + sum_qty_so += so_line.product_uom_qty + sum_qty_ship += so_line.qty_delivered + + if have_outstanding_pick: + if sum_qty_so > sum_qty_ship > 0: + sale.so_status = 'sebagian' + else: + sale.so_status = 'menunggu' + else: + sale.so_status = 'terproses' + _logger.info('Calculate SO Status %s' % sale.id) @api.onchange('partner_shipping_id') def onchange_partner_shipping(self): diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index ea0cc569..c3bbf8c3 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -72,5 +72,17 @@
+ + Sale Order + sale.order + + + + + + + + + \ No newline at end of file -- cgit v1.2.3 From ddaef3895870403548d032a892a3365de38c016c Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 2 Jan 2023 15:31:46 +0700 Subject: add sales outstanding for monitoring outgoing qty, and add sales person, purchaser --- indoteknik_custom/__manifest__.py | 1 + indoteknik_custom/models/__init__.py | 1 + indoteknik_custom/models/purchase_outstanding.py | 3 +- indoteknik_custom/models/sales_outstanding.py | 33 +++++++++++ indoteknik_custom/security/ir.model.access.csv | 3 +- indoteknik_custom/views/purchase_outstanding.xml | 2 + indoteknik_custom/views/sales_outstanding.xml | 74 ++++++++++++++++++++++++ 7 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 indoteknik_custom/models/sales_outstanding.py create mode 100644 indoteknik_custom/views/sales_outstanding.xml diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index e8e89c1a..c3821327 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -50,6 +50,7 @@ 'views/website_categories_homepage.xml', 'views/sales_target.xml', 'views/purchase_outstanding.xml', + 'views/sales_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 f853b1ed..193fd132 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -38,3 +38,4 @@ from . import website_categories_homepage from . import sales_target from . import product_spec from . import purchase_outstanding +from . import sales_outstanding diff --git a/indoteknik_custom/models/purchase_outstanding.py b/indoteknik_custom/models/purchase_outstanding.py index 0cdd9c39..018ab0ec 100644 --- a/indoteknik_custom/models/purchase_outstanding.py +++ b/indoteknik_custom/models/purchase_outstanding.py @@ -9,6 +9,7 @@ class PurchaseOutstanding(models.Model): id = fields.Integer() order_id = fields.Many2one('purchase.order', string='Nomor PO') partner_id = fields.Many2one('res.partner', String='Vendor') + user_id = fields.Many2one('res.users', string='Purchaser') date_order = fields.Datetime(string="Date Order") po_state = fields.Char(string='State') po_status = fields.Char(string='PO Status') @@ -20,7 +21,7 @@ class PurchaseOutstanding(models.Model): 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, + select pol.id as id, po.id as order_id, po.partner_id, po.user_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 diff --git a/indoteknik_custom/models/sales_outstanding.py b/indoteknik_custom/models/sales_outstanding.py new file mode 100644 index 00000000..645482ff --- /dev/null +++ b/indoteknik_custom/models/sales_outstanding.py @@ -0,0 +1,33 @@ +from odoo import fields, models, api, tools + + +class SalesOutstanding(models.Model): + _name = 'sales.outstanding' + _auto = False + _rec_name = 'product_id' + + id = fields.Integer() + order_id = fields.Many2one('sale.order', string='Nomor SO') + partner_id = fields.Many2one('res.partner', String='Customer') + user_id = fields.Many2one('res.users', string='Salesperson') + date_order = fields.Datetime(string="Date Order") + so_state = fields.Char(string='State') + so_status = fields.Char(string='SO Status') + product_id = fields.Many2one('product.product', string='Product') + product_uom_qty = fields.Integer(string='Qty SO') + qty_delivered = fields.Integer(string='Qty Delivered') + + def init(self): + tools.drop_view_if_exists(self.env.cr, self._table) + self.env.cr.execute(""" + CREATE OR REPLACE VIEW %s AS( + select sol.id as id, so.id as order_id, so.partner_id, so.user_id, + so.date_order, so.state as so_state, so.so_status, + sol.product_id, sol.product_uom_qty, sol.qty_delivered + from sale_order so + join sale_order_line sol on sol.order_id = so.id + where 1=1 + and sol.product_uom_qty <> sol.qty_delivered + and so_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 8c26dd2a..82c5d741 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -19,4 +19,5 @@ access_website_user_wishlist,access.website.user.wishlist,model_website_user_wis 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 -access_purchase_outstanding,access.purchase.outstanding,model_purchase_outstanding,,1,1,1,1 \ No newline at end of file +access_purchase_outstanding,access.purchase.outstanding,model_purchase_outstanding,,1,1,1,1 +access_sales_outstanding,access.sales.outstanding,model_sales_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 index 52003fd6..dc203744 100644 --- a/indoteknik_custom/views/purchase_outstanding.xml +++ b/indoteknik_custom/views/purchase_outstanding.xml @@ -7,6 +7,7 @@ + @@ -27,6 +28,7 @@ + diff --git a/indoteknik_custom/views/sales_outstanding.xml b/indoteknik_custom/views/sales_outstanding.xml new file mode 100644 index 00000000..44c2603d --- /dev/null +++ b/indoteknik_custom/views/sales_outstanding.xml @@ -0,0 +1,74 @@ + + + + sales.outstanding.tree + sales.outstanding + + + + + + + + + + + + + + + + + sales.outstanding.form + sales.outstanding + +
+ + + + + + + + + + + + + + + + + +
+
+
+ + + sales.outstanding.list.select + sales.outstanding + + + + + + + + + + + Sales Outstanding + ir.actions.act_window + sales.outstanding + + tree,form + + + +
\ No newline at end of file -- cgit v1.2.3 From fbea3ab095059a101d32c2f5e4f5b0f309705d28 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 3 Jan 2023 09:35:07 +0700 Subject: fix typo calculate status so --- indoteknik_custom/models/sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 7f25f946..f0792114 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -87,7 +87,7 @@ class SaleOrder(models.Model): sum_qty_ship = sum_qty_so = 0 have_outstanding_pick = False - for pick in sale.pciking_ids: + for pick in sale.picking_ids: if pick.state == 'draft' or pick.state == 'assigned' or pick.state == 'confirmed' or pick.state == 'waiting': have_outstanding_pick = True -- cgit v1.2.3 From 083e4ab620edc20534992d6dd8b891796ecb35ce Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 3 Jan 2023 11:31:57 +0700 Subject: add window dynamic customer review --- indoteknik_api/controllers/api_v1/__init__.py | 1 + indoteknik_api/controllers/api_v1/customer.py | 28 +++++++++++++ indoteknik_custom/__manifest__.py | 1 + indoteknik_custom/models/__init__.py | 1 + indoteknik_custom/models/customer_review.py | 16 ++++++++ indoteknik_custom/security/ir.model.access.csv | 3 +- indoteknik_custom/views/customer_review.xml | 55 ++++++++++++++++++++++++++ 7 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 indoteknik_api/controllers/api_v1/customer.py create mode 100644 indoteknik_custom/models/customer_review.py create mode 100644 indoteknik_custom/views/customer_review.xml diff --git a/indoteknik_api/controllers/api_v1/__init__.py b/indoteknik_api/controllers/api_v1/__init__.py index 5b4f38a0..2a93bcae 100644 --- a/indoteknik_api/controllers/api_v1/__init__.py +++ b/indoteknik_api/controllers/api_v1/__init__.py @@ -11,3 +11,4 @@ from . import sale_order from . import user from . import wishlist from . import brand_homepage +from . import customer diff --git a/indoteknik_api/controllers/api_v1/customer.py b/indoteknik_api/controllers/api_v1/customer.py new file mode 100644 index 00000000..58c93376 --- /dev/null +++ b/indoteknik_api/controllers/api_v1/customer.py @@ -0,0 +1,28 @@ +from .. import controller +from odoo import http +from odoo.http import request +import ast + + +class CustomerReview(controller.Controller): + prefix = '/api/v1/' + + @http.route(prefix + 'customer_review', auth='public', methods=['GET', 'OPTIONS']) + def get_customer_review(self, **kw): + if not self.authenticate(): + return self.response(code=401, description='Unauthorized') + base_url = request.env['ir.config_parameter'].get_param('web.base.url') + query = [('status', '=', 'tayang')] + reviews = request.env['customer.review'].search(query, order='sequence') + data = [] + for review in reviews: + data.append({ + 'id': review.id, + 'sequence': review.sequence, + 'image': base_url + 'api/image/customer.review/image/' + str(review.id) if review.image else '', + 'customer_name': review.customer_name, + 'ulasan': review.ulasan, + 'name': review.name, + 'jabatan': review.jabatan + }) + return self.response(data) diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index c3821327..cf034f91 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -51,6 +51,7 @@ 'views/sales_target.xml', 'views/purchase_outstanding.xml', 'views/sales_outstanding.xml', + 'views/customer_review.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 193fd132..1190e7d0 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -39,3 +39,4 @@ from . import sales_target from . import product_spec from . import purchase_outstanding from . import sales_outstanding +from . import customer_review diff --git a/indoteknik_custom/models/customer_review.py b/indoteknik_custom/models/customer_review.py new file mode 100644 index 00000000..5fb93b2e --- /dev/null +++ b/indoteknik_custom/models/customer_review.py @@ -0,0 +1,16 @@ +from odoo import fields, models, api + + +class CustomerReview(models.Model): + _name = 'customer.review' + + sequence = fields.Integer(string='Sequence') + customer_name = fields.Char(string='Customer') + image = fields.Binary(string='Image') + ulasan = fields.Char(string='Ulasan') + name = fields.Char(string='Name') + jabatan = fields.Char(string='Jabatan') + status = fields.Selection([ + ('tayang', 'Tayang'), + ('tidak_tayang', 'Tidak Tayang') + ], string='Status') diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index 82c5d741..c6d6cb4e 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -20,4 +20,5 @@ access_website_brand_homepage,access.website.brand.homepage,model_website_brand_ 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 access_purchase_outstanding,access.purchase.outstanding,model_purchase_outstanding,,1,1,1,1 -access_sales_outstanding,access.sales.outstanding,model_sales_outstanding,,1,1,1,1 \ No newline at end of file +access_sales_outstanding,access.sales.outstanding,model_sales_outstanding,,1,1,1,1 +access_customer_review,access.customer.review,model_customer_review,,1,1,1,1 \ No newline at end of file diff --git a/indoteknik_custom/views/customer_review.xml b/indoteknik_custom/views/customer_review.xml new file mode 100644 index 00000000..7d7e66df --- /dev/null +++ b/indoteknik_custom/views/customer_review.xml @@ -0,0 +1,55 @@ + + + + + Customer Review + customer.review + tree,form + + + + Customer Review + customer.review + + + + + + + + + + + + + + Customer Review + customer.review + +
+ + + + + + + + + + + + + +
+
+
+ + +
+
\ No newline at end of file -- cgit v1.2.3 From 69c476bba84a7cb2b33e8b45bc1ea7d140333b2f Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 3 Jan 2023 17:40:36 +0700 Subject: add cache reset per brand --- indoteknik_custom/models/x_manufactures.py | 20 ++++++++++++++++++++ indoteknik_custom/views/x_manufactures.xml | 2 ++ 2 files changed, 22 insertions(+) diff --git a/indoteknik_custom/models/x_manufactures.py b/indoteknik_custom/models/x_manufactures.py index 24b64c14..1d215cf8 100755 --- a/indoteknik_custom/models/x_manufactures.py +++ b/indoteknik_custom/models/x_manufactures.py @@ -1,5 +1,7 @@ from odoo import models, fields, api +import logging +_logger = logging.getLogger(__name__) class XManufactures(models.Model): _name = 'x_manufactures' @@ -36,6 +38,24 @@ class XManufactures(models.Model): ], string="Jenis Produk") x_short_desc = fields.Text(string="Short Description") product_tmpl_ids = fields.One2many('product.template', 'x_manufacture', string='Product Templates') + cache_reset_status = fields.Selection([ + ('reset', 'Reset'), + ('done', 'Done') + ], string="Cache Reset") + + def cache_reset(self): + manufactures = self.env['x_manufactures'].search([ + ('cache_reset_status', '=', 'reset'), + ]) + for manufacture in manufactures: + products = self.env['product.template'].search([ + ('x_manufacture', '=', manufacture.id), + ('solr_flag', '=', 1), + ]) + for product in products: + product.solr_flag = 2 + _logger.info("Reset Solr Flag to 2 %s" % product.id) + manufacture.cache_reset_status = 'done' @api.onchange('x_name','image_promotion_1','image_promotion_2') def update_solr_flag(self): diff --git a/indoteknik_custom/views/x_manufactures.xml b/indoteknik_custom/views/x_manufactures.xml index e7e1b85d..d122c6c1 100755 --- a/indoteknik_custom/views/x_manufactures.xml +++ b/indoteknik_custom/views/x_manufactures.xml @@ -22,6 +22,7 @@ +
@@ -40,6 +41,7 @@ + -- cgit v1.2.3 From 2bc877dcbe21138451a65aa00f75f2ca240b0e4a Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 4 Jan 2023 11:04:01 +0700 Subject: add window website channel and website content --- indoteknik_custom/__manifest__.py | 2 + indoteknik_custom/models/__init__.py | 1 + indoteknik_custom/models/website_content.py | 34 +++++++++++ indoteknik_custom/security/ir.model.access.csv | 4 +- indoteknik_custom/views/website_content.xml | 65 ++++++++++++++++++++++ .../views/website_content_channel.xml | 58 +++++++++++++++++++ 6 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 indoteknik_custom/models/website_content.py create mode 100644 indoteknik_custom/views/website_content.xml create mode 100644 indoteknik_custom/views/website_content_channel.xml diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index cf034f91..137cfb1f 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -52,6 +52,8 @@ 'views/purchase_outstanding.xml', 'views/sales_outstanding.xml', 'views/customer_review.xml', + 'views/website_content_channel.xml', + 'views/website_content.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 1190e7d0..d7d3e03c 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -40,3 +40,4 @@ from . import product_spec from . import purchase_outstanding from . import sales_outstanding from . import customer_review +from . import website_content diff --git a/indoteknik_custom/models/website_content.py b/indoteknik_custom/models/website_content.py new file mode 100644 index 00000000..e94076f8 --- /dev/null +++ b/indoteknik_custom/models/website_content.py @@ -0,0 +1,34 @@ +from odoo import fields, models, api +import logging + +_logger = logging.getLogger(__name__) + + +class WebsiteContent(models.Model): + _name = 'website.content' + + sequence = fields.Integer(string='Sequence') + slide_type = fields.Selection([ + ('document', 'Document'), + ('infographic', 'Infographic'), + ('presentation', 'Presentation'), + ('video', 'Video') + ]) + name = fields.Char(string='Name') + url = fields.Char(string='URL') + channel_id = fields.Many2one('website.content.channel', string='Channel') + status = fields.Selection([ + ('tayang', 'Tayang'), + ('tidak_tayang', 'Tidak Tayang') + ], string='Status') + + +class WebsiteContentChannel(models.Model): + _name = 'website.content.channel' + + name = fields.Char(string='Name') + description_html = fields.Html('Description', sanitize_attributes=False, sanitize_form=False) + visibility = fields.Selection([ + ('public', 'Public'), + ('internal', 'Internal') + ]) diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index c6d6cb4e..2f70d737 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -21,4 +21,6 @@ access_website_categories_homepage,access.website.categories.homepage,model_webs 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 access_sales_outstanding,access.sales.outstanding,model_sales_outstanding,,1,1,1,1 -access_customer_review,access.customer.review,model_customer_review,,1,1,1,1 \ No newline at end of file +access_customer_review,access.customer.review,model_customer_review,,1,1,1,1 +access_website_content_channel,access.website.content.channel,model_website_content_channel,,1,1,1,1 +access_website_content,access.website.content,model_website_content,,1,1,1,1 \ No newline at end of file diff --git a/indoteknik_custom/views/website_content.xml b/indoteknik_custom/views/website_content.xml new file mode 100644 index 00000000..e071134d --- /dev/null +++ b/indoteknik_custom/views/website_content.xml @@ -0,0 +1,65 @@ + + + + website.content.tree + website.content + + + + + + + + + + + + + + website.content.form + website.content + +
+ + + + + + + + + + + + +
+
+
+ + + website.content.list.select + website.content + + + + + + + + + + Website Content + ir.actions.act_window + website.content + + tree,form + + + +
\ No newline at end of file diff --git a/indoteknik_custom/views/website_content_channel.xml b/indoteknik_custom/views/website_content_channel.xml new file mode 100644 index 00000000..d1bc23fc --- /dev/null +++ b/indoteknik_custom/views/website_content_channel.xml @@ -0,0 +1,58 @@ + + + + website.content.channel.tree + website.content.channel + + + + + + + + + + website.content.channel.form + website.content.channel + +
+ + + + + + + + + +
+
+
+ + + website.content.channel.list.select + website.content.channel + + + + + + + + + + Website Content Channel + ir.actions.act_window + website.content.channel + + tree,form + + + +
\ No newline at end of file -- cgit v1.2.3 From b722280f1b078e2b5bd2cd83428dcafb29e86c8b Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 4 Jan 2023 11:25:11 +0700 Subject: add date done in receipt inventory --- indoteknik_custom/views/stock_picking.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index ce70fdd8..49e594b1 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -1,6 +1,19 @@ + + Stock Picking + stock.picking + + + + + + + + + + Stock Picking stock.picking -- cgit v1.2.3 From 43b20f27ca04037139b1775e6db2bfcc2fe5b851 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 4 Jan 2023 14:16:38 +0700 Subject: Customer PO --- indoteknik_custom/models/sale_order.py | 3 +++ indoteknik_custom/views/sale_order.xml | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index f0792114..3f6f5032 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -49,6 +49,9 @@ class SaleOrder(models.Model): ('sebagian', 'Sebagian Diproses'), ('menunggu', 'Menunggu Diproses'), ]) + partner_purchase_order_name = fields.Char(string='Nama PO Customer', copy=False, help="Nama purchase order customer, diisi oleh customer melalui website.", tracking=3) + partner_purchase_order_description = fields.Text(string='Keterangan PO Customer', copy=False, help="Keterangan purchase order customer, diisi oleh customer melalui website.", tracking=3) + partner_purchase_order_file = fields.Binary(string='File PO Customer', copy=False, help="File purchase order customer, diisi oleh customer melalui website.") def calculate_so_status_beginning(self): so_state = ['sale'] diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index c3bbf8c3..9dfd9805 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -57,6 +57,19 @@ + + + + + + + + + + + + + -- cgit v1.2.3