summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-03-19 15:52:53 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-03-19 15:52:53 +0700
commit2440436fd96cc64929b4581ab7fd86cc74381443 (patch)
tree0e6f1bcd58d3b6900ebddf38ea2881c400fe2310
parent3df78ee977b1800030248f561ee4f3c690bae329 (diff)
button upload efaktur and invoice on bills vendor
-rw-r--r--indoteknik_custom/models/account_move.py24
-rw-r--r--indoteknik_custom/views/account_move.xml10
2 files changed, 34 insertions, 0 deletions
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 @@
<field name="invoice_date" position="after">
<field name="payment_schedule" attrs="{'invisible': [('move_type', '!=', 'in_invoice')]}"/>
</field>
+ <field name="to_check" position="after">
+ <field name="bills_efaktur_exporter" attrs="{'invisible': [('move_type', '!=', 'in_invoice')]}" readonly="1"/>
+ <field name="bills_date_efaktur" attrs="{'invisible': [('move_type', '!=', 'in_invoice')]}" readonly="1"/>
+ <field name="bills_efaktur_document" attrs="{'invisible': [('move_type', '!=', 'in_invoice')]}" widget="pdf_viewer"/>
+ <field name="bills_invoice_exporter" attrs="{'invisible': [('move_type', '!=', 'in_invoice')]}" readonly="1"/>
+ <field name="bills_date_invoice" attrs="{'invisible': [('move_type', '!=', 'in_invoice')]}" readonly="1"/>
+ <field name="bills_invoice_document" attrs="{'invisible': [('move_type', '!=', 'in_invoice')]}" widget="pdf_viewer"/>
+ </field>
<field name="payment_reference" position="after">
<field name="date_completed" readonly="1" attrs="{'invisible': [('move_type', '!=', 'out_invoice')]}"/>
<field name="reklas_id" attrs="{'invisible': [('move_type', '!=', 'out_invoice')]}"/>
@@ -93,6 +101,8 @@
<field name="arch" type="xml">
<field name="invoice_date_due" position="after">
<field name="bill_day_to_due" string="Due Date" widget="remaining_days"/>
+ <field name="is_efaktur_uploaded" optional="hide"/>
+ <field name="is_invoice_uploaded" optional="hide"/>
</field>
<field name="invoice_date_due" position="attributes">