From 2440436fd96cc64929b4581ab7fd86cc74381443 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 19 Mar 2024 15:52:53 +0700 Subject: button upload efaktur and invoice on bills vendor --- indoteknik_custom/models/account_move.py | 24 ++++++++++++++++++++++++ indoteknik_custom/views/account_move.xml | 10 ++++++++++ 2 files changed, 34 insertions(+) diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 58e462a0..e26e8266 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -46,6 +46,30 @@ class AccountMove(models.Model): help="Dipakai untuk alamat tempel") address_invoice = fields.Char(related='real_invoice_id.street', string='Invoice Address', readonly=True) + bills_efaktur_exporter = fields.Many2one('res.users', string='Efaktur Exporter') + bills_date_efaktur = fields.Datetime(string="eFaktur Exported Date", required=False) + bills_efaktur_document = fields.Binary(string="eFaktur", required=False) + bills_invoice_exporter =fields.Many2one('res.users', string='Invoice Exporter') + bills_date_invoice = fields.Datetime(string="Invoice Exported Date", required=False) + bills_invoice_document = fields.Binary(string="Invoice", required=False) + is_invoice_uploaded = fields.Boolean(string="Is Invoice Uploaded", default=False) + is_efaktur_uploaded = fields.Boolean(string="Is eFaktur Uploaded", default=False) + + @api.constrains('bills_efaktur_document') + def _constrains_efaktur_document(self): + for move in self: + current_time = datetime.utcnow() + move.bills_date_efaktur = current_time + move.bills_efaktur_exporter = self.env.user.id + move.is_efaktur_uploaded = True + + @api.constrains('bills_invoice_document') + def _constrains_invoice_efaktur(self): + for move in self: + current_time = datetime.utcnow() + move.bills_date_invoice = current_time + move.bills_invoice_exporter = self.env.user.id + move.is_invoice_uploaded = True @api.constrains('partner_id') def _constrains_real_invoice(self): diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml index cf03809b..3ad51b70 100644 --- a/indoteknik_custom/views/account_move.xml +++ b/indoteknik_custom/views/account_move.xml @@ -13,6 +13,14 @@ + + + + + + + + @@ -93,6 +101,8 @@ + + -- cgit v1.2.3