diff --git a/stock/doctype/stock_entry/stock_entry.py b/stock/doctype/stock_entry/stock_entry.py index d08deefa2b..bce0f620d4 100644 --- a/stock/doctype/stock_entry/stock_entry.py +++ b/stock/doctype/stock_entry/stock_entry.py @@ -57,6 +57,7 @@ class DocType(StockController): self.validate_return_reference_doc() self.validate_with_material_request() self.validate_fiscal_year() + self.set_total_amount() def on_submit(self): self.update_serial_no(1) @@ -174,6 +175,9 @@ class DocType(StockController): elif self.doc.purpose != "Material Transfer": self.doc.production_order = None + def set_total_amount(self): + self.doc.total_amount = sum([flt(item.amount) for item in self.doclist.get({"parentfield": "mtn_details"})]) + def make_gl_entries(self): if not cint(webnotes.defaults.get_global_default("auto_inventory_accounting")): return @@ -220,7 +224,7 @@ class DocType(StockController): if not flt(d.incoming_rate): d.incoming_rate = self.get_incoming_rate(args) - d.amount = flt(d.qty) * flt(d.incoming_rate) + d.amount = flt(d.transfer_qty) * flt(d.incoming_rate) def get_incoming_rate(self, args): incoming_rate = 0 diff --git a/stock/doctype/stock_entry/stock_entry.txt b/stock/doctype/stock_entry/stock_entry.txt index fef710b513..d88b0b76fd 100644 --- a/stock/doctype/stock_entry/stock_entry.txt +++ b/stock/doctype/stock_entry/stock_entry.txt @@ -1,8 +1,8 @@ [ { - "creation": "2013-03-28 15:56:40", + "creation": "2013-04-09 11:43:55", "docstatus": 0, - "modified": "2013-03-29 15:31:42", + "modified": "2013-05-09 13:31:00", "modified_by": "Administrator", "owner": "Administrator" }, @@ -518,6 +518,14 @@ "read_only": 0, "width": "50%" }, + { + "doctype": "DocField", + "fieldname": "total_amount", + "fieldtype": "Currency", + "label": "Total Amount", + "options": "Company:company:default_currency", + "read_only": 1 + }, { "doctype": "DocField", "fieldname": "project_name", @@ -558,6 +566,14 @@ "read_only": 0, "reqd": 1 }, + { + "doctype": "DocField", + "fieldname": "col5", + "fieldtype": "Column Break", + "print_width": "50%", + "read_only": 0, + "width": "50%" + }, { "allow_on_submit": 0, "doctype": "DocField", @@ -576,14 +592,6 @@ "reqd": 1, "search_index": 0 }, - { - "doctype": "DocField", - "fieldname": "col5", - "fieldtype": "Column Break", - "print_width": "50%", - "read_only": 0, - "width": "50%" - }, { "allow_on_submit": 0, "doctype": "DocField",