summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-04-23 15:04:57 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-04-23 15:04:57 +0700
commit901ab091308ec3d575014a7c0540a0cf544702b7 (patch)
treead7caf6c9c71d37635df8e6253d81d3d93cd885c
parent9206062d88d5c243351d334cb8ade3ddc51d22ff (diff)
add new ir_sequence for account move
-rw-r--r--indoteknik_custom/models/account_move.py27
-rw-r--r--indoteknik_custom/views/account_move.xml4
-rw-r--r--indoteknik_custom/views/ir_sequence.xml11
3 files changed, 41 insertions, 1 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index 94a1ab19..22b637e9 100644
--- a/indoteknik_custom/models/account_move.py
+++ b/indoteknik_custom/models/account_move.py
@@ -57,6 +57,33 @@ class AccountMove(models.Model):
is_efaktur_uploaded = fields.Boolean(string="Is eFaktur Uploaded", default=False)
already_paid = fields.Boolean(string="Sudah Dibayar?", default=False)
delivery_amt_text = fields.Char(string="Delivery Amt Terbilang", compute='compute_delivery_amt_text')
+ so_shipping_paid_by = fields.Char(string="SO Shipping Paid By", compute='compute_so_shipping_paid_by')
+ so_shipping_covered_by = fields.Char(string="SO Shipping Covered By", compute='compute_so_shipping_paid_by')
+ so_delivery_amt = fields.Char(string="SO Delivery Amount", compute='compute_so_shipping_paid_by')
+ flag_delivery_amt = fields.Boolean(string="Flag Delivery Amount", compute='compute_flag_delivery_amt')
+ nomor_kwitansi = fields.Char(string="Nomor Kwitansi")
+
+ @api.model
+ def create(self, vals):
+ if vals['flag_delivery_amt'] == True:
+ vals['nomor_kwitansi'] = self.env['ir.sequence'].next_by_code('nomor.kwitansi') or '0'
+ else:
+ vals['nomor_kwitansi'] = None
+ result = super(AccountMove, self).create(vals)
+ return result
+
+ def compute_so_shipping_paid_by(self):
+ for record in self:
+ record.so_shipping_paid_by = record.sale_id.shipping_paid_by
+ record.so_shipping_covered_by = record.sale_id.shipping_cost_covered
+ record.so_delivery_amt = record.sale_id.delivery_amt
+
+ def compute_flag_delivery_amt(self):
+ for record in self:
+ if record.sale_id.delivery_amt > 0:
+ record.flag_delivery_amt = True
+ else:
+ record.flag_delivery_amt = False
def compute_delivery_amt_text(self):
tb = Terbilang()
diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml
index f505ef9d..606a8b24 100644
--- a/indoteknik_custom/views/account_move.xml
+++ b/indoteknik_custom/views/account_move.xml
@@ -53,6 +53,10 @@
</field>
<field name="to_check" position="after">
<field name="already_paid"/>
+ <field name="so_shipping_paid_by"/>
+ <field name="so_shipping_covered_by"/>
+ <field name="so_delivery_amt"/>
+ <field name="flag_delivery_amt"/>
</field>
<notebook position="inside">
<page string="Due Extension" attrs="{'invisible': [('move_type', '!=', 'out_invoice')]}">
diff --git a/indoteknik_custom/views/ir_sequence.xml b/indoteknik_custom/views/ir_sequence.xml
index d52f55ca..af07ba38 100644
--- a/indoteknik_custom/views/ir_sequence.xml
+++ b/indoteknik_custom/views/ir_sequence.xml
@@ -90,6 +90,15 @@
<field name="number_next">1</field>
<field name="number_increment">1</field>
</record>
-
+
+ <record id="sequence_nomor_kwitansi" model="ir.sequence">
+ <field name="name">Nomor Kwitansi</field>
+ <field name="code">nomor.kwitansi</field>
+ <field name="active">TRUE</field>
+ <field name="prefix">KWT/%(year)s/</field>
+ <field name="padding">5</field>
+ <field name="number_next">1</field>
+ <field name="number_increment">1</field>
+ </record>
</data>
</odoo> \ No newline at end of file