summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/gudang_service.py
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models/gudang_service.py')
-rw-r--r--indoteknik_custom/models/gudang_service.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/indoteknik_custom/models/gudang_service.py b/indoteknik_custom/models/gudang_service.py
new file mode 100644
index 00000000..a84f5c8a
--- /dev/null
+++ b/indoteknik_custom/models/gudang_service.py
@@ -0,0 +1,37 @@
+from odoo import models, fields, api, _
+from odoo.exceptions import UserError, ValidationError
+import logging
+from datetime import datetime
+from collections import defaultdict
+
+
+class GudangService(models.Model):
+ _name = "gudang.service"
+ _description = "Gudang Service"
+ _inherit = ['mail.thread', 'mail.activity.mixin']
+
+ name = fields.Char('Name', readonly=True)
+ partner_id = fields.Many2one('res.partner', string='Customer', readonly=True)
+ origin = fields.Char(string='Origin SO')
+ picking_id = fields.Many2one('stock.picking', string = 'Picking ID')
+ # origin_so = fields.Many2one('sale.order', string='Origin SO', compute='_compute_origin_so')
+ date = fields.Datetime('Date', default=fields.Datetime.now, required=True)
+ gudang_service_lines = fields.One2many('gudang.service.line', 'gudang_service_id', string='Gudang Service Lines')
+
+ @api.model
+ def create(self, vals):
+ if not vals.get('name') or vals['name'] == 'New':
+ vals['name'] = self.env['ir.sequence'].next_by_code('gudang.service')
+ return super(GudangService, self).create(vals)
+
+
+class GudangServiceLine(models.Model):
+ _name = "gudang.service.line"
+ _description = "Gudang Service Line"
+ _inherit = ['mail.thread', 'mail.activity.mixin']
+
+ product_id = fields.Many2one('product.product', string='Product')
+ quantity = fields.Float(string='Quantity')
+ picking_id = fields.Many2one('stock.picking', string = 'Nomor Picking')
+ # origin_so = fields.Many2one('sale.order', string='Origin SO', compute='_compute_origin_so')
+ gudang_service_id = fields.Many2one('gudang.service', string='Gudang Service ID') \ No newline at end of file