Fixes based on test case

This commit is contained in:
Nabin Hait 2017-09-28 18:55:40 +05:30
parent 3b04cfc812
commit c314485d55
8 changed files with 22 additions and 10 deletions

View File

@ -1084,7 +1084,7 @@ class TestSalesInvoice(unittest.TestCase):
si.items[0].price_list_rate = price_list_rate
si.items[0].margin_type = 'Percentage'
si.items[0].margin_rate_or_amount = 25
si.insert()
si.save()
self.assertEqual(si.get("items")[0].rate, flt((price_list_rate*25)/100 + price_list_rate))
def test_outstanding_amount_after_advance_jv_cancelation(self):

View File

@ -174,7 +174,8 @@ def copy_attributes_to_variant(item, variant):
# copy non no-copy fields
exclude_fields = ["item_code", "item_name", "show_in_website"]
exclude_fields = ["naming_series", "item_code", "item_name", "show_in_website",
"show_variant_in_website", "opening_stock", "variant_of", "valuation_rate", "variant_based_on"]
if item.variant_based_on=='Manufacturer':
# don't copy manufacturer values if based on part no
@ -186,6 +187,7 @@ def copy_attributes_to_variant(item, variant):
if (field.reqd or field.fieldname in allow_fields) and field.fieldname not in exclude_fields:
if variant.get(field.fieldname) != item.get(field.fieldname):
variant.set(field.fieldname, item.get(field.fieldname))
variant.variant_of = item.name
variant.has_variants = 0
if not variant.description:

View File

@ -370,8 +370,13 @@ class ProductionOrder(Document):
self.actual_start_date = None
self.actual_end_date = None
if self.get("operations"):
self.actual_start_date = min([d.actual_start_time for d in self.get("operations") if d.actual_start_time])
self.actual_end_date = max([d.actual_end_time for d in self.get("operations") if d.actual_end_time])
actual_start_dates = [d.actual_start_time for d in self.get("operations") if d.actual_start_time]
if actual_start_dates:
self.actual_start_date = min(actual_start_dates)
actual_end_dates = [d.actual_end_time for d in self.get("operations") if d.actual_end_time]
if actual_end_dates:
self.actual_end_date = max(actual_end_dates)
def delete_timesheet(self):
for timesheet in frappe.get_all("Timesheet", ["name"], {"production_order": self.name}):

View File

@ -53,12 +53,17 @@ class Project(Document):
return frappe.get_all("Task", "*", {"project": self.name}, order_by="exp_start_date asc")
def validate(self):
self.validate_project_name()
self.validate_dates()
self.validate_weights()
self.sync_tasks()
self.tasks = []
self.send_welcome_email()
def validate_project_name(self):
if frappe.db.exists("Project", self.project_name):
frappe.throw(_("Project {0} already exists").format(self.project_name))
def validate_dates(self):
if self.expected_start_date and self.expected_end_date:
if getdate(self.expected_end_date) < getdate(self.expected_start_date):

View File

@ -12,7 +12,7 @@ def setup(company=None, patch=True):
make_custom_fields()
add_permissions()
add_custom_roles_for_reports()
frappe.enqueue('erpnext.regional.india.setup.add_hsn_sac_codes')
frappe.enqueue('erpnext.regional.india.setup.add_hsn_sac_codes', now=frappe.flags.in_test)
add_print_formats()
if not patch:
update_address_template()

View File

@ -494,7 +494,7 @@ class TestSalesOrder(unittest.TestCase):
so.items[0].price_list_rate = price_list_rate = 100
so.items[0].margin_type = 'Percentage'
so.items[0].margin_rate_or_amount = 25
so.insert()
so.save()
new_so = frappe.copy_doc(so)
new_so.save(ignore_permissions=True)

View File

@ -4,8 +4,8 @@
frappe.ui.form.on('Item Variant Settings', {
setup: function(frm) {
const allow_fields = [];
const exclude_fields = ["item_code", "item_name", "show_in_website", "show_variant_in_website",
"opening_stock", "variant_of", "valuation_rate", "variant_based_on"];
const exclude_fields = ["naming_series", "item_code", "item_name", "show_in_website",
"show_variant_in_website", "opening_stock", "variant_of", "valuation_rate", "variant_based_on"];
frappe.model.with_doctype('Item', () => {
frappe.get_meta('Item').fields.forEach(d => {

View File

@ -10,8 +10,8 @@ class ItemVariantSettings(Document):
def set_default_fields(self):
self.fields = []
fields = frappe.get_meta('Item').fields
exclude_fields = ["item_code", "item_name", "show_in_website", "show_variant_in_website",
"standard_rate", "opening_stock", "image", "description",
exclude_fields = ["naming_series", "item_code", "item_name", "show_in_website",
"show_variant_in_website", "standard_rate", "opening_stock", "image", "description",
"variant_of", "valuation_rate", "description", "variant_based_on",
"website_image", "thumbnail", "website_specifiations", "web_long_description"]