summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-04-15 15:14:59 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-04-15 15:14:59 +0700
commite016af1d1ab8df064cbb852965173ab2d53093dd (patch)
treece78679bec52cc2bee7da9b9aefec6436e223f87
parent28a268fde404c68706b903d4492f847310cc074e (diff)
fix bug automatic purchase and add already_paid on account move
-rw-r--r--indoteknik_custom/models/account_move.py1
-rw-r--r--indoteknik_custom/models/automatic_purchase.py13
-rw-r--r--indoteknik_custom/views/account_move.xml3
3 files changed, 11 insertions, 6 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index f80cc109..94a1ab19 100644
--- a/indoteknik_custom/models/account_move.py
+++ b/indoteknik_custom/models/account_move.py
@@ -55,6 +55,7 @@ class AccountMove(models.Model):
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)
+ already_paid = fields.Boolean(string="Sudah Dibayar?", default=False)
delivery_amt_text = fields.Char(string="Delivery Amt Terbilang", compute='compute_delivery_amt_text')
def compute_delivery_amt_text(self):
diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py
index 911e35a8..c27950fd 100644
--- a/indoteknik_custom/models/automatic_purchase.py
+++ b/indoteknik_custom/models/automatic_purchase.py
@@ -154,15 +154,15 @@ class AutomaticPurchase(models.Model):
def check_qty_po(self):
for lines in self.purchase_lines:
purchasing_job = self.env['v.purchasing.job'].search([
- ('product_id', '=', lines.product_id.id)
- ], limit=1)
+ ('product_id', 'in', [lines.product_id.id])
+ ])
po = self.env['purchase.order'].search([
- ('product_id', '=', lines.product_id.id),
- ('order_sales_match_line.sale_id', '=', lines.automatic_purchase_id.sales_match.sale_id.id),
+ ('product_id', 'in', [lines.product_id.id]),
+ # ('order_sales_match_line.sale_id', 'in', [lines.automatic_purchase_id.sales_match.sale_id.id]),
('state', 'not in', ['cancel']),
('from_apo', '=', True)
- ], limit=1)
+ ])
if not purchasing_job:
raise UserError('Beberapa product sudah terbuat po dan sudah terconfirm')
@@ -179,7 +179,8 @@ class AutomaticPurchase(models.Model):
def create_po_by_vendor(self, vendor_id):
current_time = datetime.now()
- self.check_qty_po()
+ if not self.apo_type =='reordering':
+ self.check_qty_po()
PRODUCT_PER_PO = 20
diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml
index 3ad51b70..f505ef9d 100644
--- a/indoteknik_custom/views/account_move.xml
+++ b/indoteknik_custom/views/account_move.xml
@@ -51,6 +51,9 @@
<field name="due_extension"/>
<field name="counter"/>
</field>
+ <field name="to_check" position="after">
+ <field name="already_paid"/>
+ </field>
<notebook position="inside">
<page string="Due Extension" attrs="{'invisible': [('move_type', '!=', 'out_invoice')]}">
<field name="due_line">