Fixes based on test case
This commit is contained in:
parent
3b04cfc812
commit
c314485d55
@ -1084,7 +1084,7 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
si.items[0].price_list_rate = price_list_rate
|
si.items[0].price_list_rate = price_list_rate
|
||||||
si.items[0].margin_type = 'Percentage'
|
si.items[0].margin_type = 'Percentage'
|
||||||
si.items[0].margin_rate_or_amount = 25
|
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))
|
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):
|
def test_outstanding_amount_after_advance_jv_cancelation(self):
|
||||||
|
@ -174,7 +174,8 @@ def copy_attributes_to_variant(item, variant):
|
|||||||
|
|
||||||
# copy non no-copy fields
|
# 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':
|
if item.variant_based_on=='Manufacturer':
|
||||||
# don't copy manufacturer values if based on part no
|
# 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 (field.reqd or field.fieldname in allow_fields) and field.fieldname not in exclude_fields:
|
||||||
if variant.get(field.fieldname) != item.get(field.fieldname):
|
if variant.get(field.fieldname) != item.get(field.fieldname):
|
||||||
variant.set(field.fieldname, item.get(field.fieldname))
|
variant.set(field.fieldname, item.get(field.fieldname))
|
||||||
|
|
||||||
variant.variant_of = item.name
|
variant.variant_of = item.name
|
||||||
variant.has_variants = 0
|
variant.has_variants = 0
|
||||||
if not variant.description:
|
if not variant.description:
|
||||||
|
@ -370,8 +370,13 @@ class ProductionOrder(Document):
|
|||||||
self.actual_start_date = None
|
self.actual_start_date = None
|
||||||
self.actual_end_date = None
|
self.actual_end_date = None
|
||||||
if self.get("operations"):
|
if self.get("operations"):
|
||||||
self.actual_start_date = min([d.actual_start_time for d in self.get("operations") if d.actual_start_time])
|
actual_start_dates = [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])
|
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):
|
def delete_timesheet(self):
|
||||||
for timesheet in frappe.get_all("Timesheet", ["name"], {"production_order": self.name}):
|
for timesheet in frappe.get_all("Timesheet", ["name"], {"production_order": self.name}):
|
||||||
|
@ -53,12 +53,17 @@ class Project(Document):
|
|||||||
return frappe.get_all("Task", "*", {"project": self.name}, order_by="exp_start_date asc")
|
return frappe.get_all("Task", "*", {"project": self.name}, order_by="exp_start_date asc")
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
|
self.validate_project_name()
|
||||||
self.validate_dates()
|
self.validate_dates()
|
||||||
self.validate_weights()
|
self.validate_weights()
|
||||||
self.sync_tasks()
|
self.sync_tasks()
|
||||||
self.tasks = []
|
self.tasks = []
|
||||||
self.send_welcome_email()
|
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):
|
def validate_dates(self):
|
||||||
if self.expected_start_date and self.expected_end_date:
|
if self.expected_start_date and self.expected_end_date:
|
||||||
if getdate(self.expected_end_date) < getdate(self.expected_start_date):
|
if getdate(self.expected_end_date) < getdate(self.expected_start_date):
|
||||||
|
@ -12,7 +12,7 @@ def setup(company=None, patch=True):
|
|||||||
make_custom_fields()
|
make_custom_fields()
|
||||||
add_permissions()
|
add_permissions()
|
||||||
add_custom_roles_for_reports()
|
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()
|
add_print_formats()
|
||||||
if not patch:
|
if not patch:
|
||||||
update_address_template()
|
update_address_template()
|
||||||
|
@ -494,7 +494,7 @@ class TestSalesOrder(unittest.TestCase):
|
|||||||
so.items[0].price_list_rate = price_list_rate = 100
|
so.items[0].price_list_rate = price_list_rate = 100
|
||||||
so.items[0].margin_type = 'Percentage'
|
so.items[0].margin_type = 'Percentage'
|
||||||
so.items[0].margin_rate_or_amount = 25
|
so.items[0].margin_rate_or_amount = 25
|
||||||
so.insert()
|
so.save()
|
||||||
|
|
||||||
new_so = frappe.copy_doc(so)
|
new_so = frappe.copy_doc(so)
|
||||||
new_so.save(ignore_permissions=True)
|
new_so.save(ignore_permissions=True)
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
frappe.ui.form.on('Item Variant Settings', {
|
frappe.ui.form.on('Item Variant Settings', {
|
||||||
setup: function(frm) {
|
setup: function(frm) {
|
||||||
const allow_fields = [];
|
const allow_fields = [];
|
||||||
const exclude_fields = ["item_code", "item_name", "show_in_website", "show_variant_in_website",
|
const exclude_fields = ["naming_series", "item_code", "item_name", "show_in_website",
|
||||||
"opening_stock", "variant_of", "valuation_rate", "variant_based_on"];
|
"show_variant_in_website", "opening_stock", "variant_of", "valuation_rate", "variant_based_on"];
|
||||||
|
|
||||||
frappe.model.with_doctype('Item', () => {
|
frappe.model.with_doctype('Item', () => {
|
||||||
frappe.get_meta('Item').fields.forEach(d => {
|
frappe.get_meta('Item').fields.forEach(d => {
|
||||||
|
@ -10,8 +10,8 @@ class ItemVariantSettings(Document):
|
|||||||
def set_default_fields(self):
|
def set_default_fields(self):
|
||||||
self.fields = []
|
self.fields = []
|
||||||
fields = frappe.get_meta('Item').fields
|
fields = frappe.get_meta('Item').fields
|
||||||
exclude_fields = ["item_code", "item_name", "show_in_website", "show_variant_in_website",
|
exclude_fields = ["naming_series", "item_code", "item_name", "show_in_website",
|
||||||
"standard_rate", "opening_stock", "image", "description",
|
"show_variant_in_website", "standard_rate", "opening_stock", "image", "description",
|
||||||
"variant_of", "valuation_rate", "description", "variant_based_on",
|
"variant_of", "valuation_rate", "description", "variant_based_on",
|
||||||
"website_image", "thumbnail", "website_specifiations", "web_long_description"]
|
"website_image", "thumbnail", "website_specifiations", "web_long_description"]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user