summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2026-01-08 13:08:56 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2026-01-08 13:08:56 +0700
commit6cc1479e5ae160b24d1b682162aa4d818c8fa85c (patch)
tree2f6b0d23b640b708c927f2d70f4abc418723dc6e
parent25db6100738bb880081f229e2b4facb75c4c9417 (diff)
push bill date
-rw-r--r--fixco_custom/models/purchase_order.py3
-rw-r--r--fixco_custom/models/purchase_order_multi_bills.py1
-rw-r--r--fixco_custom/views/purchase_order.xml1
3 files changed, 4 insertions, 1 deletions
diff --git a/fixco_custom/models/purchase_order.py b/fixco_custom/models/purchase_order.py
index 746ee89..4bc9d11 100644
--- a/fixco_custom/models/purchase_order.py
+++ b/fixco_custom/models/purchase_order.py
@@ -57,6 +57,7 @@ class PurchaseOrder(models.Model):
soo_discount = fields.Float('SOO Discount', copy=False)
soo_tax = fields.Float('SOO Tax', copy=False)
discount_total = fields.Float('Discount Total', help = 'Total Discount for Each Product', copy=False, default=0.0)
+ bill_date = fields.Date('Bill Date', copy=False)
def _prepare_invoice(self):
"""Prepare the dict of values to create the new invoice for a purchase order.
@@ -72,7 +73,7 @@ class PurchaseOrder(models.Model):
invoice_vals = {
'ref': self.partner_ref or '',
'move_type': move_type,
- 'invoice_date': datetime.utcnow(),
+ 'invoice_date': self.bill_date,
'purchase_order_id': self.id,
'narration': self.notes,
'currency_id': self.currency_id.id,
diff --git a/fixco_custom/models/purchase_order_multi_bills.py b/fixco_custom/models/purchase_order_multi_bills.py
index 2a5a54a..db6a3d1 100644
--- a/fixco_custom/models/purchase_order_multi_bills.py
+++ b/fixco_custom/models/purchase_order_multi_bills.py
@@ -9,6 +9,7 @@ class PurchaeOrderMultiBills(models.TransientModel):
po_ids = self._context.get('po_ids', [])
purchase_orders = self.env['purchase.order'].browse(po_ids)
for purchase in purchase_orders:
+ purchase.bill_date = fields.Date.today()
queue_job = self.env['queue.job'].search([('res_id', '=', purchase.id), ('method_name', '=', 'action_create_invoice'), ('state', '!=', 'error')], limit=1)
if queue_job:
continue
diff --git a/fixco_custom/views/purchase_order.xml b/fixco_custom/views/purchase_order.xml
index 128224d..cb85374 100644
--- a/fixco_custom/views/purchase_order.xml
+++ b/fixco_custom/views/purchase_order.xml
@@ -44,6 +44,7 @@
<field name="shipping_cost"/>
<field name="source" readonly="1"/>
<field name="move_entry_id" readonly="1"/>
+ <field name="bill_date" readonly="1"/>
</field>
<field name="amount_untaxed" position="after">
<field name="amount_discount" class="oe_currency_line"/>