feat(Selling): Gross Profit In Quotation (#21795)
* added valuation rate and gross_profit in quotation item table * modified code to not fetch valuation_rate manually, used set_gross_profit from selling controller
This commit is contained in:
parent
49b2b155b6
commit
18e7b60acc
@ -361,7 +361,7 @@ class SellingController(StockController):
|
||||
self.po_no = ', '.join(list(set([d.po_no for d in po_nos if d.po_no])))
|
||||
|
||||
def set_gross_profit(self):
|
||||
if self.doctype == "Sales Order":
|
||||
if self.doctype in ["Sales Order", "Quotation"]:
|
||||
for item in self.items:
|
||||
item.gross_profit = flt(((item.base_rate - item.valuation_rate) * item.stock_qty), self.precision("amount", item))
|
||||
|
||||
|
@ -1711,7 +1711,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
},
|
||||
|
||||
set_gross_profit: function(item) {
|
||||
if (this.frm.doc.doctype == "Sales Order" && item.valuation_rate) {
|
||||
if (["Sales Order", "Quotation"].includes(this.frm.doc.doctype) && item.valuation_rate) {
|
||||
var rate = flt(item.rate) * flt(this.frm.doc.conversion_rate || 1);
|
||||
item.gross_profit = flt(((rate - item.valuation_rate) * item.stock_qty), precision("amount", item));
|
||||
}
|
||||
|
@ -48,6 +48,10 @@
|
||||
"base_net_amount",
|
||||
"pricing_rules",
|
||||
"is_free_item",
|
||||
"section_break_43",
|
||||
"valuation_rate",
|
||||
"column_break_45",
|
||||
"gross_profit",
|
||||
"item_weight_details",
|
||||
"weight_per_unit",
|
||||
"total_weight",
|
||||
@ -602,12 +606,40 @@
|
||||
"label": "Against Blanket Order",
|
||||
"no_copy": 1,
|
||||
"print_hide": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_43",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "valuation_rate",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Valuation Rate",
|
||||
"no_copy": 1,
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"report_hide": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_45",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "gross_profit",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Gross Profit",
|
||||
"no_copy": 1,
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
"read_only": 1,
|
||||
"report_hide": 1
|
||||
}
|
||||
],
|
||||
"idx": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2020-03-30 18:40:28.782720",
|
||||
"modified": "2020-05-19 20:48:43.222229",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Quotation Item",
|
||||
|
Loading…
x
Reference in New Issue
Block a user