Compare commits

...

17 Commits

Author SHA1 Message Date
Nabin Hait
a558683e40 Merge pull request #6868 from frappe/pos_payments_base_amount
[patch] Set base amount in Sales Invoice Payment table
2016-11-08 17:43:54 +05:30
Nabin Hait
03a3c852c3 [patch] Set base amount in Sales Invoice Payment table 2016-11-08 17:25:14 +05:30
Nabin Hait
13bd69c27d Update gl_entry.py 2016-11-08 15:33:36 +05:30
rohitwaghchaure
27affe4c5e Merge pull request #6849 from rohitwaghchaure/v7.0.x
[POS] Pricing rule discount issue
2016-11-08 12:04:22 +05:30
Rohit Waghchaure
d85f149b5e pricing rule discount issue 2016-11-07 19:44:52 +05:30
Nabin Hait
d275f0ec7f [fix] Get data in opportunity dashboard 2016-11-03 15:33:12 +05:30
Nabin Hait
1b4e9898ce Merge pull request #6810 from nabinhait/v7.0.x
set item rate on first selection  of item
2016-11-03 15:10:41 +05:30
Nabin Hait
37b1b613f5 set item rate on first selection of item 2016-11-03 14:46:13 +05:30
Nabin Hait
594642441b Merge pull request #6781 from rohitwaghchaure/so_float_fieldtype_issue
Change fieldtype from float to currency
2016-11-03 10:48:52 +05:30
Rohit Waghchaure
e803adc4e3 Change fieldtype from float to currency 2016-11-01 16:36:00 +05:30
Nabin Hait
f7ac1236ed repost gle for Purchase Invoice with update stock 2016-11-01 11:28:05 +05:30
Nabin Hait
9600b29399 Merge pull request #6767 from nabinhait/v7.0.x
repost gle for Purchase Invoice with update stock
2016-10-31 16:50:06 +05:30
Nabin Hait
9f6a09e661 repost gle for Purchase Invoice with update stock 2016-10-31 16:31:46 +05:30
Nabin Hait
ab5e7fecb0 Merge pull request #6740 from rohitwaghchaure/multi_currency_issue
[Fix] Account currency not fetched on selection of party in Journal Entry Account
2016-10-29 14:39:51 +05:30
Nabin Hait
6f4e1ed96c Merge pull request #6741 from rohitwaghchaure/pos_minor_issue
Minor fix
2016-10-29 14:39:37 +05:30
Rohit Waghchaure
b337b7208d minor issue 2016-10-28 13:40:13 +05:30
Rohit Waghchaure
6996bb0826 [Fix] Account currency not fetched on selection of party in journale entry 2016-10-28 13:32:05 +05:30
14 changed files with 114 additions and 44 deletions

View File

