From b4cb2913b26644f11abc6f9ea73912a6d3072918 Mon Sep 17 00:00:00 2001 From: IT Fixcomart Date: Thu, 1 Sep 2022 17:04:28 +0700 Subject: Faktur Pajak di Internal Use --- indoteknik_custom/models/stock_picking.py | 29 +++++++++++++++++++++++++++-- indoteknik_custom/views/stock_picking.xml | 11 +++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 9b5f0036..5142bc5f 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -3,10 +3,35 @@ from odoo import fields, models, api class StockPicking(models.Model): _inherit = 'stock.picking' - is_internal_use = fields.Boolean('Internal Use', help="flag which is internal use or not") - account_id = fields.Many2one('account.account', string="Account") + is_internal_use = fields.Boolean('Internal Use', help='flag which is internal use or not') + account_id = fields.Many2one('account.account', string='Account') + efaktur_id = fields.Many2one('vit.efaktur', string='Faktur Pajak') + is_efaktur_exported = fields.Boolean(string='Is eFaktur Exported') + date_efaktur_exported = fields.Datetime(string='eFaktur Exported Date') @api.onchange('picking_type_id') def _onchange_operation_type(self): self.is_internal_use = self.picking_type_id.is_internal_use return + + @api.model + def create(self, vals): + self._use_faktur(vals) + return super(StockPicking, self).create(vals) + + def write(self, vals): + self._use_faktur(vals) + return super(StockPicking, self).write(vals) + + def _use_faktur(self, vals): + if vals.get('efaktur_id', False): + self.env['vit.efaktur'].search( + [ + ('id', '=', vals['efaktur_id']) + ], + limit=1 + ).is_used = True + + if self.efaktur_id.id != vals['efaktur_id']: + self.efaktur_id.is_used = False + return True diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index 9081a58e..0a8dba0b 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -23,6 +23,17 @@ }" /> + + + + + + + + + + + -- cgit v1.2.3 From 8fcc5cb618d189c3fd85d5cdf8860b893f89de88 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 8 Sep 2022 15:16:50 +0700 Subject: remove faktur pajak internal use (digunggung per bulan) --- indoteknik_custom/models/stock_picking.py | 28 +++------------------------- indoteknik_custom/views/stock_picking.xml | 11 ----------- 2 files changed, 3 insertions(+), 36 deletions(-) diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 5142bc5f..2dea13b5 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -5,33 +5,11 @@ class StockPicking(models.Model): _inherit = 'stock.picking' is_internal_use = fields.Boolean('Internal Use', help='flag which is internal use or not') account_id = fields.Many2one('account.account', string='Account') - efaktur_id = fields.Many2one('vit.efaktur', string='Faktur Pajak') - is_efaktur_exported = fields.Boolean(string='Is eFaktur Exported') - date_efaktur_exported = fields.Datetime(string='eFaktur Exported Date') + # efaktur_id = fields.Many2one('vit.efaktur', string='Faktur Pajak') + # is_efaktur_exported = fields.Boolean(string='Is eFaktur Exported') + # date_efaktur_exported = fields.Datetime(string='eFaktur Exported Date') @api.onchange('picking_type_id') def _onchange_operation_type(self): self.is_internal_use = self.picking_type_id.is_internal_use return - - @api.model - def create(self, vals): - self._use_faktur(vals) - return super(StockPicking, self).create(vals) - - def write(self, vals): - self._use_faktur(vals) - return super(StockPicking, self).write(vals) - - def _use_faktur(self, vals): - if vals.get('efaktur_id', False): - self.env['vit.efaktur'].search( - [ - ('id', '=', vals['efaktur_id']) - ], - limit=1 - ).is_used = True - - if self.efaktur_id.id != vals['efaktur_id']: - self.efaktur_id.is_used = False - return True diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index 0a8dba0b..9081a58e 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -23,17 +23,6 @@ }" /> - - - - - - - - - - - -- cgit v1.2.3