diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2025-09-15 11:02:48 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2025-09-15 11:02:48 +0000 |
| commit | 3e064e9bbc070260943f2c3ba4055a8831a2b158 (patch) | |
| tree | 3b740beb91ab838aa69ff2c4685135ba38ff5433 | |
| parent | 2bb9e9f01c795f3b72593c1286a9a56ea6e2e120 (diff) | |
| parent | 248c42efcc30cb55d1827bb7b1e438753ffd0898 (diff) | |
Merged in mo_po (pull request #412)
Mo po
| -rw-r--r-- | indoteknik_custom/models/manufacturing.py | 22 | ||||
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 5 |
2 files changed, 16 insertions, 11 deletions
diff --git a/indoteknik_custom/models/manufacturing.py b/indoteknik_custom/models/manufacturing.py index aea01362..f986fd4f 100644 --- a/indoteknik_custom/models/manufacturing.py +++ b/indoteknik_custom/models/manufacturing.py @@ -4,54 +4,56 @@ import logging _logger = logging.getLogger(__name__) + class Manufacturing(models.Model): _inherit = 'mrp.production' unbuild_counter = fields.Integer(string='Unbuild Counter', default=0, help='For restrict unbuild more than once') - + def action_confirm(self): if self._name != 'mrp.production': return super(Manufacturing, self).action_confirm() if not self.env.user.is_purchasing_manager: raise UserError("Hanya bisa di confirm oleh Purchasing Manager") - + # if self.location_src_id.id != 75: # raise UserError('Component Location hanya bisa di AS/Stock') # elif self.location_dest_id.id != 75: # raise UserError('Finished Product Location hanya bisa di AS/Stock') - + result = super(Manufacturing, self).action_confirm() return result - + def button_mark_done(self): if self._name != 'mrp.production': return super(Manufacturing, self).button_mark_done() # Check product category if self.product_id.categ_id.name != 'Finish Good': raise UserError('Tidak bisa di complete karna product category bukan Unit / Finish Good') - + if self.sale_order and self.sale_order.state != 'sale': raise UserError( ('Tidak bisa Mark as Done.\nSales Order "%s" (Nomor: %s) belum dikonfirmasi.') % (self.sale_order.partner_id.name, self.sale_order.name) ) - + for line in self.move_raw_ids: # if line.quantity_done > 0 and line.quantity_done != self.product_uom_qty: # raise UserError('Qty Consume per Line tidak sama dengan Qty to Produce') if line.forecast_availability != line.product_uom_qty: - raise UserError('Qty Reserved belum sesuai dengan yang seharusnya, product: %s' % line.product_id.display_name) + raise UserError( + 'Qty Reserved belum sesuai dengan yang seharusnya, product: %s' % line.product_id.display_name) result = super(Manufacturing, self).button_mark_done() return result - + def button_unbuild(self): if self._name != 'mrp.production': return super(Manufacturing, self).button_unbuild() - + if self.unbuild_counter >= 1: raise UserError('Tidak bisa unbuild lebih dari 1 kali') - + self.unbuild_counter = self.unbuild_counter + 1 result = super(Manufacturing, self).button_unbuild() diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 18811b85..98cf6ff1 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -1066,8 +1066,11 @@ class PurchaseOrder(models.Model): # sticky=True # ) + has_bom = self.product_bom_id.id + has_manufacturing = self.manufacturing_id.id + if not self.from_apo: - if not self.matches_so and not self.env.user.is_purchasing_manager and not self.env.user.is_leader: + if not self.matches_so and not self.env.user.is_purchasing_manager and not self.env.user.is_leader and not has_bom and not has_manufacturing: raise UserError("Tidak ada link dengan SO, harus di confirm oleh Purchasing Manager") send_email = False |
