summaryrefslogtreecommitdiff
path: root/indoteknik_custom
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-08-16 14:28:37 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-08-16 14:28:37 +0700
commit67816f01ee3c9ed5e550bbb2d515d51a97e291ad (patch)
tree07ff5e19308074a2aaa20aad971f843e76aa80df /indoteknik_custom
parente534cd541152921e9f041176ab18b86172367fa9 (diff)
parent2e1c1c057b76964f4c919371209c1216df53f222 (diff)
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into odoo-backup
Diffstat (limited to 'indoteknik_custom')
-rw-r--r--indoteknik_custom/models/mrp_production.py16
-rw-r--r--indoteknik_custom/models/stock_picking.py2
-rw-r--r--indoteknik_custom/models/user_company_request.py10
3 files changed, 17 insertions, 11 deletions
diff --git a/indoteknik_custom/models/mrp_production.py b/indoteknik_custom/models/mrp_production.py
index 91da0597..b39995b5 100644
--- a/indoteknik_custom/models/mrp_production.py
+++ b/indoteknik_custom/models/mrp_production.py
@@ -263,7 +263,7 @@ class CheckBomProduct(models.Model):
"The product '%s' tidak ada di operations. "
) % record.product_id.display_name)
- total_qty_in_moves = sum(moves.mapped('product_uom_qty'))
+ total_qty_in_moves = sum(moves.mapped('quantity_done'))
# Find existing lines for the same product, excluding the current line
existing_lines = record.production_id.check_bom_product_lines.filtered(
@@ -273,15 +273,15 @@ class CheckBomProduct(models.Model):
if existing_lines:
total_quantity = sum(existing_lines.mapped('quantity'))
- if total_quantity > total_qty_in_moves:
+ if total_quantity != total_qty_in_moves:
raise UserError((
- "Quantity Product '%s' kurang dari quantity demand."
+ "Quantity Product '%s' harus sama dengan quantity consumed."
) % (record.product_id.display_name))
else:
# Check if the quantity exceeds the allowed total
- if record.quantity > total_qty_in_moves:
+ if record.quantity != total_qty_in_moves:
raise UserError((
- "Quantity Product '%s' kurang dari quantity demand."
+ "Quantity Product '%s' harus sama dengan quantity consumed."
) % (record.product_id.display_name))
# Set the quantity to the entered value
@@ -446,7 +446,7 @@ class CheckBomProduct(models.Model):
"The product '%s' tidak ada di operations. "
) % record.product_id.display_name)
- total_qty_in_moves = sum(moves.mapped('product_uom_qty'))
+ total_qty_in_moves = sum(moves.mapped('quantity_done'))
# Find existing lines for the same product, excluding the current line
existing_lines = record.production_id.check_bom_product_lines.filtered(
@@ -462,13 +462,13 @@ class CheckBomProduct(models.Model):
if total_quantity > total_qty_in_moves:
raise UserError((
- "Quantity Product '%s' sudah melebihi quantity demand."
+ "Quantity Product '%s' sudah melebihi quantity consumed."
) % (record.product_id.display_name))
else:
# Check if the quantity exceeds the allowed total
if record.quantity == total_qty_in_moves:
raise UserError((
- "Quantity Product '%s' sudah melebihi quantity demand."
+ "Quantity Product '%s' sudah melebihi quantity consumed."
) % (record.product_id.display_name))
# Set the quantity to the entered value
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index bf6834d0..d63c5d4c 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -1060,7 +1060,7 @@ class StockPicking(models.Model):
self.sale_id.date_doc_kirim = self.date_doc_kirim
def action_assign(self):
- if self.env.context.get('default_picking_type_id') and self.sale_id:
+ if self.env.context.get('default_picking_type_id') and ('BU/INPUT' not in self.name or 'BU/PUT' not in self.name):
pickings_to_assign = self.filtered(
lambda p: not (p.sale_id and p.sale_id.hold_outgoing)
)
diff --git a/indoteknik_custom/models/user_company_request.py b/indoteknik_custom/models/user_company_request.py
index 9216e8eb..284575aa 100644
--- a/indoteknik_custom/models/user_company_request.py
+++ b/indoteknik_custom/models/user_company_request.py
@@ -1,6 +1,9 @@
from odoo import models, fields, api
from odoo.exceptions import UserError
from odoo.http import request
+import logging
+
+_logger = logging.getLogger(__name__)
class UserCompanyRequest(models.Model):
_name = 'user.company.request'
@@ -65,8 +68,8 @@ class UserCompanyRequest(models.Model):
is_approve = vals.get('is_approve')
is_internal_input = vals.get('internal_input')
is_company_id = vals.get('user_company_id')
- if self.is_approve and is_approve:
- raise UserError('Tidak dapat mengubah approval yang sudah diisi')
+ # if self.is_approve and is_approve:
+ # raise UserError('Tidak dapat mengubah approval yang sudah diisi')
if is_internal_input:
if self.user_company_id.nama_wajib_pajak == self.user_company_id.name:
@@ -75,6 +78,7 @@ class UserCompanyRequest(models.Model):
user_company_id = []
if is_company_id:
user_company_id = request.env['res.partner'].search([('id', '=', is_company_id)], limit=1)
+ _logger.info('User Company ID: %s', user_company_id)
# self.user_company_id.customer_type = self.similar_company_ids.customer_type
# self.user_company_id.npwp = self.similar_company_ids.npwp
# self.user_company_id.sppkp = self.similar_company_ids.sppkp
@@ -101,6 +105,8 @@ class UserCompanyRequest(models.Model):
self.user_id.property_account_payable_id = user_company_id.property_account_payable_id if user_company_id else self.user_company_id.property_account_payable_id
self.user_id.property_payment_term_id = user_company_id.property_payment_term_id if user_company_id else self.user_company_id.property_payment_term_id
self.user_id.property_supplier_payment_term_id = user_company_id.property_supplier_payment_term_id if user_company_id else self.user_company_id.property_supplier_payment_term_id
+ # self.user_id.is_company = True
+ # self.user_id.active = True
self.user_company_id.active = True
user.send_company_switch_approve_mail() if vals.get('is_switch_account') == True else user.send_company_request_approve_mail()
else: