Merge branch 'develop' into FIX-ISS-22-23-06306

This commit is contained in:
Sagar Sharma 2023-04-06 15:59:32 +05:30 committed by GitHub
commit f7fb001126
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 61 additions and 34 deletions

View File

@ -497,7 +497,7 @@ def get_amount(ref_doc, payment_account=None):
if dt in ["Sales Order", "Purchase Order"]:
grand_total = flt(ref_doc.rounded_total) or flt(ref_doc.grand_total)
elif dt in ["Sales Invoice", "Purchase Invoice"]:
if not ref_doc.is_pos:
if not ref_doc.get("is_pos"):
if ref_doc.party_account_currency == ref_doc.currency:
grand_total = flt(ref_doc.outstanding_amount)
else:

View File

@ -6,6 +6,7 @@ import unittest
import frappe
from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
from erpnext.setup.utils import get_exchange_rate
@ -74,6 +75,29 @@ class TestPaymentRequest(unittest.TestCase):
self.assertEqual(pr.reference_name, si_usd.name)
self.assertEqual(pr.currency, "USD")
def test_payment_entry_against_purchase_invoice(self):
si_usd = make_purchase_invoice(
customer="_Test Supplier USD",
debit_to="_Test Payable USD - _TC",
currency="USD",
conversion_rate=50,
)
pr = make_payment_request(
dt="Purchase Invoice",
dn=si_usd.name,
recipient_id="user@example.com",
mute_email=1,
payment_gateway_account="_Test Gateway - USD",
submit_doc=1,
return_doc=1,
)
pe = pr.create_payment_entry()
pr.load_from_db()
self.assertEqual(pr.status, "Paid")
def test_payment_entry(self):
frappe.db.set_value(
"Company", "_Test Company", "exchange_gain_loss_account", "_Test Exchange Gain/Loss - _TC"

View File

@ -9,15 +9,14 @@
"production_item_tab",
"item",
"company",
"item_name",
"uom",
"quantity",
"cb0",
"is_active",
"is_default",
"allow_alternative_item",
"set_rate_of_sub_assembly_item_based_on_bom",
"project",
"quantity",
"image",
"currency_detail",
"rm_cost_as_per",
@ -27,6 +26,8 @@
"column_break_ivyw",
"currency",
"conversion_rate",
"materials_section",
"items",
"section_break_21",
"operations_section_section",
"with_operations",
@ -38,8 +39,6 @@
"operating_cost_per_bom_quantity",
"operations_section",
"operations",
"materials_section",
"items",
"scrap_section",
"scrap_items_section",
"scrap_items",
@ -59,6 +58,7 @@
"total_cost",
"base_total_cost",
"more_info_tab",
"item_name",
"description",
"column_break_27",
"has_variants",
@ -192,6 +192,7 @@
"options": "Quality Inspection Template"
},
{
"collapsible": 1,
"fieldname": "currency_detail",
"fieldtype": "Section Break",
"label": "Cost Configuration"
@ -417,7 +418,7 @@
{
"collapsible": 1,
"fieldname": "website_section",
"fieldtype": "Section Break",
"fieldtype": "Tab Break",
"label": "Website"
},
{
@ -482,7 +483,7 @@
{
"fieldname": "section_break_21",
"fieldtype": "Tab Break",
"label": "Operations & Materials"
"label": "Operations"
},
{
"fieldname": "column_break_23",
@ -605,7 +606,7 @@
"image_field": "image",
"is_submittable": 1,
"links": [],
"modified": "2023-02-13 17:31:37.504565",
"modified": "2023-04-06 12:47:58.514795",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "BOM",

View File

@ -22,17 +22,13 @@
"produced_qty",
"process_loss_qty",
"project",
"serial_no_and_batch_for_finished_good_section",
"has_serial_no",
"has_batch_no",
"column_break_17",
"serial_no",
"batch_size",
"section_break_ndpq",
"required_items",
"work_order_configuration",
"settings_section",
"allow_alternative_item",
"use_multi_level_bom",
"column_break_18",
"column_break_17",
"skip_transfer",
"from_wip_warehouse",
"update_consumed_material_cost_in_project",
@ -42,9 +38,14 @@
"column_break_12",
"fg_warehouse",
"scrap_warehouse",
"serial_no_and_batch_for_finished_good_section",
"has_serial_no",
"has_batch_no",
"column_break_18",
"serial_no",
"batch_size",
"required_items_section",
"materials_and_operations_tab",
"required_items",
"operations_section",
"operations",
"transfer_material_against",
@ -586,7 +587,11 @@
{
"fieldname": "materials_and_operations_tab",
"fieldtype": "Tab Break",
"label": "Materials & Operations"
"label": "Operations"
},
{
"fieldname": "section_break_ndpq",
"fieldtype": "Section Break"
}
],
"icon": "fa fa-cogs",
@ -594,7 +599,7 @@
"image_field": "image",
"is_submittable": 1,
"links": [],
"modified": "2023-01-03 14:16:35.427731",
"modified": "2023-04-06 12:35:12.149827",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Work Order",

View File

@ -27,7 +27,6 @@
"set_posting_time",
"inspection_required",
"apply_putaway_rule",
"items_tab",
"bom_info_section",
"from_bom",
"use_multi_level_bom",
@ -256,7 +255,7 @@
"description": "As per Stock UOM",
"fieldname": "fg_completed_qty",
"fieldtype": "Float",
"label": "For Quantity",
"label": "Finished Good Quantity ",
"oldfieldname": "fg_completed_qty",
"oldfieldtype": "Currency",
"print_hide": 1
@ -612,11 +611,7 @@
"read_only": 1
},
{
"fieldname": "items_tab",
"fieldtype": "Tab Break",
"label": "Items"
},
{
"collapsible": 1,
"fieldname": "bom_info_section",
"fieldtype": "Section Break",
"label": "BOM Info"
@ -644,8 +639,10 @@
"oldfieldtype": "Section Break"
},
{
"collapsible": 1,
"fieldname": "section_break_7qsm",
"fieldtype": "Section Break"
"fieldtype": "Section Break",
"label": "Process Loss"
},
{
"depends_on": "process_loss_percentage",
@ -677,7 +674,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2023-01-03 16:02:50.741816",
"modified": "2023-04-06 12:42:56.673180",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry",

View File

@ -245,17 +245,17 @@ class SubcontractingReceipt(SubcontractingController):
item.expense_account = expense_account
def update_status(self, status=None, update_modified=False):
if self.docstatus >= 1 and not status:
if self.docstatus == 1:
if not status:
if self.docstatus == 0:
status = "Draft"
elif self.docstatus == 1:
status = "Completed"
if self.is_return:
status = "Return"
return_against = frappe.get_doc("Subcontracting Receipt", self.return_against)
return_against.run_method("update_status")
else:
if self.per_returned == 100:
elif self.per_returned == 100:
status = "Return Issued"
elif self.status == "Draft":
status = "Completed"
elif self.docstatus == 2:
status = "Cancelled"