summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindoteknik_custom/models/__init__.py3
-rw-r--r--indoteknik_custom/models/manufacturing.py34
2 files changed, 36 insertions, 1 deletions
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py
index 5dc9ce9e..18f46d34 100755
--- a/indoteknik_custom/models/__init__.py
+++ b/indoteknik_custom/models/__init__.py
@@ -60,4 +60,5 @@ from . import automatic_purchase
from . import apache_solr
from . import raja_ongkir
from . import procurement_monitoring_detail
-from . import brand_vendor \ No newline at end of file
+from . import brand_vendor
+from . import manufacturing
diff --git a/indoteknik_custom/models/manufacturing.py b/indoteknik_custom/models/manufacturing.py
new file mode 100644
index 00000000..e6e6592c
--- /dev/null
+++ b/indoteknik_custom/models/manufacturing.py
@@ -0,0 +1,34 @@
+from odoo import fields, models, api
+from odoo.exceptions import UserError
+import logging
+
+_logger = logging.getLogger(__name__)
+
+class Manufacturing(models.Model):
+ _inherit = 'mrp.production'
+
+ def action_confirm(self):
+ if self._name != 'mrp.production':
+ return super(Manufacturing, self).action_confirm()
+
+ 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()
+
+ 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')
+
+ result = super(Manufacturing, self).button_mark_done()
+ return result
+ \ No newline at end of file