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])))
|
self.po_no = ', '.join(list(set([d.po_no for d in po_nos if d.po_no])))
|
||||||
|
|
||||||
def set_gross_profit(self):
|
def set_gross_profit(self):
|
||||||
if self.doctype == "Sales Order":
|
if self.doctype in ["Sales Order", "Quotation"]:
|
||||||
for item in self.items:
|
for item in self.items:
|
||||||
item.gross_profit = flt(((item.base_rate - item.valuation_rate) * item.stock_qty), self.precision("amount", item))
|
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) {
|
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);
|
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));
|
item.gross_profit = flt(((rate - item.valuation_rate) * item.stock_qty), precision("amount", item));
|
||||||
}
|
}
|
||||||
|
@ -197,9 +197,9 @@ def set_expired_status():
|
|||||||
cond = "qo.docstatus = 1 and qo.status != 'Expired' and qo.valid_till < %s"
|
cond = "qo.docstatus = 1 and qo.status != 'Expired' and qo.valid_till < %s"
|
||||||
# check if those QUO have SO against it
|
# check if those QUO have SO against it
|
||||||
so_against_quo = """
|
so_against_quo = """
|
||||||
SELECT
|
SELECT
|
||||||
so.name FROM `tabSales Order` so, `tabSales Order Item` so_item
|
so.name FROM `tabSales Order` so, `tabSales Order Item` so_item
|
||||||
WHERE
|
WHERE
|
||||||
so_item.docstatus = 1 and so.docstatus = 1
|
so_item.docstatus = 1 and so.docstatus = 1
|
||||||
and so_item.parent = so.name
|
and so_item.parent = so.name
|
||||||
and so_item.prevdoc_docname = qo.name"""
|
and so_item.prevdoc_docname = qo.name"""
|
||||||
|
@ -48,6 +48,10 @@
|
|||||||
"base_net_amount",
|
"base_net_amount",
|
||||||
"pricing_rules",
|
"pricing_rules",
|
||||||
"is_free_item",
|
"is_free_item",
|
||||||
|
"section_break_43",
|
||||||
|
"valuation_rate",
|
||||||
|
"column_break_45",
|
||||||
|
"gross_profit",
|
||||||
"item_weight_details",
|
"item_weight_details",
|
||||||
"weight_per_unit",
|
"weight_per_unit",
|
||||||
"total_weight",
|
"total_weight",
|
||||||
@ -602,12 +606,40 @@
|
|||||||
"label": "Against Blanket Order",
|
"label": "Against Blanket Order",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"print_hide": 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,
|
"idx": 1,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-03-30 18:40:28.782720",
|
"modified": "2020-05-19 20:48:43.222229",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Selling",
|
"module": "Selling",
|
||||||
"name": "Quotation Item",
|
"name": "Quotation Item",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user