mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-18 12:39:18 +00:00
Merge branch 'develop' into bom_convert_uom
This commit is contained in:
@@ -144,7 +144,8 @@ def get_ref_item_dict(valid_items, ref_item_row):
|
||||
}))
|
||||
item_dict = valid_items[ref_item_row.item_code]
|
||||
item_dict["qty"] += ref_item_row.qty
|
||||
item_dict["rate"] = ref_item_row.get("rate", 0)
|
||||
if ref_item_row.get("rate", 0) > item_dict["rate"]:
|
||||
item_dict["rate"] = ref_item_row.get("rate", 0)
|
||||
|
||||
if ref_item_row.parenttype in ['Purchase Invoice', 'Purchase Receipt']:
|
||||
item_dict["received_qty"] += ref_item_row.received_qty
|
||||
|
||||
@@ -19,10 +19,10 @@ status_map = {
|
||||
["Converted", "has_customer"],
|
||||
],
|
||||
"Opportunity": [
|
||||
["Quotation", "has_active_quotation"],
|
||||
["Converted", "has_ordered_quotation"],
|
||||
["Lost", "eval:self.status=='Lost'"],
|
||||
["Lost", "has_lost_quotation"],
|
||||
["Quotation", "has_active_quotation"],
|
||||
["Converted", "has_ordered_quotation"],
|
||||
["Closed", "eval:self.status=='Closed'"]
|
||||
],
|
||||
"Quotation": [
|
||||
@@ -85,6 +85,16 @@ status_map = {
|
||||
["Completed", "eval:self.per_billed == 100 and self.docstatus == 1"],
|
||||
["Cancelled", "eval:self.docstatus==2"],
|
||||
["Closed", "eval:self.status=='Closed'"],
|
||||
],
|
||||
"Material Request": [
|
||||
["Draft", None],
|
||||
["Stopped", "eval:self.status == 'Stopped'"],
|
||||
["Cancelled", "eval:self.docstatus == 2"],
|
||||
["Pending", "eval:self.status != 'Stopped' and self.per_ordered == 0 and self.docstatus == 1"],
|
||||
["Partially Ordered", "eval:self.status != 'Stopped' and self.per_ordered < 100 and self.per_ordered > 0 and self.docstatus == 1"],
|
||||
["Ordered", "eval:self.status != 'Stopped' and self.per_ordered == 100 and self.docstatus == 1 and self.material_request_type == 'Purchase'"],
|
||||
["Transferred", "eval:self.status != 'Stopped' and self.per_ordered == 100 and self.docstatus == 1 and self.material_request_type == 'Material Transfer'"],
|
||||
["Issued", "eval:self.status != 'Stopped' and self.per_ordered == 100 and self.docstatus == 1 and self.material_request_type == 'Material Issue'"]
|
||||
]
|
||||
}
|
||||
|
||||
@@ -127,7 +137,8 @@ class StatusUpdater(Document):
|
||||
self.status = s[0]
|
||||
break
|
||||
|
||||
if self.status != _status and self.status not in ("Submitted", "Cancelled"):
|
||||
if self.status != _status and self.status not in ("Cancelled", "Partially Ordered",
|
||||
"Ordered", "Issued", "Transferred"):
|
||||
self.add_comment("Label", _(self.status))
|
||||
|
||||
if update:
|
||||
|
||||
@@ -440,16 +440,16 @@ class calculate_taxes_and_totals(object):
|
||||
self.doc.conversion_rate, self.doc.precision("grand_total")) - self.doc.total_advance
|
||||
- flt(self.doc.base_write_off_amount), self.doc.precision("grand_total"))
|
||||
|
||||
if self.doc.doctype == "Sales Invoice":
|
||||
if self.doc.doctype == "Sales Invoice":
|
||||
self.doc.round_floats_in(self.doc, ["paid_amount"])
|
||||
paid_amount = self.doc.paid_amount \
|
||||
if self.doc.party_account_currency == self.doc.currency else self.doc.base_paid_amount
|
||||
|
||||
change_amount = self.doc.change_amount \
|
||||
if self.doc.party_account_currency == self.doc.currency else self.doc.base_change_amount
|
||||
|
||||
self.calculate_write_off_amount()
|
||||
self.calculate_change_amount()
|
||||
|
||||
paid_amount = self.doc.paid_amount \
|
||||
if self.doc.party_account_currency == self.doc.currency else self.doc.base_paid_amount
|
||||
|
||||
change_amount = self.doc.change_amount \
|
||||
if self.doc.party_account_currency == self.doc.currency else self.doc.base_change_amount
|
||||
|
||||
self.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount) +
|
||||
flt(change_amount), self.doc.precision("outstanding_amount"))
|
||||
@@ -462,7 +462,8 @@ class calculate_taxes_and_totals(object):
|
||||
|
||||
if self.doc.is_pos:
|
||||
for payment in self.doc.get('payments'):
|
||||
payment.base_amount = flt(payment.amount * self.doc.conversion_rate)
|
||||
payment.amount = flt(payment.amount)
|
||||
payment.base_amount = payment.amount * flt(self.doc.conversion_rate)
|
||||
paid_amount += payment.amount
|
||||
base_paid_amount += payment.base_amount
|
||||
elif not self.doc.is_return:
|
||||
@@ -474,7 +475,9 @@ class calculate_taxes_and_totals(object):
|
||||
def calculate_change_amount(self):
|
||||
self.doc.change_amount = 0.0
|
||||
self.doc.base_change_amount = 0.0
|
||||
if self.doc.paid_amount > self.doc.grand_total:
|
||||
if self.doc.paid_amount > self.doc.grand_total and not self.doc.is_return \
|
||||
and any([d.type == "Cash" for d in self.doc.payments]):
|
||||
|
||||
self.doc.change_amount = flt(self.doc.paid_amount - self.doc.grand_total +
|
||||
self.doc.write_off_amount, self.doc.precision("change_amount"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user