Merge branch 'develop' into asset_depreciation_schedule
This commit is contained in:
commit
246d3b4075
@ -684,35 +684,34 @@ class PaymentEntry(AccountsController):
|
||||
)
|
||||
|
||||
def validate_payment_against_negative_invoice(self):
|
||||
if (self.payment_type == "Pay" and self.party_type == "Customer") or (
|
||||
self.payment_type == "Receive" and self.party_type == "Supplier"
|
||||
if (self.payment_type != "Pay" or self.party_type != "Customer") and (
|
||||
self.payment_type != "Receive" or self.party_type != "Supplier"
|
||||
):
|
||||
return
|
||||
|
||||
total_negative_outstanding = sum(
|
||||
abs(flt(d.outstanding_amount)) for d in self.get("references") if flt(d.outstanding_amount) < 0
|
||||
total_negative_outstanding = sum(
|
||||
abs(flt(d.outstanding_amount)) for d in self.get("references") if flt(d.outstanding_amount) < 0
|
||||
)
|
||||
|
||||
paid_amount = self.paid_amount if self.payment_type == "Receive" else self.received_amount
|
||||
additional_charges = sum(flt(d.amount) for d in self.deductions)
|
||||
|
||||
if not total_negative_outstanding:
|
||||
if self.party_type == "Customer":
|
||||
msg = _("Cannot pay to Customer without any negative outstanding invoice")
|
||||
else:
|
||||
msg = _("Cannot receive from Supplier without any negative outstanding invoice")
|
||||
|
||||
frappe.throw(msg, InvalidPaymentEntry)
|
||||
|
||||
elif paid_amount - additional_charges > total_negative_outstanding:
|
||||
frappe.throw(
|
||||
_("Paid Amount cannot be greater than total negative outstanding amount {0}").format(
|
||||
total_negative_outstanding
|
||||
),
|
||||
InvalidPaymentEntry,
|
||||
)
|
||||
|
||||
paid_amount = self.paid_amount if self.payment_type == "Receive" else self.received_amount
|
||||
additional_charges = sum([flt(d.amount) for d in self.deductions])
|
||||
|
||||
if not total_negative_outstanding:
|
||||
frappe.throw(
|
||||
_("Cannot {0} {1} {2} without any negative outstanding invoice").format(
|
||||
_(self.payment_type),
|
||||
(_("to") if self.party_type == "Customer" else _("from")),
|
||||
self.party_type,
|
||||
),
|
||||
InvalidPaymentEntry,
|
||||
)
|
||||
|
||||
elif paid_amount - additional_charges > total_negative_outstanding:
|
||||
frappe.throw(
|
||||
_("Paid Amount cannot be greater than total negative outstanding amount {0}").format(
|
||||
total_negative_outstanding
|
||||
),
|
||||
InvalidPaymentEntry,
|
||||
)
|
||||
|
||||
def set_title(self):
|
||||
if frappe.flags.in_import and self.title:
|
||||
# do not set title dynamically if title exists during data import.
|
||||
|
@ -64,12 +64,13 @@
|
||||
"tax_withholding_net_total",
|
||||
"base_tax_withholding_net_total",
|
||||
"taxes_section",
|
||||
"tax_category",
|
||||
"taxes_and_charges",
|
||||
"column_break_58",
|
||||
"tax_category",
|
||||
"column_break_49",
|
||||
"shipping_rule",
|
||||
"column_break_49",
|
||||
"incoterm",
|
||||
"named_place",
|
||||
"section_break_51",
|
||||
"taxes",
|
||||
"totals",
|
||||
@ -1541,13 +1542,19 @@
|
||||
"fieldtype": "Link",
|
||||
"label": "Incoterm",
|
||||
"options": "Incoterm"
|
||||
},
|
||||
{
|
||||
"depends_on": "incoterm",
|
||||
"fieldname": "named_place",
|
||||
"fieldtype": "Data",
|
||||
"label": "Named Place"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-file-text",
|
||||
"idx": 204,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2022-11-25 12:44:29.935567",
|
||||
"modified": "2022-12-12 18:37:38.142688",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Purchase Invoice",
|
||||
|
@ -61,12 +61,13 @@
|
||||
"total",
|
||||
"net_total",
|
||||
"taxes_section",
|
||||
"tax_category",
|
||||
"taxes_and_charges",
|
||||
"column_break_38",
|
||||
"shipping_rule",
|
||||
"incoterm",
|
||||
"column_break_55",
|
||||
"tax_category",
|
||||
"incoterm",
|
||||
"named_place",
|
||||
"section_break_40",
|
||||
"taxes",
|
||||
"section_break_43",
|
||||
@ -2122,6 +2123,12 @@
|
||||
"fieldtype": "Link",
|
||||
"label": "Incoterm",
|
||||
"options": "Incoterm"
|
||||
},
|
||||
{
|
||||
"depends_on": "incoterm",
|
||||
"fieldname": "named_place",
|
||||
"fieldtype": "Data",
|
||||
"label": "Named Place"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-file-text",
|
||||
@ -2134,7 +2141,7 @@
|
||||
"link_fieldname": "consolidated_invoice"
|
||||
}
|
||||
],
|
||||
"modified": "2022-12-05 16:18:14.532114",
|
||||
"modified": "2022-12-12 18:34:33.409895",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice",
|
||||
|
@ -503,7 +503,7 @@ class GrossProfitGenerator(object):
|
||||
invoice_portion = 100
|
||||
elif row.invoice_portion:
|
||||
invoice_portion = row.invoice_portion
|
||||
else:
|
||||
elif row.payment_amount:
|
||||
invoice_portion = row.payment_amount * 100 / row.base_net_amount
|
||||
|
||||
if i == 0:
|
||||
|
@ -62,12 +62,13 @@
|
||||
"set_reserve_warehouse",
|
||||
"supplied_items",
|
||||
"taxes_section",
|
||||
"tax_category",
|
||||
"taxes_and_charges",
|
||||
"column_break_53",
|
||||
"tax_category",
|
||||
"column_break_50",
|
||||
"shipping_rule",
|
||||
"column_break_50",
|
||||
"incoterm",
|
||||
"named_place",
|
||||
"section_break_52",
|
||||
"taxes",
|
||||
"totals",
|
||||
@ -1256,13 +1257,19 @@
|
||||
"fieldtype": "Link",
|
||||
"label": "Incoterm",
|
||||
"options": "Incoterm"
|
||||
},
|
||||
{
|
||||
"depends_on": "incoterm",
|
||||
"fieldname": "named_place",
|
||||
"fieldtype": "Data",
|
||||
"label": "Named Place"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-file-text",
|
||||
"idx": 105,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2022-11-17 17:28:07.729943",
|
||||
"modified": "2022-12-12 18:36:37.455134",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Purchase Order",
|
||||
|
@ -40,12 +40,13 @@
|
||||
"total",
|
||||
"net_total",
|
||||
"taxes_section",
|
||||
"tax_category",
|
||||
"taxes_and_charges",
|
||||
"column_break_34",
|
||||
"tax_category",
|
||||
"column_break_36",
|
||||
"shipping_rule",
|
||||
"column_break_36",
|
||||
"incoterm",
|
||||
"named_place",
|
||||
"section_break_38",
|
||||
"taxes",
|
||||
"totals",
|
||||
@ -830,6 +831,12 @@
|
||||
"fieldtype": "Link",
|
||||
"label": "Incoterm",
|
||||
"options": "Incoterm"
|
||||
},
|
||||
{
|
||||
"depends_on": "incoterm",
|
||||
"fieldname": "named_place",
|
||||
"fieldtype": "Data",
|
||||
"label": "Named Place"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-shopping-cart",
|
||||
@ -837,7 +844,7 @@
|
||||
"index_web_pages_for_search": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2022-11-17 17:27:32.179686",
|
||||
"modified": "2022-12-12 18:35:39.740974",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Supplier Quotation",
|
||||
|
@ -347,16 +347,21 @@ class StatusUpdater(Document):
|
||||
)
|
||||
|
||||
def warn_about_bypassing_with_role(self, item, qty_or_amount, role):
|
||||
action = _("Over Receipt/Delivery") if qty_or_amount == "qty" else _("Overbilling")
|
||||
if qty_or_amount == "qty":
|
||||
msg = _("Over Receipt/Delivery of {0} {1} ignored for item {2} because you have {3} role.")
|
||||
else:
|
||||
msg = _("Overbilling of {0} {1} ignored for item {2} because you have {3} role.")
|
||||
|
||||
msg = _("{0} of {1} {2} ignored for item {3} because you have {4} role.").format(
|
||||
action,
|
||||
_(item["target_ref_field"].title()),
|
||||
frappe.bold(item["reduce_by"]),
|
||||
frappe.bold(item.get("item_code")),
|
||||
role,
|
||||
frappe.msgprint(
|
||||
msg.format(
|
||||
_(item["target_ref_field"].title()),
|
||||
frappe.bold(item["reduce_by"]),
|
||||
frappe.bold(item.get("item_code")),
|
||||
role,
|
||||
),
|
||||
indicator="orange",
|
||||
alert=True,
|
||||
)
|
||||
frappe.msgprint(msg, indicator="orange", alert=True)
|
||||
|
||||
def update_qty(self, update_modified=True):
|
||||
"""Updates qty or amount at row level
|
||||
|
@ -1154,6 +1154,36 @@ class TestWorkOrder(FrappeTestCase):
|
||||
except frappe.MandatoryError:
|
||||
self.fail("Batch generation causing failing in Work Order")
|
||||
|
||||
@change_settings("Manufacturing Settings", {"make_serial_no_batch_from_work_order": 1})
|
||||
def test_auto_serial_no_creation(self):
|
||||
from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom
|
||||
|
||||
fg_item = frappe.generate_hash(length=20)
|
||||
child_item = frappe.generate_hash(length=20)
|
||||
|
||||
bom_tree = {fg_item: {child_item: {}}}
|
||||
|
||||
create_nested_bom(bom_tree, prefix="")
|
||||
|
||||
item = frappe.get_doc("Item", fg_item)
|
||||
item.has_serial_no = 1
|
||||
item.serial_no_series = f"{item.name}.#####"
|
||||
item.save()
|
||||
|
||||
try:
|
||||
wo_order = make_wo_order_test_record(item=fg_item, qty=2, skip_transfer=True)
|
||||
serial_nos = wo_order.serial_no
|
||||
stock_entry = frappe.get_doc(make_stock_entry(wo_order.name, "Manufacture", 10))
|
||||
stock_entry.set_work_order_details()
|
||||
stock_entry.set_serial_no_batch_for_finished_good()
|
||||
for row in stock_entry.items:
|
||||
if row.item_code == fg_item:
|
||||
self.assertTrue(row.serial_no)
|
||||
self.assertEqual(sorted(get_serial_nos(row.serial_no)), sorted(get_serial_nos(serial_nos)))
|
||||
|
||||
except frappe.MandatoryError:
|
||||
self.fail("Batch generation causing failing in Work Order")
|
||||
|
||||
@change_settings(
|
||||
"Manufacturing Settings",
|
||||
{"backflush_raw_materials_based_on": "Material Transferred for Manufacture"},
|
||||
|
@ -43,12 +43,13 @@
|
||||
"total",
|
||||
"net_total",
|
||||
"taxes_section",
|
||||
"tax_category",
|
||||
"taxes_and_charges",
|
||||
"column_break_36",
|
||||
"tax_category",
|
||||
"column_break_34",
|
||||
"shipping_rule",
|
||||
"column_break_34",
|
||||
"incoterm",
|
||||
"named_place",
|
||||
"section_break_36",
|
||||
"taxes",
|
||||
"section_break_39",
|
||||
@ -1059,13 +1060,19 @@
|
||||
"fieldtype": "Link",
|
||||
"label": "Incoterm",
|
||||
"options": "Incoterm"
|
||||
},
|
||||
{
|
||||
"depends_on": "incoterm",
|
||||
"fieldname": "named_place",
|
||||
"fieldtype": "Data",
|
||||
"label": "Named Place"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-shopping-cart",
|
||||
"idx": 82,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2022-11-17 17:20:54.984348",
|
||||
"modified": "2022-12-12 18:32:28.671332",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Quotation",
|
||||
|
@ -58,12 +58,13 @@
|
||||
"total",
|
||||
"net_total",
|
||||
"taxes_section",
|
||||
"tax_category",
|
||||
"taxes_and_charges",
|
||||
"column_break_38",
|
||||
"tax_category",
|
||||
"column_break_49",
|
||||
"shipping_rule",
|
||||
"column_break_49",
|
||||
"incoterm",
|
||||
"named_place",
|
||||
"section_break_40",
|
||||
"taxes",
|
||||
"section_break_43",
|
||||
@ -1630,13 +1631,19 @@
|
||||
"fieldtype": "Link",
|
||||
"label": "Incoterm",
|
||||
"options": "Incoterm"
|
||||
},
|
||||
{
|
||||
"depends_on": "incoterm",
|
||||
"fieldname": "named_place",
|
||||
"fieldtype": "Data",
|
||||
"label": "Named Place"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-file-text",
|
||||
"idx": 105,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2022-11-17 17:22:00.413878",
|
||||
"modified": "2022-12-12 18:34:00.681780",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Sales Order",
|
||||
|
@ -57,12 +57,13 @@
|
||||
"total",
|
||||
"net_total",
|
||||
"taxes_section",
|
||||
"tax_category",
|
||||
"taxes_and_charges",
|
||||
"column_break_43",
|
||||
"tax_category",
|
||||
"column_break_39",
|
||||
"shipping_rule",
|
||||
"column_break_39",
|
||||
"incoterm",
|
||||
"named_place",
|
||||
"section_break_41",
|
||||
"taxes",
|
||||
"section_break_44",
|
||||
@ -1388,13 +1389,19 @@
|
||||
"fieldtype": "Link",
|
||||
"label": "Incoterm",
|
||||
"options": "Incoterm"
|
||||
},
|
||||
{
|
||||
"depends_on": "incoterm",
|
||||
"fieldname": "named_place",
|
||||
"fieldtype": "Data",
|
||||
"label": "Named Place"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-truck",
|
||||
"idx": 146,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2022-11-17 17:22:42.860790",
|
||||
"modified": "2022-12-12 18:38:53.067799",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Delivery Note",
|
||||
|
@ -58,12 +58,13 @@
|
||||
"total",
|
||||
"net_total",
|
||||
"taxes_charges_section",
|
||||
"tax_category",
|
||||
"taxes_and_charges",
|
||||
"shipping_col",
|
||||
"tax_category",
|
||||
"column_break_53",
|
||||
"shipping_rule",
|
||||
"column_break_53",
|
||||
"incoterm",
|
||||
"named_place",
|
||||
"taxes_section",
|
||||
"taxes",
|
||||
"totals",
|
||||
@ -1225,13 +1226,19 @@
|
||||
"fieldtype": "Link",
|
||||
"label": "Incoterm",
|
||||
"options": "Incoterm"
|
||||
},
|
||||
{
|
||||
"depends_on": "incoterm",
|
||||
"fieldname": "named_place",
|
||||
"fieldtype": "Data",
|
||||
"label": "Named Place"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-truck",
|
||||
"idx": 261,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2022-11-17 17:29:30.067536",
|
||||
"modified": "2022-12-12 18:40:32.447752",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Purchase Receipt",
|
||||
|
@ -2236,16 +2236,16 @@ class StockEntry(StockController):
|
||||
d.qty -= process_loss_dict[d.item_code][1]
|
||||
|
||||
def set_serial_no_batch_for_finished_good(self):
|
||||
serial_nos = ""
|
||||
serial_nos = []
|
||||
if self.pro_doc.serial_no:
|
||||
serial_nos = self.get_serial_nos_for_fg()
|
||||
serial_nos = self.get_serial_nos_for_fg() or []
|
||||
|
||||
for row in self.items:
|
||||
if row.is_finished_item and row.item_code == self.pro_doc.production_item:
|
||||
if serial_nos:
|
||||
row.serial_no = "\n".join(serial_nos[0 : cint(row.qty)])
|
||||
|
||||
def get_serial_nos_for_fg(self, args):
|
||||
def get_serial_nos_for_fg(self):
|
||||
fields = [
|
||||
"`tabStock Entry`.`name`",
|
||||
"`tabStock Entry Detail`.`qty`",
|
||||
@ -2261,9 +2261,7 @@ class StockEntry(StockController):
|
||||
]
|
||||
|
||||
stock_entries = frappe.get_all("Stock Entry", fields=fields, filters=filters)
|
||||
|
||||
if self.pro_doc.serial_no:
|
||||
return self.get_available_serial_nos(stock_entries)
|
||||
return self.get_available_serial_nos(stock_entries)
|
||||
|
||||
def get_available_serial_nos(self, stock_entries):
|
||||
used_serial_nos = []
|
||||
|
@ -1849,6 +1849,8 @@ Outstanding Amt,Offener Betrag,
|
||||
Outstanding Cheques and Deposits to clear,Ausstehende Schecks und Anzahlungen zum verbuchen,
|
||||
Outstanding for {0} cannot be less than zero ({1}),Ausstände für {0} können nicht kleiner als Null sein ({1}),
|
||||
Outward taxable supplies(zero rated),Steuerpflichtige Lieferungen aus dem Ausland (null bewertet),
|
||||
Over Receipt/Delivery of {0} {1} ignored for item {2} because you have {3} role.,"Überhöhte Annahme bzw. Lieferung von Artikel {2} mit {0} {1} wurde ignoriert, weil Sie die Rolle {3} haben."
|
||||
Overbilling of {0} {1} ignored for item {2} because you have {3} role.,"Überhöhte Abrechnung von Artikel {2} mit {0} {1} wurde ignoriert, weil Sie die Rolle {3} haben."
|
||||
Overdue,Überfällig,
|
||||
Overlap in scoring between {0} and {1},Überlappung beim Scoring zwischen {0} und {1},
|
||||
Overlapping conditions found between:,Überlagernde Bedingungen gefunden zwischen:,
|
||||
@ -9914,4 +9916,3 @@ Cost and Freight,Kosten und Fracht,
|
||||
Delivered at Place,Geliefert benannter Ort,
|
||||
Delivered at Place Unloaded,Geliefert benannter Ort entladen,
|
||||
Delivered Duty Paid,Geliefert verzollt,
|
||||
{0} of {1} {2} ignored for item {3} because you have {4} role,"{0} von Artikel {3} mit {1} {2} wurde ignoriert, weil Sie die Rolle {4} haben."
|
||||
|
Can't render this file because it is too large.
|
Loading…
x
Reference in New Issue
Block a user