Compare commits

...

8 Commits

Author SHA1 Message Date
Brown-Harry Boma
40a43d3260 Replace create_custom_fields with create_custom_field (#11420) 2017-11-02 17:58:05 +05:30
Brown-Harry Boma
a829b3cc82 v8.x.x Allow Doctypes with space in name to be filtered in General Ledger (#11264)
* Set transaction type in pricing rule only if unavailable

* Use scrub instead for party_type with space
2017-10-25 11:58:45 +05:30
Brown-Harry Boma
757c2f692b [Fix]Setup Wizard Errors (#11289) 2017-10-25 11:52:08 +05:30
Brown-Harry Boma
85a9e2ed28 Check credit or debit in_account_currency is set before setting (#11253)
* Check credit or debit in_account_currency is set before setting

* Add paying party option to confirm custom doctype can pay
2017-10-21 11:25:40 +05:30
Brown-Harry Boma
f55a33890f Set transaction type in pricing rule only if unavailable (#11228) 2017-10-18 11:07:26 +05:30
Prateeksha Singh
ec992df81a [fix] Check for stock_qty, else use qty (#10937) 2017-09-27 18:33:01 +05:30
Prateeksha Singh
6f191eda99 [fix] batch qty checked against stock_qty field (#10906) 2017-09-27 15:34:23 +05:30
rohitwaghchaure
3318926b23 [hotfix] Wrong calculation of total in taxes and totals (#10924) 2017-09-27 13:32:27 +05:30
8 changed files with 37 additions and 19 deletions

View File

@@ -30,8 +30,7 @@ class PaymentReconciliation(Document):
return payment_entries
def get_jv_entries(self):
dr_or_cr = "credit_in_account_currency" if self.party_type == "Customer" \
else "debit_in_account_currency"
dr_or_cr = self.get_dr_or_cr()
bank_account_condition = "t2.against_account like %(bank_cash_account)s" \
if self.bank_cash_account else "1=1"
@@ -73,13 +72,13 @@ class PaymentReconciliation(Document):
row = self.append('payments', {})
row.update(e)
def get_invoice_entries(self):
def get_invoice_entries(self, paying_party=False):
#Fetch JVs, Sales and Purchase Invoices for 'invoices' to reconcile against
condition = self.check_condition()
non_reconciled_invoices = get_outstanding_invoices(self.party_type, self.party,
self.receivable_payable_account, condition=condition)
self.receivable_payable_account, condition=condition, paying_party=paying_party)
self.add_invoice_entries(non_reconciled_invoices)
@@ -103,8 +102,7 @@ class PaymentReconciliation(Document):
self.get_invoice_entries()
self.validate_invoice()
dr_or_cr = "credit_in_account_currency" \
if self.party_type == "Customer" else "debit_in_account_currency"
dr_or_cr = self.get_dr_or_cr()
lst = []
for e in self.get('payments'):
@@ -184,3 +182,12 @@ class PaymentReconciliation(Document):
cond += " and `{0}` <= {1}".format(dr_or_cr, flt(self.maximum_amount))
return cond
def get_dr_or_cr(self):
'''Return credit_in_account_currency if not set and party is customer.'''
if hasattr(self, "dr_or_cr"):
return self.dr_or_cr
if self.party_type == 'Customer':
return "credit_in_account_currency"
else:
return "debit_in_account_currency"

View File

@@ -348,6 +348,7 @@ def apply_internal_priority(pricing_rules, field_set, args):
return filtered_rules or pricing_rules
def set_transaction_type(args):
if args.transaction_type:return
if args.doctype in ("Opportunity", "Quotation", "Sales Order", "Delivery Note", "Sales Invoice"):
args.transaction_type = "selling"
elif args.doctype in ("Material Request", "Supplier Quotation", "Purchase Order",

View File

@@ -83,7 +83,7 @@ frappe.query_reports["General Ledger"] = {
return;
}
var fieldname = party_type.toLowerCase() + "_name";
var fieldname = frappe.model.scrub(party_type)+"_name";
frappe.db.get_value(party_type, party, fieldname, function(value) {
frappe.query_report_filters_by_name.party_name.set_value(value[fieldname]);
});

View File

@@ -569,11 +569,11 @@ def get_stock_rbnb_difference(posting_date, company):
# Amount should be credited
return flt(stock_rbnb) + flt(sys_bal)
def get_outstanding_invoices(party_type, party, account, condition=None):
def get_outstanding_invoices(party_type, party, account, condition=None, paying_party=False):
outstanding_invoices = []
precision = frappe.get_precision("Sales Invoice", "outstanding_amount")
if party_type=="Customer":
if party_type=="Customer" or paying_party:
dr_or_cr = "debit_in_account_currency - credit_in_account_currency"
payment_dr_or_cr = "payment_gl_entry.credit_in_account_currency - payment_gl_entry.debit_in_account_currency"
else:

View File

@@ -288,8 +288,11 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
},
set_cumulative_total: function(row_idx, tax) {
var tax_amount = (in_list(["Valuation and Total", "Total"], tax.category) ?
tax.tax_amount_after_discount_amount : 0);
var tax_amount = tax.tax_amount_after_discount_amount;
if (tax.category == 'Valuation') {
tax_amount = 0;
}
if (tax.add_deduct_tax == "Deduct") { tax_amount = -1*tax_amount; }
if(row_idx==0) {

View File

@@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe, os, json
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
from frappe.permissions import add_permission
from erpnext.regional.india import states
@@ -148,7 +148,11 @@ def make_custom_fields():
'Purchase Invoice Item': [hsn_sac_field]
}
create_custom_fields(custom_fields)
for dt, data in custom_fields.iteritems():
for df in data:
create_custom_field(dt, df)
# create_custom_fields(custom_fields)
def make_fixtures():
docs = [

View File

@@ -1,6 +1,6 @@
from __future__ import unicode_literals
import frappe
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
from frappe import _
@@ -21,11 +21,13 @@ def make_custom_fields():
'Sales Invoice': [
dict(fieldname='appointment', label='Patient Appointment',
fieldtype='Link', options='Patient Appointment',
insert_after='customer')
insert_after='customer',print_hide=0)
]
}
create_custom_fields(custom_fields)
for dt, data in custom_fields.iteritems():
for df in data:
create_custom_field(dt, df)
def create_medical_departments():

View File

@@ -103,14 +103,15 @@ def split_batch(batch_no, item_code, warehouse, qty, new_batch_id = None):
def set_batch_nos(doc, warehouse_field, throw = False):
'''Automatically select `batch_no` for outgoing items in item table'''
for d in doc.items:
qty = d.get('stock_qty') or d.get('qty') or 0
has_batch_no = frappe.db.get_value('Item', d.item_code, 'has_batch_no')
warehouse = d.get(warehouse_field, None)
if has_batch_no and warehouse and d.qty > 0:
if has_batch_no and warehouse and qty > 0:
if not d.batch_no:
d.batch_no = get_batch_no(d.item_code, warehouse, d.qty, throw)
d.batch_no = get_batch_no(d.item_code, warehouse, qty, throw)
else:
batch_qty = get_batch_qty(batch_no=d.batch_no, warehouse=warehouse)
if flt(batch_qty) < flt(d.qty):
if flt(batch_qty) < flt(qty):
frappe.throw(_("Row #{0}: The batch {1} has only {2} qty. Please select another batch which has {3} qty available or split the row into multiple rows, to deliver/issue from multiple batches").format(d.idx, d.batch_no, batch_qty, d.qty))
def get_batch_no(item_code, warehouse, qty, throw=False):