mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-15 11:09:17 +00:00
fix: Item wise gst sales register fix
This commit is contained in:
@@ -550,7 +550,12 @@ class SalesInvoice(SellingController):
|
|||||||
self.against_income_account = ','.join(against_acc)
|
self.against_income_account = ','.join(against_acc)
|
||||||
|
|
||||||
def add_remarks(self):
|
def add_remarks(self):
|
||||||
if not self.remarks: self.remarks = 'No Remarks'
|
if not self.remarks:
|
||||||
|
if self.po_no and self.po_date:
|
||||||
|
self.remarks = _("Against Customer Order {0} dated {1}").format(self.po_no,
|
||||||
|
formatdate(self.po_date))
|
||||||
|
else:
|
||||||
|
self.remarks = _("No Remarks")
|
||||||
|
|
||||||
def validate_auto_set_posting_time(self):
|
def validate_auto_set_posting_time(self):
|
||||||
# Don't auto set the posting date and time if invoice is amended
|
# Don't auto set the posting date and time if invoice is amended
|
||||||
@@ -1580,6 +1585,7 @@ def make_inter_company_transaction(doctype, source_name, target_doc=None):
|
|||||||
if doctype in ["Sales Invoice", "Sales Order"]:
|
if doctype in ["Sales Invoice", "Sales Order"]:
|
||||||
source_doc = frappe.get_doc(doctype, source_name)
|
source_doc = frappe.get_doc(doctype, source_name)
|
||||||
target_doctype = "Purchase Invoice" if doctype == "Sales Invoice" else "Purchase Order"
|
target_doctype = "Purchase Invoice" if doctype == "Sales Invoice" else "Purchase Order"
|
||||||
|
target_detail_field = "sales_invoice_item" if doctype == "Sales Invoice" else "sales_order_item"
|
||||||
source_document_warehouse_field = 'target_warehouse'
|
source_document_warehouse_field = 'target_warehouse'
|
||||||
target_document_warehouse_field = 'from_warehouse'
|
target_document_warehouse_field = 'from_warehouse'
|
||||||
else:
|
else:
|
||||||
@@ -1625,7 +1631,7 @@ def make_inter_company_transaction(doctype, source_name, target_doc=None):
|
|||||||
],
|
],
|
||||||
"field_map": {
|
"field_map": {
|
||||||
'rate': 'rate',
|
'rate': 'rate',
|
||||||
'name': 'sales_invoice_item'
|
'name': target_detail_field
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
|
|||||||
'company': d.company,
|
'company': d.company,
|
||||||
'sales_order': d.sales_order,
|
'sales_order': d.sales_order,
|
||||||
'delivery_note': d.delivery_note,
|
'delivery_note': d.delivery_note,
|
||||||
'income_account': d.income_account,
|
'income_account': d.unrealized_profit_loss_account or d.income_account,
|
||||||
'cost_center': d.cost_center,
|
'cost_center': d.cost_center,
|
||||||
'stock_qty': d.stock_qty,
|
'stock_qty': d.stock_qty,
|
||||||
'stock_uom': d.stock_uom
|
'stock_uom': d.stock_uom
|
||||||
@@ -379,6 +379,7 @@ def get_items(filters, additional_query_columns):
|
|||||||
select
|
select
|
||||||
`tabSales Invoice Item`.name, `tabSales Invoice Item`.parent,
|
`tabSales Invoice Item`.name, `tabSales Invoice Item`.parent,
|
||||||
`tabSales Invoice`.posting_date, `tabSales Invoice`.debit_to,
|
`tabSales Invoice`.posting_date, `tabSales Invoice`.debit_to,
|
||||||
|
`tabSales Invoice`.unrealized_profit_loss_account,
|
||||||
`tabSales Invoice`.project, `tabSales Invoice`.customer, `tabSales Invoice`.remarks,
|
`tabSales Invoice`.project, `tabSales Invoice`.customer, `tabSales Invoice`.remarks,
|
||||||
`tabSales Invoice`.territory, `tabSales Invoice`.company, `tabSales Invoice`.base_net_total,
|
`tabSales Invoice`.territory, `tabSales Invoice`.company, `tabSales Invoice`.base_net_total,
|
||||||
`tabSales Invoice Item`.item_code, `tabSales Invoice Item`.description,
|
`tabSales Invoice Item`.item_code, `tabSales Invoice Item`.description,
|
||||||
|
|||||||
@@ -419,9 +419,9 @@ def get_invoice_income_map(invoice_list):
|
|||||||
|
|
||||||
def get_internal_invoice_map(invoice_list):
|
def get_internal_invoice_map(invoice_list):
|
||||||
unrealized_amount_details = frappe.db.sql("""SELECT name, unrealized_profit_loss_account,
|
unrealized_amount_details = frappe.db.sql("""SELECT name, unrealized_profit_loss_account,
|
||||||
sum(base_net_total) as amount from `tabSales Invoice` where name in (%s)
|
base_net_total as amount from `tabSales Invoice` where name in (%s)
|
||||||
and is_internal_customer = 1 and company = represents_company""" %
|
and is_internal_customer = 1 and company = represents_company""" %
|
||||||
', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
|
', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1, debug=1)
|
||||||
|
|
||||||
internal_invoice_map = {}
|
internal_invoice_map = {}
|
||||||
for d in unrealized_amount_details:
|
for d in unrealized_amount_details:
|
||||||
|
|||||||
@@ -219,14 +219,19 @@ class BuyingController(StockController):
|
|||||||
item.valuation_rate = 0.0
|
item.valuation_rate = 0.0
|
||||||
|
|
||||||
def set_incoming_rate(self):
|
def set_incoming_rate(self):
|
||||||
if self.doctype not in ("Purchase Receipt", "Purchase Invoice"):
|
if self.doctype not in ("Purchase Receipt", "Purchase Invoice", "Purchase Order"):
|
||||||
return
|
return
|
||||||
|
|
||||||
ref_doctype = 'Delivery Note Item' if self.doctype == 'Purchase Receipt' else 'Sales Invoice Item'
|
ref_doctype_map = {
|
||||||
|
"Purchase Order": "Sales Order Item",
|
||||||
|
"Purchase Receipt": "Delivery Note Item",
|
||||||
|
"Purchase Invoice": "Purchase Invoice Item",
|
||||||
|
}
|
||||||
|
|
||||||
|
ref_doctype = ref_doctype_map.get(self.doctype)
|
||||||
items = self.get("items")
|
items = self.get("items")
|
||||||
for d in items:
|
for d in items:
|
||||||
if not cint(self.get("is_return")) and d.get("from_warehouse"):
|
if not cint(self.get("is_return")):
|
||||||
# Get outgoing rate based on original item cost based on valuation method
|
# Get outgoing rate based on original item cost based on valuation method
|
||||||
|
|
||||||
if not d.get(frappe.scrub(ref_doctype)):
|
if not d.get(frappe.scrub(ref_doctype)):
|
||||||
|
|||||||
@@ -171,8 +171,10 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
|||||||
this.frm.add_custom_button(__('Request for Raw Materials'), () => this.make_raw_material_request(), __('Create'));
|
this.frm.add_custom_button(__('Request for Raw Materials'), () => this.make_raw_material_request(), __('Create'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// make purchase order
|
// Make Purchase Order
|
||||||
|
if (!this.frm.doc.is_internal_customer) {
|
||||||
this.frm.add_custom_button(__('Purchase Order'), () => this.make_purchase_order(), __('Create'));
|
this.frm.add_custom_button(__('Purchase Order'), () => this.make_purchase_order(), __('Create'));
|
||||||
|
}
|
||||||
|
|
||||||
// maintenance
|
// maintenance
|
||||||
if(flt(doc.per_delivered, 2) < 100 && (order_is_maintenance || order_is_a_custom_sale)) {
|
if(flt(doc.per_delivered, 2) < 100 && (order_is_maintenance || order_is_a_custom_sale)) {
|
||||||
@@ -193,16 +195,15 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
|||||||
|
|
||||||
if (doc.docstatus === 1 && !doc.inter_company_order_reference) {
|
if (doc.docstatus === 1 && !doc.inter_company_order_reference) {
|
||||||
let me = this;
|
let me = this;
|
||||||
frappe.model.with_doc("Customer", me.frm.doc.customer, () => {
|
let internal = me.frm.doc.is_internal_customer;
|
||||||
let customer = frappe.model.get_doc("Customer", me.frm.doc.customer);
|
if (internal) {
|
||||||
let internal = customer.is_internal_customer;
|
let button_label = (me.frm.doc.company === me.frm.doc.represents_company) ? "Internal Purchase Order" :
|
||||||
let disabled = customer.disabled;
|
"Inter Company Purchase Order";
|
||||||
if (internal === 1 && disabled === 0) {
|
|
||||||
me.frm.add_custom_button("Inter Company Order", function() {
|
me.frm.add_custom_button(button_label, function() {
|
||||||
me.make_inter_company_order();
|
me.make_inter_company_order();
|
||||||
}, __('Create'));
|
}, __('Create'));
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// payment request
|
// payment request
|
||||||
|
|||||||
Reference in New Issue
Block a user