Merge branch 'develop' into se-add-to-transit

This commit is contained in:
Anupam Kumar 2021-04-08 14:44:08 +05:30 committed by GitHub
commit 9d830255c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 9 deletions

View File

@ -5,7 +5,7 @@
from __future__ import unicode_literals
import unittest
import frappe
from frappe.utils import cstr
from frappe.utils import cstr, flt
from frappe.test_runner import make_test_records
from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import create_stock_reconciliation
from erpnext.manufacturing.doctype.bom_update_tool.bom_update_tool import update_cost
@ -81,15 +81,27 @@ class TestBOM(unittest.TestCase):
bom = frappe.copy_doc(test_records[2])
bom.insert()
# test amounts in selected currency
self.assertEqual(bom.operating_cost, 100)
self.assertEqual(bom.raw_material_cost, 351.68)
self.assertEqual(bom.total_cost, 451.68)
raw_material_cost = 0.0
op_cost = 0.0
for op_row in bom.operations:
op_cost += op_row.operating_cost
for row in bom.items:
raw_material_cost += row.amount
base_raw_material_cost = raw_material_cost * flt(bom.conversion_rate, bom.precision("conversion_rate"))
base_op_cost = op_cost * flt(bom.conversion_rate, bom.precision("conversion_rate"))
# test amounts in selected currency
self.assertEqual(bom.base_operating_cost, 6000)
self.assertEqual(bom.base_raw_material_cost, 21100.80)
self.assertEqual(bom.base_total_cost, 27100.80)
self.assertEqual(bom.operating_cost, op_cost)
self.assertEqual(bom.raw_material_cost, raw_material_cost)
self.assertEqual(bom.total_cost, raw_material_cost + op_cost)
# test amounts in selected currency
self.assertEqual(bom.base_operating_cost, base_op_cost)
self.assertEqual(bom.base_raw_material_cost, base_raw_material_cost)
self.assertEqual(bom.base_total_cost, base_raw_material_cost + base_op_cost)
def test_bom_cost_multi_uom_multi_currency_based_on_price_list(self):
frappe.db.set_value("Price List", "_Test Price List", "price_not_uom_dependent", 1)

View File

@ -47,6 +47,8 @@ class JobCard(Document):
if d.completed_qty:
self.total_completed_qty += d.completed_qty
self.total_completed_qty = flt(self.total_completed_qty, self.precision("total_completed_qty"))
def get_overlap_for(self, args, check_next_available_slot=False):
production_capacity = 1

View File

@ -17,7 +17,7 @@ frappe.ui.form.on('Global Defaults', {
method: "frappe.client.get_list",
args: {
doctype: "UOM Conversion Factor",
filters: { "category": "Length" },
filters: { "category": __("Length") },
fields: ["to_uom"],
limit_page_length: 500
},