summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/bill_receipt.py
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2023-07-17 07:38:21 +0000
committerIT Fixcomart <it@fixcomart.co.id>2023-07-17 07:38:21 +0000
commit989002aca3ed9b1e724e9b98d8ca3513ba598663 (patch)
tree521bbe0ff449b097953ca59d04a93c1bd7a90f24 /indoteknik_custom/models/bill_receipt.py
parent1dfb8f66a78e78de743772c649a5805fe54ec86e (diff)
parentbb8d8fe7824dc929634bf00f2dcc7d51630257d3 (diff)
Merged in receipt-bill (pull request #56)
add new field to receipt bill
Diffstat (limited to 'indoteknik_custom/models/bill_receipt.py')
-rw-r--r--indoteknik_custom/models/bill_receipt.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/indoteknik_custom/models/bill_receipt.py b/indoteknik_custom/models/bill_receipt.py
index 31c09b33..806edc25 100644
--- a/indoteknik_custom/models/bill_receipt.py
+++ b/indoteknik_custom/models/bill_receipt.py
@@ -16,6 +16,15 @@ class BillReceipt(models.Model):
description = fields.Text(string='Description')
validated = fields.Boolean(string="Validated", readonly=True)
bill_line = fields.One2many('bill.receipt.line', 'bill_id', string='Bill Receipt Lines')
+ grand_total = fields.Float(string="Grand Total")
+
+ def compute_amt_total_without_service(self):
+ for order in self:
+ sum_price_total = 0
+ for line in order.order_line:
+ if line.product_id.type == 'product':
+ sum_price_total += line.price_total
+ order.amount_total_without_service = sum_price_total
@api.model
def create(self, vals):
@@ -48,8 +57,33 @@ class BillReceiptLine(models.Model):
sale_order_id = fields.Many2one('sale.order', string='Sale Order')
user_id = fields.Many2one('res.users', string='Purchase Rep')
payment_term_id = fields.Many2one('account.payment.term', string='Payment Terms')
+ vendor_id = fields.Many2one('res.partner', string='Vendor')
+ date_approve = fields.Datetime(string='Confirmation Date')
+ date_planned = fields.Datetime(string='Receipt Date')
+ amount_untaxed = fields.Float(string='Untaxed Amount')
amount_total = fields.Float(string='Total')
reference = fields.Char(string='Reference')
+ partner_ref = fields.Char(string='Vendor Reference')
+
+ @api.onchange('po_id')
+ def onchange_partner_ref(self):
+ self.partner_ref = self.po_id.partner_ref
+
+ @api.onchange('po_id')
+ def onchange_vendor_id(self):
+ self.vendor_id = self.po_id.partner_id
+
+ @api.onchange('po_id')
+ def onchange_date_approve(self):
+ self.date_approve = self.po_id.date_approve
+
+ @api.onchange('po_id')
+ def onchange_date_planned(self):
+ self.date_planned = self.po_id.date_planned
+
+ @api.onchange('po_id')
+ def onchange_amount_untaxed(self):
+ self.amount_untaxed = self.po_id.amount_untaxed
@api.onchange('po_id')
def onchange_user_id(self):