diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-03-26 13:50:27 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-03-26 13:50:27 +0700 |
| commit | 935393a6a58b3df18f3361b36a6ea60647cd8be4 (patch) | |
| tree | e4ec9d300aff98a38a8524c209a19f970aa24f23 /indoteknik_custom/models/purchasing_job_multi_update.py | |
| parent | db1780524b1e153338ced116f786b4d712d66aca (diff) | |
| parent | b2377426bec8aa334277aac48b0b25f0dfac420f (diff) | |
Merge branch 'purchasing-job' into production
# Conflicts:
# indoteknik_custom/models/__init__.py
# indoteknik_custom/models/sale_order.py
Diffstat (limited to 'indoteknik_custom/models/purchasing_job_multi_update.py')
| -rw-r--r-- | indoteknik_custom/models/purchasing_job_multi_update.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchasing_job_multi_update.py b/indoteknik_custom/models/purchasing_job_multi_update.py new file mode 100644 index 00000000..e7f19e50 --- /dev/null +++ b/indoteknik_custom/models/purchasing_job_multi_update.py @@ -0,0 +1,31 @@ +from odoo import models, fields, _ +import logging +from odoo.exceptions import AccessError, UserError, ValidationError + +_logger = logging.getLogger(__name__) + + +class PurchasingJobMultiUpdate(models.TransientModel): + _name = 'purchasing.job.multi.update' + + def save_multi_update_purchasing_job(self): + product_ids = self._context['product_ids'] + products = self.env['v.purchasing.job'].browse(product_ids) + for product in products: + if product.status_apo == 'apo': + raise UserError('Ada Purchase Order yang statusnya APO, proses dulu') + + purchasing_job_state = self.env['purchasing.job.state'] + purchasing_job_state.create({ + 'purchasing_job_id': product.id, + 'status_apo': 'apo', + }) + apo = products.generate_request_po() + return { + 'name': _('Automatic Purchase'), + 'view_mode': 'tree,form', + 'res_model': 'automatic.purchase', + 'target': 'current', + 'type': 'ir.actions.act_window', + 'domain': [('id', '=', apo)], + }
\ No newline at end of file |
