diff options
| author | Indoteknik . <it@fixcomart.co.id> | 2025-08-15 14:04:47 +0700 |
|---|---|---|
| committer | Indoteknik . <it@fixcomart.co.id> | 2025-08-15 14:04:47 +0700 |
| commit | b133092eb4d27174f774d96f0a090670ad694d19 (patch) | |
| tree | 106326a271941ceded00967784a13352012d95cf | |
| parent | a19a78db2e3ff278ef56007629f3d9f5e9c89110 (diff) | |
| parent | 8dd70f877c68abb3f0331e18f4652acb11e1bf84 (diff) | |
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into pum-v2
| -rw-r--r-- | indoteknik_api/controllers/api_v1/partner.py | 4 | ||||
| -rw-r--r-- | indoteknik_custom/models/mrp_production.py | 16 | ||||
| -rw-r--r-- | indoteknik_custom/models/res_partner.py | 4 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/models/tukar_guling.py | 4 | ||||
| -rw-r--r-- | indoteknik_custom/models/tukar_guling_po.py | 9 | ||||
| -rw-r--r-- | indoteknik_custom/views/tukar_guling_po.xml | 2 |
7 files changed, 23 insertions, 18 deletions
diff --git a/indoteknik_api/controllers/api_v1/partner.py b/indoteknik_api/controllers/api_v1/partner.py index 14136ca3..acec19f7 100644 --- a/indoteknik_api/controllers/api_v1/partner.py +++ b/indoteknik_api/controllers/api_v1/partner.py @@ -150,7 +150,7 @@ class Partner(controller.Controller): partner_params = self.get_request_params(request_data, { 'tax_name': ['alias:nama_wajib_pajak'], - # 'company_type_id': ['number'], + 'company_type_id': [''], 'industry_id': ['number'], 'npwp': [], 'alamat_lengkap_text': [], @@ -170,7 +170,7 @@ class Partner(controller.Controller): if 'id_user' in request_data: user_params = self.get_request_params(request_data, { 'id_user': ['required', 'number'], - # 'company_type_id': ['number'], + 'company_type_id': [''], 'industry_id': ['number'], 'tax_name': ['alias:nama_wajib_pajak'], 'npwp': [], 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/res_partner.py b/indoteknik_custom/models/res_partner.py index f260f58e..cf9fbea4 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -231,7 +231,7 @@ class ResPartner(models.Model): rec.payment_difficulty = rec.parent_id.payment_difficulty return records - @api.constrains('name') + @api.constrains('email') def _check_duplicate_name(self): for record in self: if record.name: @@ -242,7 +242,7 @@ class ResPartner(models.Model): ], limit=1) if existing_partner: - raise ValidationError(f"Nama '{record.name}' sudah digunakan oleh partner lain!") + raise ValidationError(f"Nama '{record.name}' dengan email '{record.email}' sudah digunakan oleh partner lain!") @api.constrains('npwp') def _check_npwp(self): diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index eb1c7085..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'): + 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/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index ff641f34..4b03d4b0 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -380,10 +380,6 @@ class TukarGuling(models.Model): res.message_post(body=_("CCM Created By %s") % self.env.user.name) return res - res = super(TukarGuling, self).create(vals) - res.message_post(body=_("CCM Created By %s") % self.env.user.name) - return res - def copy(self, default=None): if default is None: default = {} diff --git a/indoteknik_custom/models/tukar_guling_po.py b/indoteknik_custom/models/tukar_guling_po.py index cc1c79c0..94771f37 100644 --- a/indoteknik_custom/models/tukar_guling_po.py +++ b/indoteknik_custom/models/tukar_guling_po.py @@ -435,6 +435,15 @@ class TukarGulingPO(models.Model): if bu_put: raise UserError("❌ Tidak bisa retur BU/INPUT karena BU/PUT sudah Done!") + existing_tukar_guling = self.env['tukar.guling.po'].search([ + ('operations', '=', self.operations.id), + ('id', '!=', self.id), + ('state', '!=', 'cancel'), + ], limit=1) + + if existing_tukar_guling: + raise UserError("BU ini sudah pernah diretur oleh dokumen %s." % existing_tukar_guling.name) + picking = self.operations pick_id = self.operations.picking_type_id.id if pick_id == 75: diff --git a/indoteknik_custom/views/tukar_guling_po.xml b/indoteknik_custom/views/tukar_guling_po.xml index 1c6a86ea..548a209f 100644 --- a/indoteknik_custom/views/tukar_guling_po.xml +++ b/indoteknik_custom/views/tukar_guling_po.xml @@ -21,7 +21,7 @@ <field name="name">pengajuan.tukar.guling.po.tree</field> <field name="model">tukar.guling.po</field> <field name="arch" type="xml"> - <tree create="1" delete="1" default_order="create_date desc"> + <tree create="0" delete="1" default_order="create_date desc"> <field name="name"/> <field name="vendor_id" string="Customer"/> <field name="origin" string="PO Number"/> |
