blob: d2008608db7066c7e17c3a06e28373b0384e84ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
from odoo import models, fields, api
from odoo.exceptions import UserError
from pytz import timezone
from datetime import datetime
class ReportLogbookSJ(models.Model):
_name = 'report.logbook.sj'
name = fields.Char(string='Nomor SJ', default='Logbook SJ')
date = fields.Datetime(string='Date')
name_picking = fields.Char(string='Picking Name')
partner_id = fields.Many2one('res.partner', string='Customer')
approve_by_finance = fields.Boolean(string='Approve By Finance')
report_logbook_sj_line = fields.One2many(
comodel_name='report.logbook.sj.line',
inverse_name='report_logbook_sj_id',
string='Logbook SJ Line'
)
def approve(self):
if self.env.user.is_accounting:
self.approve_by_finance = True
else:
raise UserError('Hanya Accounting yang bisa Approve')
class ReportLogbookSJLine(models.Model):
_name = 'report.logbook.sj.line'
product_id = fields.Many2one(comodel_name='product.product', string='Product')
location_id = fields.Many2one(comodel_name='stock.location', string='From')
product_uom_qty = fields.Float(string='Reserved')
qty_done = fields.Float(string='Done')
product_uom_id = fields.Many2one('uom.uom', string='Unit of Measure')
report_logbook_sj_id = fields.Many2one('report.logbook.sj', string='Logbook SJ')
|