summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-06-27 09:54:00 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-06-27 09:54:00 +0700
commit9704530832cbb70a8209e556a9a67a25fe8c11fc (patch)
tree0c92d7c479fd81d998d2cc0dec8334b9dc6fa48c
parent72888c5c59078195420f6a6da3ae1c65766390d7 (diff)
parent45dc1483342d9ec195c53711b5194e7ddf88b343 (diff)
Merge branch 'release' into nathan-dev
-rw-r--r--indoteknik_api/controllers/api_v1/sale_order.py2
-rwxr-xr-xindoteknik_custom/models/__init__.py2
-rw-r--r--indoteknik_custom/models/apache_solr.py67
-rwxr-xr-xindoteknik_custom/models/purchase_order.py30
-rw-r--r--indoteknik_custom/models/requisition.py63
-rwxr-xr-xindoteknik_custom/models/sale_monitoring_detail.py4
-rwxr-xr-xindoteknik_custom/models/sale_order.py15
-rw-r--r--indoteknik_custom/models/stock_picking.py73
-rw-r--r--indoteknik_custom/models/users.py12
-rwxr-xr-xindoteknik_custom/models/x_manufactures.py11
-rwxr-xr-xindoteknik_custom/views/purchase_order.xml1
-rw-r--r--indoteknik_custom/views/requisition.xml9
-rwxr-xr-xindoteknik_custom/views/sale_monitoring_detail.xml2
-rwxr-xr-xindoteknik_custom/views/sale_order.xml2
-rw-r--r--indoteknik_custom/views/stock_picking.xml28
-rw-r--r--indoteknik_custom/views/users.xml1
16 files changed, 254 insertions, 68 deletions
diff --git a/indoteknik_api/controllers/api_v1/sale_order.py b/indoteknik_api/controllers/api_v1/sale_order.py
index ec33495e..671ff5a8 100644
--- a/indoteknik_api/controllers/api_v1/sale_order.py
+++ b/indoteknik_api/controllers/api_v1/sale_order.py
@@ -246,7 +246,7 @@ class SaleOrder(controller.Controller):
parameters = {
'warehouse_id': 8,
'carrier_id': 1,
- 'sales_tax_id': 23,
+ 'sales_tax_id': 20,
'pricelist_id': product_pricelist_default_discount_id,
'payment_term_id': 26,
'team_id': 2,
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py
index 9d0f8d47..166d43ad 100755
--- a/indoteknik_custom/models/__init__.py
+++ b/indoteknik_custom/models/__init__.py
@@ -22,9 +22,9 @@ from . import purchase_pricelist
from . import res_partner_company_type
from . import res_partner
from . import res_users
+from . import sale_order
from . import sale_monitoring_detail
from . import sale_monitoring
-from . import sale_order
from . import sales_outstanding
from . import sales_target
from . import stock_move
diff --git a/indoteknik_custom/models/apache_solr.py b/indoteknik_custom/models/apache_solr.py
index 9f187d78..6211dfc4 100644
--- a/indoteknik_custom/models/apache_solr.py
+++ b/indoteknik_custom/models/apache_solr.py
@@ -7,6 +7,7 @@ import time
_logger = logging.getLogger(__name__)
_solr = pysolr.Solr('http://10.148.0.5:8983/solr/product/', always_commit=True, timeout=30)
+_variants_solr = pysolr.Solr('http://10.148.0.5:8983/solr/variants/', always_commit=True, timeout=30)
# _solr = pysolr.Solr('http://34.101.189.218:8983/solr/product/', always_commit=True, timeout=30) # for development only
@@ -177,3 +178,69 @@ class ApacheSolr(models.Model):
_logger.info('price after discount : %s' % product._get_website_price_after_disc())
_logger.info('price excl after discount : %s' % product._get_website_price_after_disc_and_tax())
_logger.info('tax : %s' % product._get_website_tax())
+
+ def _sync_variants_to_solr(self, limit=500):
+ start_time = time.time()
+ _logger.info('run sync to solr variants...')
+ query = ["&","&","&",("product_tmpl_id.active","=",True),("product_tmpl_id.type","=","product"),("active","=",True),"|",("solr_flag","=",0),("solr_flag","=",2)]
+ # query = [('id', 'in', [184622, 204903])]
+
+ variants = self.env['product.product'].search(query, limit=limit)
+ documents = []
+ counter = 0
+ for variant in variants:
+ template_time = time.time()
+ counter += 1
+
+ price_excl_after_disc = price_excl = discount = tax = 0
+ price_excl = variant._get_website_price_exclude_tax()
+ price_excl_after_disc = variant._get_website_price_after_disc_and_tax()
+ discount = variant._get_website_disc(0)
+ tax = variant._get_website_tax()
+ flashsale_data = variant._get_flashsale_price()
+
+ category_id = ''
+ category_name = ''
+ for category in variant.product_tmpl_id.public_categ_ids:
+ category_id = category.id
+ category_name = category.name
+
+ document = {
+ 'id': variant.id,
+ 'display_name_s': variant.display_name,
+ 'name_s': variant.name,
+ 'default_code_s': variant.default_code or '',
+ 'product_rating_f': variant.product_tmpl_id.virtual_rating,
+ 'product_id_i': variant.id,
+ 'template_id_i': variant.product_tmpl_id.id,
+ 'image_s': self.env['ir.attachment'].api_image('product.template', 'image_512', variant.product_tmpl_id.id),
+ 'price_f': price_excl,
+ 'discount_f': discount,
+ 'price_discount_f': price_excl_after_disc,
+ 'tax_f': tax,
+ 'stock_total_f': variant.qty_stock_vendor,
+ 'weight_f': variant.product_tmpl_id.weight,
+ 'manufacture_id_i': variant.product_tmpl_id.x_manufacture.id or 0,
+ 'manufacture_name_s': variant.product_tmpl_id.x_manufacture.x_name or '',
+ 'manufacture_name': variant.product_tmpl_id.x_manufacture.x_name or '',
+ 'image_promotion_1_s': self.env['ir.attachment'].api_image('x_manufactures', 'image_promotion_1', variant.product_tmpl_id.x_manufacture.id),
+ 'image_promotion_2_s': self.env['ir.attachment'].api_image('x_manufactures', 'image_promotion_2', variant.product_tmpl_id.x_manufacture.id),
+ 'category_id_i': category_id or 0,
+ 'category_name_s': category_name or '',
+ 'category_name': category_name or '',
+ 'search_rank_i': variant.product_tmpl_id.search_rank,
+ 'search_rank_weekly_i': variant.product_tmpl_id.search_rank_weekly,
+ 'flashsale_id_i': flashsale_data['flashsale_id'] or 0,
+ 'flashsale_name_s': flashsale_data['flashsale_name'] or '',
+ 'flashsale_base_price_f': flashsale_data['flashsale_base_price'] or 0,
+ 'flashsale_discount_f': flashsale_data['flashsale_discount'] or 0,
+ 'flashsale_price_f': flashsale_data['flashsale_price'] or 0,
+ }
+ documents.append(document)
+ variant.solr_flag = 1
+ # add counter for monitoring
+ _logger.info('[SYNC_VARIANTS_TO_SOLR] {}/{} {:.6f}'.format(counter, limit, time.time() - template_time))
+ _logger.info('[SYNC_VARIANTS_TO_SOLR] Success add to solr variants %s' % variant.id)
+ _variants_solr.add(documents)
+ end_time = time.time()
+ _logger.info("[SYNC_VARIANTS_TO_SOLR] Finish task add to solr. Time taken: {:.6f} seconds".format(end_time - start_time))
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 5aedb07b..13ff2931 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -151,22 +151,20 @@ class PurchaseOrder(models.Model):
self.order_line.unlink()
for order_line in self.sale_order_id.order_line:
if order_line.product_id.id and order_line.product_id.id not in products_exception:
- for order_line in self.sale_order_id.order_line:
-
- qty_available = order_line.product_id.qty_onhand_bandengan + order_line.product_id.qty_incoming_bandengan - order_line.product_id.outgoing_qty
-
- suggest = 'harus beli'
- if qty_available > order_line.product_qty:
- suggest = 'masih cukup'
- values = {
- 'order_id': self.id,
- 'product_id': order_line.product_id.id,
- 'name': order_line.product_id.display_name,
- 'product_qty': order_line.product_qty,
- 'qty_available_store': qty_available,
- 'suggest': suggest,
- }
- self.order_line.create(values)
+ qty_available = order_line.product_id.qty_onhand_bandengan + order_line.product_id.qty_incoming_bandengan - order_line.product_id.outgoing_qty
+
+ suggest = 'harus beli'
+ if qty_available > order_line.product_qty:
+ suggest = 'masih cukup'
+ values = {
+ 'order_id': self.id,
+ 'product_id': order_line.product_id.id,
+ 'name': order_line.product_id.display_name,
+ 'product_qty': order_line.product_qty,
+ 'qty_available_store': qty_available,
+ 'suggest': suggest,
+ }
+ self.order_line.create(values)
def compute_count_line_product(self):
for order in self:
diff --git a/indoteknik_custom/models/requisition.py b/indoteknik_custom/models/requisition.py
index 5bb3272e..19f0ba7e 100644
--- a/indoteknik_custom/models/requisition.py
+++ b/indoteknik_custom/models/requisition.py
@@ -26,6 +26,43 @@ class Requisition(models.Model):
result = super(Requisition, self).create(vals)
return result
+ def create_requisition_from_sales_with_price(self):
+ if self.requisition_lines:
+ raise UserError('Sudah digenerate sebelumnya, hapus line terlebih dahulu')
+ if not self.sale_order_id:
+ raise UserError('Sale Order harus diisi')
+ if self.is_po:
+ raise UserError('Sudah jadi PO, tidak bisa di create ulang PO nya')
+
+ count = 0
+ for order_line in self.sale_order_id.order_line:
+ # get purchase price altama, if nothing, then get other cheaper, if nothing then last po
+ purchase_price = order_line.purchase_price
+ vendor_id = order_line.vendor_id.id
+
+ # get qty available bandengan
+ qty_available = order_line.product_id.qty_onhand_bandengan + order_line.product_id.qty_incoming_bandengan - order_line.product_id.outgoing_qty
+ suggest = 'harus beli'
+ if qty_available > order_line.product_qty:
+ suggest = 'masih cukup'
+
+ self.env['requisition.line'].create([{
+ 'requisition_id': self.id,
+ 'partner_id': vendor_id,
+ 'brand_id': order_line.product_id.product_tmpl_id.x_manufacture.id,
+ 'product_id': order_line.product_id.id,
+ 'qty_purchase': order_line.product_uom_qty,
+ 'tax_id': order_line.purchase_tax_id.id,
+ 'price_unit': purchase_price,
+ 'subtotal': purchase_price * order_line.product_uom_qty,
+ 'source': 'sales',
+ 'qty_available_store': qty_available,
+ 'suggest': suggest,
+ }])
+ count+=1
+ _logger.info('Create Requisition %s' % order_line.product_id.name)
+ self.notification = "Requisition Created %s lines" % count
+
def create_requisition_from_sales(self):
if self.requisition_lines:
raise UserError('Sudah digenerate sebelumnya, hapus line terlebih dahulu')
@@ -44,6 +81,12 @@ class Requisition(models.Model):
purchase_price = 0
vendor_id = 0
+ # get qty available bandengan
+ qty_available = order_line.product_id.qty_onhand_bandengan + order_line.product_id.qty_incoming_bandengan - order_line.product_id.outgoing_qty
+ suggest = 'harus beli'
+ if qty_available > order_line.product_qty:
+ suggest = 'masih cukup'
+
purchase_pricelist = self.env['purchase.pricelist'].search([
('product_id.id', '=', order_line.product_id.id),
('vendor_id.id', '=', 5571)
@@ -78,7 +121,9 @@ class Requisition(models.Model):
'tax_id': order_line.purchase_tax_id.id,
'price_unit': purchase_price,
'subtotal': purchase_price * order_line.product_uom_qty,
- 'source': source
+ 'source': source,
+ 'qty_available_store': qty_available,
+ 'suggest': suggest,
}])
count+=1
_logger.info('Create Requisition %s' % order_line.product_id.name)
@@ -127,6 +172,12 @@ class Requisition(models.Model):
# new_po = self.env['purchase.order'].create([param_header])
brand_id = product.brand_id.id
count += 10
+
+ qty_available = product.product_id.qty_onhand_bandengan + product.product_id.qty_incoming_bandengan - product.product_id.outgoing_qty
+ suggest = 'harus beli'
+ if qty_available > product.qty_purchase:
+ suggest = 'masih cukup'
+
param_line = {
'order_id': new_po.id,
'sequence': count,
@@ -134,7 +185,9 @@ class Requisition(models.Model):
'product_qty': product.qty_purchase,
'product_uom_qty': product.qty_purchase,
'price_unit': product.last_price,
- 'taxes_id': product.tax_id
+ 'taxes_id': product.tax_id,
+ 'qty_available_store': qty_available,
+ 'suggest': suggest,
}
new_line = self.env['purchase.order.line'].create([param_line])
product.current_po_id = new_po.id
@@ -163,6 +216,12 @@ class RequisitionLine(models.Model):
current_po_id = fields.Many2one('purchase.order', string='Current')
current_po_line_id = fields.Many2one('purchase.order.line', string='Current Line')
source = fields.Char(string='Source', help='data harga diambil darimana')
+ qty_available_store = fields.Float(string='Available')
+ suggest = fields.Char(string='Suggest')
+
+ @api.onchange('price_unit')
+ def _onchange_price_unit(self):
+ self.subtotal = self.price_unit * self.qty_purchase
class RequisitionPurchaseMatch(models.Model):
_name = 'requisition.purchase.match'
diff --git a/indoteknik_custom/models/sale_monitoring_detail.py b/indoteknik_custom/models/sale_monitoring_detail.py
index 2bcda50c..43a8aeb0 100755
--- a/indoteknik_custom/models/sale_monitoring_detail.py
+++ b/indoteknik_custom/models/sale_monitoring_detail.py
@@ -22,6 +22,7 @@ class SaleMonitoringDetail(models.Model):
date_order = fields.Datetime(string="Date Order")
status = fields.Char(string="Status")
qty_reserved = fields.Integer(string="Qty Reserved")
+ note = fields.Char(string="Note")
def init(self):
tools.drop_view_if_exists(self.env.cr, self._table)
@@ -52,7 +53,8 @@ class SaleMonitoringDetail(models.Model):
so.date_order AS date_order,
get_qty_po(so.id, sol.product_id) AS qty_po,
get_qty_received(so.id, sol.product_id) AS qty_po_received,
- get_qty_reserved(so.id, sol.product_id) as qty_reserved
+ get_qty_reserved(so.id, sol.product_id) as qty_reserved,
+ sol.note_procurement as note
FROM sale_order so
JOIN sale_order_line sol ON sol.order_id = so.id
JOIN product_product p ON p.id = sol.product_id
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index a17cf7c8..1a16f462 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -70,7 +70,7 @@ class SaleOrder(models.Model):
('partial_refund', 'Partial Refund'),
('partial_chargeback', 'Partial Chargeback'),
('authorize', 'Authorize'),
- ], string='Payment Status', help='Payment Gateway Status / Midtrans / Web, https://docs.midtrans.com/en/after-payment/status-cycle')
+ ], tracking=True, string='Payment Status', help='Payment Gateway Status / Midtrans / Web, https://docs.midtrans.com/en/after-payment/status-cycle')
date_doc_kirim = fields.Datetime(string='Tanggal Kirim di SJ', help="Tanggal Kirim di cetakan SJ yang terakhir, tidak berpengaruh ke Accounting")
payment_type = fields.Char(string='Payment Type', help='Jenis pembayaran dengan Midtrans')
gross_amount = fields.Float(string='Gross Amount', help='Jumlah pembayaran yang dilakukan dengan Midtrans')
@@ -130,6 +130,16 @@ class SaleOrder(models.Model):
line_no += 1
line.line_no = line_no
# _logger.info('Calculate PO Line No %s' % line.id)
+
+ def write(self, vals):
+ res = super(SaleOrder, self).write(vals)
+
+ if 'carrier_id' in vals:
+ for picking in self.picking_ids:
+ if picking.state == 'assigned':
+ picking.carrier_id = self.carrier_id
+
+ return res
def calculate_so_status_beginning(self):
so_state = ['sale']
@@ -467,7 +477,7 @@ class SaleOrder(models.Model):
# must add product can sell validation
if not line.product_id.product_tmpl_id.sale_ok:
raise UserError('Product %s belum bisa dijual, harap hubungi finance' % line.product_id.display_name)
- if line.product_id.id == 232383:
+ if line.product_id.id == 224484:
raise UserError(_('Tidak bisa Confirm menggunakan Produk Sementara'))
if not line.vendor_id or not line.purchase_price or not line.purchase_tax_id:
raise UserError(_('Isi Vendor, Harga Beli, dan Tax sebelum Request Approval'))
@@ -572,6 +582,7 @@ class SaleOrderLine(models.Model):
delivery_amt_line = fields.Float('DeliveryAmtLine', compute='compute_delivery_amt_line')
fee_third_party_line = fields.Float('FeeThirdPartyLine', compute='compute_fee_third_party_line', default=0)
line_no = fields.Integer('No', default=0, copy=False)
+ note_procurement = fields.Char(string='Note', help="Harap diisi jika ada keterangan tambahan dari Procurement, agar dapat dimonitoring")
def compute_item_margin(self):
for line in self:
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index c8424121..a14e71a3 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -54,6 +54,11 @@ class StockPicking(models.Model):
('approved', 'Approved'),
], string='Approval Status', readonly=True, copy=False, index=True, tracking=3, help="Approval Status untuk Internal Use")
+ approval_receipt_status = fields.Selection([
+ ('pengajuan1', 'Approval Logistic'),
+ ('approved', 'Approved'),
+ ], string='Approval Receipt Status', readonly=True, copy=False, index=True, tracking=3, help="Approval Status untuk Receipt")
+
approval_return_status = fields.Selection([
('pengajuan1', 'Approval Finance'),
('approved', 'Approved'),
@@ -184,17 +189,18 @@ class StockPicking(models.Model):
if self.env.user.is_accounting:
raise UserError("Bisa langsung Validate")
- if self.is_internal_use:
- stock_move_lines = self.env['stock.move.line'].search([
- ('picking_id', '!=', False),
- ('product_id', '=', 236805),
- ('picking_id.partner_id', '=', self.partner_id.id),
- ('qty_done', '>', 0),
- ])
- list_state = ['confirmed', 'done']
- for stock_move_line in stock_move_lines:
- if stock_move_line.picking_id.state not in list_state:
- continue
+ # for calendar distribute only
+ # if self.is_internal_use:
+ # stock_move_lines = self.env['stock.move.line'].search([
+ # ('picking_id', '!=', False),
+ # ('product_id', '=', 236805),
+ # ('picking_id.partner_id', '=', self.partner_id.id),
+ # ('qty_done', '>', 0),
+ # ])
+ # list_state = ['confirmed', 'done']
+ # for stock_move_line in stock_move_lines:
+ # if stock_move_line.picking_id.state not in list_state:
+ # continue
# raise UserError('Sudah pernah dikirim kalender')
for pick in self:
@@ -205,6 +211,12 @@ class StockPicking(models.Model):
raise UserError("Qty tidak boleh 0")
pick.approval_status = 'pengajuan1'
+ def ask_receipt_approval(self):
+ if self.env.user.is_logistic_approver:
+ raise UserError('Bisa langsung validate tanpa Ask Receipt')
+ else:
+ self.approval_receipt_status = 'pengajuan1'
+
def ask_return_approval(self):
for pick in self:
if self.env.user.is_accounting:
@@ -264,30 +276,41 @@ class StockPicking(models.Model):
if self.is_internal_use and not self.env.user.is_accounting:
raise UserError("Harus di Approve oleh Accounting")
+ if self.picking_type_id.id == 28 and not self.env.user.is_logistic_approver:
+ raise UserError("Harus di Approve oleh Logistik")
+
if self.group_id.sale_id:
if self.group_id.sale_id.payment_link_midtrans:
if self.group_id.sale_id.payment_status != 'settlement':
raise UserError('Uang belum masuk (settlement), mohon konfirmasi ke sales atau finance')
- if self.is_internal_use:
- stock_move_lines = self.env['stock.move.line'].search([
- ('picking_id', '!=', False),
- ('product_id', '=', 236805),
- ('picking_id.partner_id', '=', self.partner_id.id),
- ('qty_done', '>', 0),
- ])
- list_state = ['confirmed', 'done']
- for stock_move_line in stock_move_lines:
- if stock_move_line.picking_id.state not in list_state:
- continue
+ # for distribute calendar only
+ # if self.is_internal_use:
+ # stock_move_lines = self.env['stock.move.line'].search([
+ # ('picking_id', '!=', False),
+ # ('product_id', '=', 236805),
+ # ('picking_id.partner_id', '=', self.partner_id.id),
+ # ('qty_done', '>', 0),
+ # ])
+ # list_state = ['confirmed', 'done']
+ # for stock_move_line in stock_move_lines:
+ # if stock_move_line.picking_id.state not in list_state:
+ # continue
# raise UserError('Sudah pernah dikirim kalender')
- for line in self.move_line_ids_without_package:
- if line.move_id.sale_line_id and self.picking_type_id.code == 'outgoing':
+ if self.picking_type_id.code == 'outgoing':
+ for line in self.move_line_ids_without_package:
if line.move_id.sale_line_id.qty_delivered + line.qty_done > line.move_id.sale_line_id.product_uom_qty:
raise UserError("Qty Delivered akan lebih dari Qty SO")
+ elif self.picking_type_id.code == 'incoming':
+ for line in self.move_ids_without_package:
+ if line.purchase_line_id.qty_received + line.quantity_done > line.purchase_line_id.product_qty:
+ raise UserError('Qty Received akan lebih dari Qty PO')
- self.approval_status = 'approved'
+ if self.is_internal_use:
+ self.approval_status = 'approved'
+ elif self.picking_type_id.code == 'incoming':
+ self.approval_receipt_status = 'approved'
res = super(StockPicking, self).button_validate()
self.calculate_line_no()
diff --git a/indoteknik_custom/models/users.py b/indoteknik_custom/models/users.py
index a2074c46..14fcae98 100644
--- a/indoteknik_custom/models/users.py
+++ b/indoteknik_custom/models/users.py
@@ -5,11 +5,13 @@ from odoo.exceptions import AccessError, UserError, ValidationError
class Users(models.Model):
_inherit = 'res.users'
- is_purchasing_manager = fields.Boolean(String='Purchasing Manager', help='Berhak melakukan Approval PO')
- is_sales_manager = fields.Boolean(String='Sales Manager', help='Berhak melakukan Approval SO dengan margin 15-25')
- is_leader = fields.Boolean(String='Leader', help='Berhak Approval SO Margin < 15 dan Approval PO')
- is_accounting = fields.Boolean(String='Accounting', help='Berhak Approval Internal Use')
+ is_purchasing_manager = fields.Boolean(string='Purchasing Manager', help='Berhak melakukan Approval PO')
+ is_sales_manager = fields.Boolean(string='Sales Manager', help='Berhak melakukan Approval SO dengan margin 15-25')
+ is_leader = fields.Boolean(string='Leader', help='Berhak Approval SO Margin < 15 dan Approval PO')
+ is_accounting = fields.Boolean(string='Accounting', help='Berhak Approval Internal Use')
+ is_logistic_approver = fields.Boolean(string='Logistic Approver', help='Berhak Approval Penerimaan Barang')
def notify_internal_users(self, message, title):
users = self.search([('share', '=', False)])
- users.notify_info(message=message, title=title) \ No newline at end of file
+ users.notify_info(message=message, title=title)
+ \ No newline at end of file
diff --git a/indoteknik_custom/models/x_manufactures.py b/indoteknik_custom/models/x_manufactures.py
index 710bfe8a..e48a5367 100755
--- a/indoteknik_custom/models/x_manufactures.py
+++ b/indoteknik_custom/models/x_manufactures.py
@@ -61,13 +61,16 @@ class XManufactures(models.Model):
('cache_reset_status', '=', 'reset'),
])
for manufacture in manufactures:
- products = self.env['product.template'].search([
+ templates = 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)
+ for template in templates:
+ template.solr_flag = 2
+ _logger.info("Reset Solr Flag template to 2 %s" % template.id)
+ for variant in template.product_variant_ids:
+ variant.solr_flag = 2
+ _logger.info("Reset Solr Flag variant to 2 %s" % variant.id)
manufacture.cache_reset_status = 'done'
@api.onchange('x_name','image_promotion_1','image_promotion_2')
diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml
index 7a397ff6..5b0c99ef 100755
--- a/indoteknik_custom/views/purchase_order.xml
+++ b/indoteknik_custom/views/purchase_order.xml
@@ -24,6 +24,7 @@
<button name="po_approve"
string="Ask Approval"
type="object"
+ attrs="{'invisible': [('approval_status', '=', 'approved')]}"
/>
<button name="indoteknik_custom.action_view_uangmuka_pembelian" string="UangMuka"
type="action" attrs="{'invisible': [('approval_status', '!=', 'approved')]}"/>
diff --git a/indoteknik_custom/views/requisition.xml b/indoteknik_custom/views/requisition.xml
index 6e61ce1e..e7335a57 100644
--- a/indoteknik_custom/views/requisition.xml
+++ b/indoteknik_custom/views/requisition.xml
@@ -27,6 +27,8 @@
<field name="tax_id"/>
<field name="subtotal"/>
<field name="source"/>
+ <field name="qty_available_store"/>
+ <field name="suggest"/>
</tree>
</field>
</record>
@@ -65,6 +67,11 @@
type="object"
class="mr-2 oe_highlight"
/>
+ <button name="create_requisition_from_sales_with_price"
+ string="Create Line with Price"
+ type="object"
+ class="mr-2 oe_highlight"
+ />
<button name="create_po_from_requisition"
string="Create PO"
type="object"
@@ -96,6 +103,6 @@
<menuitem id="menu_requisition"
name="Requisition"
action="requisition_action"
- parent="menu_monitoring_in_purchase"
+ parent="purchase.menu_procurement_management"
sequence="300"/>
</odoo> \ No newline at end of file
diff --git a/indoteknik_custom/views/sale_monitoring_detail.xml b/indoteknik_custom/views/sale_monitoring_detail.xml
index 824e65e8..ce5b8e9b 100755
--- a/indoteknik_custom/views/sale_monitoring_detail.xml
+++ b/indoteknik_custom/views/sale_monitoring_detail.xml
@@ -23,6 +23,7 @@
decoration-success="status == 'Siap kirim'"
decoration-info="status == 'Delivered' or status == 'Invoiced'"
/>
+ <field name="note" optional="hide"/>
</tree>
</field>
</record>
@@ -46,6 +47,7 @@
decoration-success="status == 'Siap kirim'"
decoration-info="status == 'Delivered' or status == 'Invoiced'"
/>
+ <field name="note"/>
</group>
<group>
<field name="qty_so"/>
diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml
index ea744d8b..f4d7b04e 100755
--- a/indoteknik_custom/views/sale_order.xml
+++ b/indoteknik_custom/views/sale_order.xml
@@ -14,6 +14,7 @@
<button name="sale_order_approve"
string="Ask Approval"
type="object"
+ attrs="{'invisible': [('approval_status', 'in', ['pengajuan1', 'pengajuan2', 'approved'])]}"
/>
<button name="indoteknik_custom.action_view_uangmuka_penjualan" string="UangMuka"
type="action" attrs="{'invisible': [('approval_status', '!=', 'approved')]}"/>
@@ -67,6 +68,7 @@
"/>
<field name="purchase_tax_id" attrs="{'readonly': [('parent.approval_status', '!=', False)]}" domain="[('type_tax_use','=','purchase')]"/>
<field name="item_percent_margin"/>
+ <field name="note_procurement" optional="hide"/>
</xpath>
<xpath expr="//form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='product_id']" position="before">
<field name="line_no" readonly="1" optional="hide"/>
diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml
index 4bbdc7b8..99f0d7c0 100644
--- a/indoteknik_custom/views/stock_picking.xml
+++ b/indoteknik_custom/views/stock_picking.xml
@@ -27,10 +27,15 @@
type="object"
attrs="{'invisible': [('is_internal_use', '=', False)]}"
/>
+ <button name="ask_receipt_approval"
+ string="Received"
+ type="object"
+ attrs="{'invisible': ['|', ('state', 'in', ['done']), ('approval_receipt_status', '=', 'pengajuan1')]}"
+ />
<button name="ask_return_approval"
string="Ask Return/Acc"
type="object"
- attrs="{'invisible': ['|', ('state', '=', 'draft'), ('state', '=', 'cancel'), ('approval_return_status', '=', 'pengajuan1')]}"
+ attrs="{'invisible': ['|', ('state', 'in', ['draft', 'cancel', 'assigned']), ('approval_return_status', '=', 'pengajuan1')]}"
/>
<button name="action_create_invoice_from_mr"
string="Create Bill"
@@ -39,12 +44,6 @@
/>
</button>
<field name="backorder_id" position="after">
- <field name="is_internal_use"
- string="Internal Use"
- type="object"
- attrs="{'readonly': True}"
- force_save="1"
- />
<field name="summary_qty_detail"/>
<field name="count_line_detail"/>
</field>
@@ -53,8 +52,6 @@
</field>
<field name="origin" position="after">
<field name="date_doc_kirim"/>
- <field name="approval_status" attrs="{'invisible': [('is_internal_use', '=', False)]}"/>
- <field name="approval_return_status" attrs="{'invisible': [('approval_return_status', '=', False)]}"/>
<field name="summary_qty_operation"/>
<field name="count_line_operation"/>
<field name="account_id"
@@ -65,8 +62,19 @@
}"
/>
</field>
+ <field name="group_id" position="before">
+ <field name="is_internal_use"
+ string="Internal Use"
+ type="object"
+ attrs="{'readonly': True}"
+ force_save="1"
+ />
+ <field name="approval_status"/>
+ <field name="approval_receipt_status"/>
+ <field name="approval_return_status"/>
+ </field>
<field name="product_id" position="before">
- <field name="line_no" attrs="{'readonly': 1}"/>
+ <field name="line_no" attrs="{'readonly': 1}" optional="hide"/>
</field>
<page name="note" position="after">
<page string="E-Faktur" name="efaktur" attrs="{'invisible': [['is_internal_use', '=', False]]}">
diff --git a/indoteknik_custom/views/users.xml b/indoteknik_custom/views/users.xml
index 29d455d4..25e7f90c 100644
--- a/indoteknik_custom/views/users.xml
+++ b/indoteknik_custom/views/users.xml
@@ -11,6 +11,7 @@
<field name="is_purchasing_manager"/>
<field name="is_sales_manager"/>
<field name="is_leader"/>
+ <field name="is_logistic_approver"/>
</field>
</field>
</record>