@@ -44,18 +44,25 @@ class GLEntry(Document):
frappe.throw(_("{0} is required").format(_(self.meta.get_label(k))))
account_type = frappe.db.get_value("Account", self.account, "account_type")
if account_type in ["Receivable", "Payable"] and not (self.party_type and self.party):
frappe.throw(_("Party Type and Party is required for Receivable / Payable account {0}").format(self.account))
if not (self.party_type and self.party):
if account_type == "Receivable":
frappe.throw(_("{0} {1}: Customer is required against Receivable account {2}")
.format(self.voucher_type, self.voucher_no, self.account))
elif account_type == "Payable":
frappe.throw(_("{0} {1}: Supplier is required against Payable account {2}")
.format(self.voucher_type, self.voucher_no, self.account))
# Zero value transaction is not allowed
if not (flt(self.debit) or flt(self.credit)):
frappe.throw(_("Either debit or credit amount is required for {0}").format(self.account))
frappe.throw(_("{0} {1}: Either debit or credit amount is required for {2}")
.format(self.voucher_type, self.voucher_no, self.account))
def pl_must_have_cost_center(self):
if frappe.db.get_value("Account", self.account, "report_type") == "Profit and Loss":
if not self.cost_center and self.voucher_type != 'Period Closing Voucher':
frappe.throw(_("Cost Center is required for 'Profit and Loss' account {0}")
.format(self.account))
frappe.throw(_("{0} {1}: Cost Center is required for 'Profit and Loss' account {2}. Please set up a default Cost Center for the Company.")
.format(self.voucher_type, self.voucher_no, self.account))
else:
if self.cost_center:
self.cost_center = None
@@ -65,7 +72,8 @@ class GLEntry(Document):
def check_pl_account(self):
if self.is_opening=='Yes' and \
frappe.db.get_value("Account", self.account, "report_type")=="Profit and Loss":
frappe.throw(_("'Profit and Loss' type account {0} not allowed in Opening Entry").format(self.account))
frappe.throw(_("{0} {1}: 'Profit and Loss' type account {2} not allowed in Opening Entry")
.format(self.voucher_type, self.voucher_no, self.account))
def validate_account_details(self, adv_adj):
"""Account must be ledger, active and not freezed"""
@@ -74,13 +82,16 @@ class GLEntry(Document):
from tabAccount where name=%s""", self.account, as_dict=1)[0]
if ret.is_group==1:
frappe.throw(_("Account {0} cannot be a Group").format(self.account))
frappe.throw(_("{0} {1}: Account {2} cannot be a Group")
.format(self.voucher_type, self.voucher_no, self.account))
if ret.docstatus==2:
frappe.throw(_("Account {0} is inactive").format(self.account))
frappe.throw(_("{0} {1}: Account {2} is inactive")
.format(self.voucher_type, self.voucher_no, self.account))
if ret.company != self.company:
frappe.throw(_("Account {0} does not belong to Company {1}").format(self.account, self.company))
frappe.throw(_("{0} {1}: Account {2} does not belong to Company {3}")
.format(self.voucher_type, self.voucher_no, self.account, self.company))
def validate_cost_center(self):
if not hasattr(self, "cost_center_company"):
@@ -94,7 +105,8 @@ class GLEntry(Document):
return self.cost_center_company[self.cost_center]
if self.cost_center and _get_cost_center_company() != self.company:
frappe.throw(_("Cost Center {0} does not belong to Company {1}").format(self.cost_center, self.company))
frappe.throw(_("{0} {1}: Cost Center {2} does not belong to Company {3}")
.format(self.voucher_type, self.voucher_no, self.cost_center, self.company))
def validate_party(self):
validate_party_frozen_disabled(self.party_type, self.party)
@@ -107,8 +119,9 @@ class GLEntry(Document):
self.account_currency = company_currency
if account_currency != self.account_currency:
frappe.throw(_("Accounting Entry for {0} can only be made in currency: {1}")
.format(self.account, (account_currency or company_currency)), InvalidAccountCurrency)
frappe.throw(_("{0} {1}: Accounting Entry for {2} can only be made in currency: {3}")
.format(self.voucher_type, self.voucher_no, self.account,
(account_currency or company_currency)), InvalidAccountCurrency)
if self.party_type and self.party:
validate_party_gle_currency(self.party_type, self.party, self.company, self.account_currency)

View File

@@ -760,7 +760,8 @@ def get_party_account_and_balance(company, party_type, party):
return {
"account": account,
"balance": account_balance,
"party_balance": party_balance
"party_balance": party_balance,
"account_currency": frappe.db.get_value("Account", account, "account_currency")
}
@frappe.whitelist()

View File

@@ -305,24 +305,7 @@ class PurchaseInvoice(BuyingController):
if not self.grand_total:
return
self.auto_accounting_for_stock = \
cint(frappe.defaults.get_global_default("auto_accounting_for_stock"))
self.stock_received_but_not_billed = self.get_company_default("stock_received_but_not_billed")
self.expenses_included_in_valuation = self.get_company_default("expenses_included_in_valuation")
self.negative_expense_to_be_booked = 0.0
gl_entries = []
self.make_supplier_gl_entry(gl_entries)
self.make_item_gl_entries(gl_entries)
self.make_tax_gl_entries(gl_entries)
gl_entries = merge_similar_entries(gl_entries)
self.make_payment_gl_entries(gl_entries)
self.make_write_off_gl_entry(gl_entries)
gl_entries = self.get_gl_entries()
if gl_entries:
update_outstanding = "No" if (cint(self.is_paid) or self.write_off_account) else "Yes"
@@ -341,7 +324,27 @@ class PurchaseInvoice(BuyingController):
elif self.docstatus == 2 and cint(self.update_stock) and self.auto_accounting_for_stock:
delete_gl_entries(voucher_type=self.doctype, voucher_no=self.name)
def get_gl_entries(self, warehouse_account=None):
self.auto_accounting_for_stock = \
cint(frappe.defaults.get_global_default("auto_accounting_for_stock"))
self.stock_received_but_not_billed = self.get_company_default("stock_received_but_not_billed")
self.expenses_included_in_valuation = self.get_company_default("expenses_included_in_valuation")
self.negative_expense_to_be_booked = 0.0
gl_entries = []
self.make_supplier_gl_entry(gl_entries)
self.make_item_gl_entries(gl_entries)
self.make_tax_gl_entries(gl_entries)
gl_entries = merge_similar_entries(gl_entries)
self.make_payment_gl_entries(gl_entries)
self.make_write_off_gl_entry(gl_entries)
return gl_entries
def make_supplier_gl_entry(self, gl_entries):
if self.grand_total:

View File

@@ -550,7 +550,7 @@
"collapsible": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate",
"fieldname": "total_margin",
"fieldtype": "Float",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -1660,7 +1660,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-07-11 03:28:07.483665",
"modified": "2016-11-01 16:27:09.402277",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Item",

View File

@@ -380,7 +380,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
if(index < 30){
$(frappe.render_template("pos_item", {
item_code: obj.name,
item_price: format_currency(obj.price_list_rate, obj.currency),
item_price: format_currency(obj.price_list_rate, me.frm.doc.currency),
item_name: obj.name===obj.item_name ? "" : obj.item_name,
item_image: obj.image ? "url('" + obj.image + "')" : null,
color: frappe.get_palette(obj.item_name),
@@ -956,6 +956,10 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
item.margin_rate_or_amount = pricing_rule[0].margin_rate_or_amount;
item.discount_percentage = pricing_rule[0].discount_percentage || 0.0;
me.apply_pricing_rule_on_item(item)
} else if(item.discount_percentage > 0 || item.margin_rate_or_amount > 0) {
item.margin_rate_or_amount = 0.0;
item.discount_percentage = 0.0;
me.apply_pricing_rule_on_item(item)
}
})
},

View File

@@ -3,6 +3,9 @@ from frappe import _
def get_data():
return {
'fieldname': 'prevdoc_docname',
'non_standard_fieldnames': {
'Supplier Quotation': 'opportunity',
},
'transactions': [
{
'label': _('Related'),

View File

@@ -321,3 +321,5 @@ erpnext.patches.v7_0.update_mode_of_payment_type
finally:erpnext.patches.v7_0.update_timesheet_communications
erpnext.patches.v7_0.update_status_of_zero_amount_sales_order
erpnext.patches.v7_0.repost_bin_qty_and_item_projected_qty
erpnext.patches.v7_0.repost_gle_for_pi_with_update_stock #2016-11-01
erpnext.patches.v7_0.set_base_amount_in_invoice_payment_table

View File

@@ -0,0 +1,20 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cint
def execute():
if not cint(frappe.defaults.get_global_default("auto_accounting_for_stock")):
return
for pi in frappe.db.sql("""select name from `tabPurchase Invoice`
where update_stock=1 and docstatus=1 order by posting_date asc""", as_dict=1):
frappe.db.sql("""delete from `tabGL Entry`
where voucher_type = 'Purchase Invoice' and voucher_no = %s""", pi.name)
pi_doc = frappe.get_doc("Purchase Invoice", pi.name)
pi_doc.make_gl_entries(repost_future_gle=False)
frappe.db.commit()

View File

@@ -0,0 +1,23 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import flt
def execute():
si_list = frappe.db.sql("""
select distinct parent
from `tabSales Invoice Payment`
where docstatus!=2 and amount != 0 and base_amount = 0
""")
count = 0
for d in si_list:
si = frappe.get_doc("Sales Invoice", d[0])
for p in si.get("payments"):
if p.amount and not p.base_amount:
base_amount = flt(p.amount*si.conversion_rate, si.precision("base_paid_amount"))
frappe.db.set_value("Sales Invoice Payment", p.name, "base_amount", base_amount, update_modified=False)
count +=1
if count % 200 == 0:
frappe.db.commit()

View File

@@ -16,9 +16,10 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
},
apply_pricing_rule_on_item: function(item){
if(item.margin_type == "Percentage"){
item.total_margin = item.price_list_rate + item.price_list_rate * ( item.margin_rate_or_amount / 100);
item.total_margin = flt(item.price_list_rate)
+ flt(item.price_list_rate) * ( flt(item.margin_rate_or_amount) / 100);
}else{
item.total_margin = item.price_list_rate + item.margin_rate_or_amount;
item.total_margin = flt(item.price_list_rate) + flt(item.margin_rate_or_amount);
}
item.rate = flt(item.total_margin , precision("rate", item));

View File

@@ -542,7 +542,7 @@
"collapsible": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate",
"fieldname": "total_margin",
"fieldtype": "Float",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -1230,7 +1230,7 @@
"istable": 1,
"max_attachments": 0,
"menu_index": 0,
"modified": "2016-07-11 03:28:06.436316",
"modified": "2016-11-01 16:26:46.507292",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation Item",

View File

@@ -542,7 +542,7 @@
"collapsible": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate",
"fieldname": "total_margin",
"fieldtype": "Float",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -591,7 +591,7 @@
"collapsible": 0,
"depends_on": "eval: doc.type != \"\"",
"fieldname": "rate",
"fieldtype": "Float",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -1525,7 +1525,7 @@
"istable": 1,
"max_attachments": 0,
"menu_index": 0,
"modified": "2016-07-11 03:28:07.988319",
"modified": "2016-11-01 16:26:27.256029",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Item",

View File

@@ -566,7 +566,7 @@
"collapsible": 0,
"depends_on": "eval:doc.margin_type && doc.price_list_rate",
"fieldname": "total_margin",
"fieldtype": "Float",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -1468,7 +1468,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-07-11 03:27:59.254550",
"modified": "2016-11-01 16:35:45.800082",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note Item",

View File

@@ -567,7 +567,7 @@ class Item(WebsiteGenerator):
existing_allow_negative_stock = frappe.db.get_value("Stock Settings", None, "allow_negative_stock")
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)
for warehouse in frappe.db.sql("select name from `tabWarehouse` where is_group = 0"):
for warehouse in frappe.db.sql("select warehouse from `tabBin` where item_code=%s", new_name):
repost_stock(new_name, warehouse[0])
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", existing_allow_negative_stock)