mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 04:39:11 +00:00
GL Entries for Sales/Purchase Invoice in multi currency
This commit is contained in:
@@ -76,7 +76,28 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
credit_to: function() {
|
||||||
|
var me = this;
|
||||||
|
if(this.frm.doc.credit_to) {
|
||||||
|
me.frm.call({
|
||||||
|
method: "frappe.client.get_value",
|
||||||
|
args: {
|
||||||
|
doctype: "Account",
|
||||||
|
fieldname: "currency",
|
||||||
|
filters: { name: me.frm.doc.credit_to },
|
||||||
|
},
|
||||||
|
callback: function(r, rt) {
|
||||||
|
if(r.message) {
|
||||||
|
me.frm.set_value("party_account_currency", r.message.currency);
|
||||||
|
me.set_dynamic_labels();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
write_off_amount: function() {
|
write_off_amount: function() {
|
||||||
|
this.set_in_company_currency(this.frm.doc, ["write_off_amount"]);
|
||||||
this.calculate_outstanding_amount();
|
this.calculate_outstanding_amount();
|
||||||
this.frm.refresh_fields();
|
this.frm.refresh_fields();
|
||||||
},
|
},
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -253,10 +253,12 @@ class PurchaseInvoice(BuyingController):
|
|||||||
"party_type": "Supplier",
|
"party_type": "Supplier",
|
||||||
"party": self.supplier,
|
"party": self.supplier,
|
||||||
"against": self.against_expense_account,
|
"against": self.against_expense_account,
|
||||||
"credit": self.total_amount_to_pay,
|
"credit": self.base_grand_total,
|
||||||
|
"credit_in_account_currency": self.base_grand_total \
|
||||||
|
if self.party_account_currency==self.company_currency else self.grand_total,
|
||||||
"against_voucher": self.return_against if cint(self.is_return) else self.name,
|
"against_voucher": self.return_against if cint(self.is_return) else self.name,
|
||||||
"against_voucher_type": self.doctype,
|
"against_voucher_type": self.doctype,
|
||||||
})
|
}, self.party_account_currency)
|
||||||
)
|
)
|
||||||
|
|
||||||
# tax table gl entries
|
# tax table gl entries
|
||||||
@@ -354,11 +356,28 @@ class PurchaseInvoice(BuyingController):
|
|||||||
# writeoff account includes petty difference in the invoice amount
|
# writeoff account includes petty difference in the invoice amount
|
||||||
# and the amount that is paid
|
# and the amount that is paid
|
||||||
if self.write_off_account and flt(self.write_off_amount):
|
if self.write_off_account and flt(self.write_off_amount):
|
||||||
|
write_off_account_currency = frappe.db.get_value("Account", self.write_off_account, "currency")
|
||||||
|
|
||||||
|
gl_entries.append(
|
||||||
|
self.get_gl_dict({
|
||||||
|
"account": self.credit_to,
|
||||||
|
"party_type": "Supplier",
|
||||||
|
"party": self.supplier,
|
||||||
|
"against": self.write_off_account,
|
||||||
|
"debit": self.base_write_off_amount,
|
||||||
|
"debit_in_account_currency": self.base_write_off_amount \
|
||||||
|
if self.party_account_currency==self.company_currency else self.write_off_amount,
|
||||||
|
"against_voucher": self.return_against if cint(self.is_return) else self.name,
|
||||||
|
"against_voucher_type": self.doctype,
|
||||||
|
}, self.party_account_currency)
|
||||||
|
)
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
"account": self.write_off_account,
|
"account": self.write_off_account,
|
||||||
"against": self.supplier,
|
"against": self.supplier,
|
||||||
"credit": flt(self.write_off_amount),
|
"credit": flt(self.base_write_off_amount),
|
||||||
|
"credit_in_account_currency": self.base_write_off_amount \
|
||||||
|
if write_off_account_currency==self.company_currency else self.write_off_amount,
|
||||||
"cost_center": self.write_off_cost_center
|
"cost_center": self.write_off_cost_center
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,11 +1,19 @@
|
|||||||
{
|
{
|
||||||
|
"allow_copy": 0,
|
||||||
|
"allow_import": 0,
|
||||||
|
"allow_rename": 0,
|
||||||
"creation": "2013-03-08 15:36:46",
|
"creation": "2013-03-08 15:36:46",
|
||||||
|
"custom": 0,
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
"fieldname": "journal_entry",
|
"fieldname": "journal_entry",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"in_filter": 0,
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Journal Entry",
|
"label": "Journal Entry",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
@@ -13,14 +21,23 @@
|
|||||||
"oldfieldtype": "Link",
|
"oldfieldtype": "Link",
|
||||||
"options": "Journal Entry",
|
"options": "Journal Entry",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
|
"print_hide": 0,
|
||||||
"print_width": "180px",
|
"print_width": "180px",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0,
|
||||||
"width": "180px"
|
"width": "180px"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
"fieldname": "jv_detail_no",
|
"fieldname": "jv_detail_no",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"hidden": 1,
|
"hidden": 1,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"in_filter": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "Journal Entry Detail No",
|
"label": "Journal Entry Detail No",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
@@ -30,60 +47,117 @@
|
|||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"print_width": "80px",
|
"print_width": "80px",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0,
|
||||||
"width": "80px"
|
"width": "80px"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
"fieldname": "remarks",
|
"fieldname": "remarks",
|
||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"in_filter": 0,
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Remarks",
|
"label": "Remarks",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"oldfieldname": "remarks",
|
"oldfieldname": "remarks",
|
||||||
"oldfieldtype": "Small Text",
|
"oldfieldtype": "Small Text",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
|
"print_hide": 0,
|
||||||
"print_width": "150px",
|
"print_width": "150px",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0,
|
||||||
"width": "150px"
|
"width": "150px"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
"fieldname": "col_break1",
|
"fieldname": "col_break1",
|
||||||
"fieldtype": "Column Break",
|
"fieldtype": "Column Break",
|
||||||
"permlevel": 0
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"print_hide": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
"fieldname": "advance_amount",
|
"fieldname": "advance_amount",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"in_filter": 0,
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Advance Amount",
|
"label": "Advance Amount",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"oldfieldname": "advance_amount",
|
"oldfieldname": "advance_amount",
|
||||||
"oldfieldtype": "Currency",
|
"oldfieldtype": "Currency",
|
||||||
"options": "Company:company:default_currency",
|
"options": "party_account_currency",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
|
"print_hide": 0,
|
||||||
"print_width": "100px",
|
"print_width": "100px",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0,
|
||||||
"width": "100px"
|
"width": "100px"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
"fieldname": "allocated_amount",
|
"fieldname": "allocated_amount",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"in_filter": 0,
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Allocated Amount",
|
"label": "Allocated Amount",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"oldfieldname": "allocated_amount",
|
"oldfieldname": "allocated_amount",
|
||||||
"oldfieldtype": "Currency",
|
"oldfieldtype": "Currency",
|
||||||
"options": "Company:company:default_currency",
|
"options": "party_account_currency",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
|
"print_hide": 0,
|
||||||
"print_width": "100px",
|
"print_width": "100px",
|
||||||
|
"read_only": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0,
|
||||||
"width": "100px"
|
"width": "100px"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"hide_heading": 0,
|
||||||
|
"hide_toolbar": 0,
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
|
"in_create": 0,
|
||||||
|
"in_dialog": 0,
|
||||||
|
"is_submittable": 0,
|
||||||
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"modified": "2014-12-25 16:29:15.176476",
|
"modified": "2015-08-25 17:51:30.274069",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "nabin@erpnext.com",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Purchase Invoice Advance",
|
"name": "Purchase Invoice Advance",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": []
|
"permissions": [],
|
||||||
|
"read_only": 0,
|
||||||
|
"read_only_onload": 0
|
||||||
}
|
}
|
||||||
@@ -175,6 +175,26 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
debit_to: function() {
|
||||||
|
var me = this;
|
||||||
|
if(this.frm.doc.debit_to) {
|
||||||
|
me.frm.call({
|
||||||
|
method: "frappe.client.get_value",
|
||||||
|
args: {
|
||||||
|
doctype: "Account",
|
||||||
|
fieldname: "currency",
|
||||||
|
filters: { name: me.frm.doc.debit_to },
|
||||||
|
},
|
||||||
|
callback: function(r, rt) {
|
||||||
|
if(r.message) {
|
||||||
|
me.frm.set_value("party_account_currency", r.message.currency);
|
||||||
|
me.set_dynamic_labels();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
allocated_amount: function() {
|
allocated_amount: function() {
|
||||||
this.calculate_total_advance();
|
this.calculate_total_advance();
|
||||||
this.frm.refresh_fields();
|
this.frm.refresh_fields();
|
||||||
@@ -182,10 +202,10 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
|
|
||||||
write_off_outstanding_amount_automatically: function() {
|
write_off_outstanding_amount_automatically: function() {
|
||||||
if(cint(this.frm.doc.write_off_outstanding_amount_automatically)) {
|
if(cint(this.frm.doc.write_off_outstanding_amount_automatically)) {
|
||||||
frappe.model.round_floats_in(this.frm.doc, ["base_grand_total", "paid_amount"]);
|
frappe.model.round_floats_in(this.frm.doc, ["grand_total", "paid_amount"]);
|
||||||
// this will make outstanding amount 0
|
// this will make outstanding amount 0
|
||||||
this.frm.set_value("write_off_amount",
|
this.frm.set_value("write_off_amount",
|
||||||
flt(this.frm.doc.base_grand_total - this.frm.doc.paid_amount - this.frm.doc.total_advance, precision("write_off_amount"))
|
flt(this.frm.doc.grand_total - this.frm.doc.paid_amount - this.frm.doc.total_advance, precision("write_off_amount"))
|
||||||
);
|
);
|
||||||
this.frm.toggle_enable("write_off_amount", false);
|
this.frm.toggle_enable("write_off_amount", false);
|
||||||
|
|
||||||
@@ -198,10 +218,12 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
|||||||
},
|
},
|
||||||
|
|
||||||
write_off_amount: function() {
|
write_off_amount: function() {
|
||||||
|
this.set_in_company_currency(this.frm.doc, ["write_off_amount"]);
|
||||||
this.write_off_outstanding_amount_automatically();
|
this.write_off_outstanding_amount_automatically();
|
||||||
},
|
},
|
||||||
|
|
||||||
paid_amount: function() {
|
paid_amount: function() {
|
||||||
|
this.set_in_company_currency(this.frm.doc, ["paid_amount"]);
|
||||||
this.write_off_outstanding_amount_automatically();
|
this.write_off_outstanding_amount_automatically();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -397,14 +397,21 @@ class SalesInvoice(SellingController):
|
|||||||
if cint(self.is_pos) == 1:
|
if cint(self.is_pos) == 1:
|
||||||
if flt(self.paid_amount) == 0:
|
if flt(self.paid_amount) == 0:
|
||||||
if self.cash_bank_account:
|
if self.cash_bank_account:
|
||||||
frappe.db.set(self, 'paid_amount',
|
paid_amount = flt(flt(self.grand_total) - flt(self.write_off_amount),
|
||||||
(flt(self.base_grand_total) - flt(self.write_off_amount)))
|
self.precision("paid_amount"))
|
||||||
|
base_paid_amount = flt(paid_amount*self.conversion_rate, self.precision("base_paid_amount"))
|
||||||
|
|
||||||
|
frappe.db.set(self, 'paid_amount', paid_amount)
|
||||||
|
frappe.db.set(self, 'base_paid_amount', base_paid_amount)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# show message that the amount is not paid
|
# show message that the amount is not paid
|
||||||
frappe.db.set(self,'paid_amount',0)
|
frappe.db.set(self,'paid_amount',0)
|
||||||
|
frappe.db.set(self,'base_paid_amount',0)
|
||||||
frappe.msgprint(_("Note: Payment Entry will not be created since 'Cash or Bank Account' was not specified"))
|
frappe.msgprint(_("Note: Payment Entry will not be created since 'Cash or Bank Account' was not specified"))
|
||||||
else:
|
else:
|
||||||
frappe.db.set(self,'paid_amount',0)
|
frappe.db.set(self,'paid_amount',0)
|
||||||
|
frappe.db.set(self,'base_paid_amount',0)
|
||||||
|
|
||||||
def check_prev_docstatus(self):
|
def check_prev_docstatus(self):
|
||||||
for d in self.get('items'):
|
for d in self.get('items'):
|
||||||
@@ -469,9 +476,7 @@ class SalesInvoice(SellingController):
|
|||||||
|
|
||||||
gl_entries = []
|
gl_entries = []
|
||||||
|
|
||||||
customer_account_currency = frappe.db.get_value("Account", self.debit_to, "currency")
|
self.make_customer_gl_entry(gl_entries)
|
||||||
|
|
||||||
self.make_customer_gl_entry(gl_entries, customer_account_currency)
|
|
||||||
|
|
||||||
self.make_tax_gl_entries(gl_entries)
|
self.make_tax_gl_entries(gl_entries)
|
||||||
|
|
||||||
@@ -480,13 +485,13 @@ class SalesInvoice(SellingController):
|
|||||||
# merge gl entries before adding pos entries
|
# merge gl entries before adding pos entries
|
||||||
gl_entries = merge_similar_entries(gl_entries)
|
gl_entries = merge_similar_entries(gl_entries)
|
||||||
|
|
||||||
self.make_pos_gl_entries(gl_entries, customer_account_currency)
|
self.make_pos_gl_entries(gl_entries)
|
||||||
|
|
||||||
self.make_write_off_gl_entry(gl_entries, customer_account_currency)
|
self.make_write_off_gl_entry(gl_entries)
|
||||||
|
|
||||||
return gl_entries
|
return gl_entries
|
||||||
|
|
||||||
def make_customer_gl_entry(self, gl_entries, customer_account_currency):
|
def make_customer_gl_entry(self, gl_entries):
|
||||||
if self.grand_total:
|
if self.grand_total:
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
@@ -496,10 +501,10 @@ class SalesInvoice(SellingController):
|
|||||||
"against": self.against_income_account,
|
"against": self.against_income_account,
|
||||||
"debit": self.base_grand_total,
|
"debit": self.base_grand_total,
|
||||||
"debit_in_account_currency": self.base_grand_total \
|
"debit_in_account_currency": self.base_grand_total \
|
||||||
if customer_account_currency==self.company_currency else self.grand_total,
|
if self.party_account_currency==self.company_currency else self.grand_total,
|
||||||
"against_voucher": self.return_against if cint(self.is_return) else self.name,
|
"against_voucher": self.return_against if cint(self.is_return) else self.name,
|
||||||
"against_voucher_type": self.doctype
|
"against_voucher_type": self.doctype
|
||||||
}, customer_account_currency)
|
}, self.party_account_currency)
|
||||||
)
|
)
|
||||||
|
|
||||||
def make_tax_gl_entries(self, gl_entries):
|
def make_tax_gl_entries(self, gl_entries):
|
||||||
@@ -538,11 +543,9 @@ class SalesInvoice(SellingController):
|
|||||||
and cint(self.update_stock):
|
and cint(self.update_stock):
|
||||||
gl_entries += super(SalesInvoice, self).get_gl_entries()
|
gl_entries += super(SalesInvoice, self).get_gl_entries()
|
||||||
|
|
||||||
def make_pos_gl_entries(self, gl_entries, customer_account_currency):
|
def make_pos_gl_entries(self, gl_entries):
|
||||||
if cint(self.is_pos) and self.cash_bank_account and self.paid_amount:
|
if cint(self.is_pos) and self.cash_bank_account and self.paid_amount:
|
||||||
bank_account_currency = frappe.db.get_value("Account", self.cash_bank_account, "currency")
|
bank_account_currency = frappe.db.get_value("Account", self.cash_bank_account, "currency")
|
||||||
paid_amount_in_account_currency = self.paid_amount if bank_account_currency==self.company_currency \
|
|
||||||
else flt(self.paid_amount/self.conversion_rate, self.precision("paid_amount"))
|
|
||||||
# POS, make payment entries
|
# POS, make payment entries
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
@@ -550,28 +553,27 @@ class SalesInvoice(SellingController):
|
|||||||
"party_type": "Customer",
|
"party_type": "Customer",
|
||||||
"party": self.customer,
|
"party": self.customer,
|
||||||
"against": self.cash_bank_account,
|
"against": self.cash_bank_account,
|
||||||
"credit": self.paid_amount,
|
"credit": self.base_paid_amount,
|
||||||
"credit_in_account_currency": paid_amount_in_account_currency,
|
"credit_in_account_currency": self.base_paid_amount \
|
||||||
|
if self.party_account_currency==self.company_currency else self.paid_amount,
|
||||||
"against_voucher": self.return_against if cint(self.is_return) else self.name,
|
"against_voucher": self.return_against if cint(self.is_return) else self.name,
|
||||||
"against_voucher_type": self.doctype,
|
"against_voucher_type": self.doctype,
|
||||||
}, customer_account_currency)
|
}, self.party_account_currency)
|
||||||
)
|
)
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
"account": self.cash_bank_account,
|
"account": self.cash_bank_account,
|
||||||
"against": self.customer,
|
"against": self.customer,
|
||||||
"debit": self.paid_amount,
|
"debit": self.base_paid_amount,
|
||||||
"debit_in_account_currency": paid_amount_in_account_currency
|
"debit_in_account_currency": self.base_paid_amount \
|
||||||
|
if bank_account_currency==self.company_currency else self.paid_amount
|
||||||
}, bank_account_currency)
|
}, bank_account_currency)
|
||||||
)
|
)
|
||||||
|
|
||||||
def make_write_off_gl_entry(self, gl_entries, customer_account_currency):
|
def make_write_off_gl_entry(self, gl_entries):
|
||||||
# write off entries, applicable if only pos
|
# write off entries, applicable if only pos
|
||||||
if self.write_off_account and self.write_off_amount:
|
if self.write_off_account and self.write_off_amount:
|
||||||
write_off_account_currency = frappe.db.get_value("Account", self.write_off_account, "currency")
|
write_off_account_currency = frappe.db.get_value("Account", self.write_off_account, "currency")
|
||||||
write_off_amount_in_account_currency = self.write_off_amount \
|
|
||||||
if write_off_account_currency==self.company_currency \
|
|
||||||
else flt(self.write_off_amount/self.conversion_rate, self.precision("write_off_amount"))
|
|
||||||
|
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
@@ -579,18 +581,20 @@ class SalesInvoice(SellingController):
|
|||||||
"party_type": "Customer",
|
"party_type": "Customer",
|
||||||
"party": self.customer,
|
"party": self.customer,
|
||||||
"against": self.write_off_account,
|
"against": self.write_off_account,
|
||||||
"credit": self.write_off_amount,
|
"credit": self.base_write_off_amount,
|
||||||
"credit_in_account_currency": write_off_amount_in_account_currency,
|
"credit_in_account_currency": self.base_write_off_amount \
|
||||||
|
if self.party_account_currency==self.company_currency else self.write_off_amount,
|
||||||
"against_voucher": self.return_against if cint(self.is_return) else self.name,
|
"against_voucher": self.return_against if cint(self.is_return) else self.name,
|
||||||
"against_voucher_type": self.doctype
|
"against_voucher_type": self.doctype
|
||||||
}, customer_account_currency)
|
}, self.party_account_currency)
|
||||||
)
|
)
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
"account": self.write_off_account,
|
"account": self.write_off_account,
|
||||||
"against": self.customer,
|
"against": self.customer,
|
||||||
"debit": self.write_off_amount,
|
"debit": self.base_write_off_amount,
|
||||||
"debit_in_account_currency": write_off_amount_in_account_currency,
|
"debit_in_account_currency": self.base_write_off_amount \
|
||||||
|
if write_off_account_currency==self.company_currency else self.write_off_amount,
|
||||||
"cost_center": self.write_off_cost_center
|
"cost_center": self.write_off_cost_center
|
||||||
}, write_off_account_currency)
|
}, write_off_account_currency)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,11 +1,19 @@
|
|||||||
{
|
{
|
||||||
|
"allow_copy": 0,
|
||||||
|
"allow_import": 0,
|
||||||
|
"allow_rename": 0,
|
||||||
"creation": "2013-02-22 01:27:41",
|
"creation": "2013-02-22 01:27:41",
|
||||||
|
"custom": 0,
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
"fieldname": "journal_entry",
|
"fieldname": "journal_entry",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"in_filter": 0,
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Journal Entry",
|
"label": "Journal Entry",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
@@ -13,27 +21,46 @@
|
|||||||
"oldfieldtype": "Link",
|
"oldfieldtype": "Link",
|
||||||
"options": "Journal Entry",
|
"options": "Journal Entry",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
|
"print_hide": 0,
|
||||||
"print_width": "250px",
|
"print_width": "250px",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0,
|
||||||
"width": "250px"
|
"width": "250px"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
"fieldname": "remarks",
|
"fieldname": "remarks",
|
||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"in_filter": 0,
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Remarks",
|
"label": "Remarks",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"oldfieldname": "remarks",
|
"oldfieldname": "remarks",
|
||||||
"oldfieldtype": "Small Text",
|
"oldfieldtype": "Small Text",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
|
"print_hide": 0,
|
||||||
"print_width": "150px",
|
"print_width": "150px",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0,
|
||||||
"width": "150px"
|
"width": "150px"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
"fieldname": "jv_detail_no",
|
"fieldname": "jv_detail_no",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"hidden": 1,
|
"hidden": 1,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"in_filter": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "Journal Entry Detail No",
|
"label": "Journal Entry Detail No",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
@@ -43,47 +70,94 @@
|
|||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"print_width": "120px",
|
"print_width": "120px",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0,
|
||||||
"width": "120px"
|
"width": "120px"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
"fieldname": "col_break1",
|
"fieldname": "col_break1",
|
||||||
"fieldtype": "Column Break",
|
"fieldtype": "Column Break",
|
||||||
"permlevel": 0
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"print_hide": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
"fieldname": "advance_amount",
|
"fieldname": "advance_amount",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"in_filter": 0,
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Advance amount",
|
"label": "Advance amount",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"oldfieldname": "advance_amount",
|
"oldfieldname": "advance_amount",
|
||||||
"oldfieldtype": "Currency",
|
"oldfieldtype": "Currency",
|
||||||
"options": "Company:company:default_currency",
|
"options": "party_account_currency",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
|
"print_hide": 0,
|
||||||
"print_width": "120px",
|
"print_width": "120px",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0,
|
||||||
"width": "120px"
|
"width": "120px"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
"fieldname": "allocated_amount",
|
"fieldname": "allocated_amount",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"in_filter": 0,
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Allocated amount",
|
"label": "Allocated amount",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"oldfieldname": "allocated_amount",
|
"oldfieldname": "allocated_amount",
|
||||||
"oldfieldtype": "Currency",
|
"oldfieldtype": "Currency",
|
||||||
"options": "Company:company:default_currency",
|
"options": "party_account_currency",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
|
"print_hide": 0,
|
||||||
"print_width": "120px",
|
"print_width": "120px",
|
||||||
|
"read_only": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0,
|
||||||
"width": "120px"
|
"width": "120px"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"hide_heading": 0,
|
||||||
|
"hide_toolbar": 0,
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
|
"in_create": 0,
|
||||||
|
"in_dialog": 0,
|
||||||
|
"is_submittable": 0,
|
||||||
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"modified": "2014-12-25 16:30:19.446500",
|
"modified": "2015-08-21 16:22:28.866049",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Sales Invoice Advance",
|
"name": "Sales Invoice Advance",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": []
|
"permissions": [],
|
||||||
|
"read_only": 0,
|
||||||
|
"read_only_onload": 0
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user