Merge branch 'develop' into sla_fix
This commit is contained in:
commit
056f20ccaa
@ -458,6 +458,7 @@ class JournalEntry(AccountsController):
|
|||||||
pay_to_recd_from = frappe.db.get_value(d.party_type, d.party,
|
pay_to_recd_from = frappe.db.get_value(d.party_type, d.party,
|
||||||
"customer_name" if d.party_type=="Customer" else "supplier_name")
|
"customer_name" if d.party_type=="Customer" else "supplier_name")
|
||||||
|
|
||||||
|
if pay_to_recd_from and pay_to_recd_from == d.party:
|
||||||
party_amount += (d.debit_in_account_currency or d.credit_in_account_currency)
|
party_amount += (d.debit_in_account_currency or d.credit_in_account_currency)
|
||||||
party_account_currency = d.account_currency
|
party_account_currency = d.account_currency
|
||||||
|
|
||||||
|
|||||||
@ -46,6 +46,8 @@
|
|||||||
var range2 = report.columns[12].label;
|
var range2 = report.columns[12].label;
|
||||||
var range3 = report.columns[13].label;
|
var range3 = report.columns[13].label;
|
||||||
var range4 = report.columns[14].label;
|
var range4 = report.columns[14].label;
|
||||||
|
var range5 = report.columns[15].label;
|
||||||
|
var range6 = report.columns[16].label;
|
||||||
%}
|
%}
|
||||||
{% if(balance_row) { %}
|
{% if(balance_row) { %}
|
||||||
<table class="table table-bordered table-condensed">
|
<table class="table table-bordered table-condensed">
|
||||||
@ -58,6 +60,8 @@
|
|||||||
<col style="width: 18mm;">
|
<col style="width: 18mm;">
|
||||||
<col style="width: 18mm;">
|
<col style="width: 18mm;">
|
||||||
<col style="width: 18mm;">
|
<col style="width: 18mm;">
|
||||||
|
<col style="width: 18mm;">
|
||||||
|
<col style="width: 18mm;">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
|
|
||||||
<thead>
|
<thead>
|
||||||
@ -67,16 +71,20 @@
|
|||||||
<th>{%= __(range2) %}</th>
|
<th>{%= __(range2) %}</th>
|
||||||
<th>{%= __(range3) %}</th>
|
<th>{%= __(range3) %}</th>
|
||||||
<th>{%= __(range4) %}</th>
|
<th>{%= __(range4) %}</th>
|
||||||
|
<th>{%= __(range5) %}</th>
|
||||||
|
<th>{%= __(range6) %}</th>
|
||||||
<th>{%= __("Total") %}</th>
|
<th>{%= __("Total") %}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>{%= __("Total Outstanding") %}</td>
|
<td>{%= __("Total Outstanding") %}</td>
|
||||||
<td class="text-right">{%= format_currency(balance_row[range1]) %}</td>
|
<td class="text-right">{%= format_number(balance_row[range1], null, 2) %}</td>
|
||||||
<td class="text-right">{%= format_currency(balance_row[range2]) %}</td>
|
<td class="text-right">{%= format_currency(balance_row[range2]) %}</td>
|
||||||
<td class="text-right">{%= format_currency(balance_row[range3]) %}</td>
|
<td class="text-right">{%= format_currency(balance_row[range3]) %}</td>
|
||||||
<td class="text-right">{%= format_currency(balance_row[range4]) %}</td>
|
<td class="text-right">{%= format_currency(balance_row[range4]) %}</td>
|
||||||
|
<td class="text-right">{%= format_currency(balance_row[range5]) %}</td>
|
||||||
|
<td class="text-right">{%= format_currency(balance_row[range6]) %}</td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{%= format_currency(flt(balance_row[("outstanding_amount")]), data[data.length-1]["currency"]) %}
|
{%= format_currency(flt(balance_row[("outstanding_amount")]), data[data.length-1]["currency"]) %}
|
||||||
</td>
|
</td>
|
||||||
@ -86,6 +94,8 @@
|
|||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
{%= format_currency(flt(balance_row[("pdc/lc_amount")]), data[data.length-1]["currency"]) %}
|
{%= format_currency(flt(balance_row[("pdc/lc_amount")]), data[data.length-1]["currency"]) %}
|
||||||
</td>
|
</td>
|
||||||
@ -95,6 +105,8 @@
|
|||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
<th class="text-right">
|
<th class="text-right">
|
||||||
{%= format_currency(flt(balance_row[("outstanding_amount")]-balance_row[("pdc/lc_amount")]), data[data.length-1]["currency"]) %}</th>
|
{%= format_currency(flt(balance_row[("outstanding_amount")]-balance_row[("pdc/lc_amount")]), data[data.length-1]["currency"]) %}</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@ -40,7 +40,7 @@ def execute():
|
|||||||
# This is probably never used anywhere else as of now, but should be
|
# This is probably never used anywhere else as of now, but should be
|
||||||
values = []
|
values = []
|
||||||
for d in batch_transactions:
|
for d in batch_transactions:
|
||||||
values.append("('{}', {})".format(d.parent, d.qty))
|
values.append("('{}', {})".format(frappe.db.escape(d.parent), d.qty))
|
||||||
conditions = ",".join(values)
|
conditions = ",".join(values)
|
||||||
frappe.db.sql("""
|
frappe.db.sql("""
|
||||||
INSERT INTO `tab{}` (name, total_qty) VALUES {}
|
INSERT INTO `tab{}` (name, total_qty) VALUES {}
|
||||||
|
|||||||
@ -60,8 +60,11 @@ class Gstr1Report(object):
|
|||||||
else:
|
else:
|
||||||
for inv, items_based_on_rate in self.items_based_on_tax_rate.items():
|
for inv, items_based_on_rate in self.items_based_on_tax_rate.items():
|
||||||
invoice_details = self.invoices.get(inv)
|
invoice_details = self.invoices.get(inv)
|
||||||
for rate, items in items_based_on_rate.items():
|
for key, items in items_based_on_rate.items():
|
||||||
row, taxable_value = self.get_row_data_for_invoice(inv, invoice_details, rate, items)
|
rate = key[0]
|
||||||
|
account = key[1]
|
||||||
|
|
||||||
|
row, taxable_value = self.get_row_data_for_invoice(inv, invoice_details, rate, account, items)
|
||||||
|
|
||||||
if self.filters.get("type_of_business") == "CDNR":
|
if self.filters.get("type_of_business") == "CDNR":
|
||||||
row.append("Y" if invoice_details.posting_date <= date(2017, 7, 1) else "N")
|
row.append("Y" if invoice_details.posting_date <= date(2017, 7, 1) else "N")
|
||||||
@ -100,7 +103,7 @@ class Gstr1Report(object):
|
|||||||
for key, value in iteritems(b2cs_output):
|
for key, value in iteritems(b2cs_output):
|
||||||
self.data.append(value)
|
self.data.append(value)
|
||||||
|
|
||||||
def get_row_data_for_invoice(self, invoice, invoice_details, tax_rate, items):
|
def get_row_data_for_invoice(self, invoice, invoice_details, tax_rate, account, items):
|
||||||
row = []
|
row = []
|
||||||
for fieldname in self.invoice_fields:
|
for fieldname in self.invoice_fields:
|
||||||
if self.filters.get("type_of_business") == "CDNR" and fieldname == "invoice_value":
|
if self.filters.get("type_of_business") == "CDNR" and fieldname == "invoice_value":
|
||||||
@ -117,7 +120,9 @@ class Gstr1Report(object):
|
|||||||
taxable_value = 0
|
taxable_value = 0
|
||||||
for item_code, net_amount in self.invoice_items.get(invoice).items():
|
for item_code, net_amount in self.invoice_items.get(invoice).items():
|
||||||
if item_code in items:
|
if item_code in items:
|
||||||
if self.item_tax_rate.get(invoice) and tax_rate == self.item_tax_rate.get(invoice, {}).get(item_code):
|
if self.item_tax_rate.get(invoice) and self.item_tax_rate.get(invoice, {}).get(item_code):
|
||||||
|
item_tax_rate = self.item_tax_rate.get(invoice, {}).get(item_code)
|
||||||
|
if account in item_tax_rate and tax_rate == item_tax_rate.get(account):
|
||||||
taxable_value += abs(net_amount)
|
taxable_value += abs(net_amount)
|
||||||
elif not self.item_tax_rate.get(invoice):
|
elif not self.item_tax_rate.get(invoice):
|
||||||
taxable_value += abs(net_amount)
|
taxable_value += abs(net_amount)
|
||||||
@ -207,8 +212,7 @@ class Gstr1Report(object):
|
|||||||
item_tax_rate = json.loads(d.item_tax_rate)
|
item_tax_rate = json.loads(d.item_tax_rate)
|
||||||
|
|
||||||
if item_tax_rate:
|
if item_tax_rate:
|
||||||
for account, rate in item_tax_rate.items():
|
self.item_tax_rate.setdefault(d.parent, {}).setdefault(d.item_code, item_tax_rate)
|
||||||
self.item_tax_rate.setdefault(d.parent, {}).setdefault(d.item_code, rate)
|
|
||||||
|
|
||||||
def get_items_based_on_tax_rate(self):
|
def get_items_based_on_tax_rate(self):
|
||||||
self.tax_details = frappe.db.sql("""
|
self.tax_details = frappe.db.sql("""
|
||||||
@ -248,7 +252,7 @@ class Gstr1Report(object):
|
|||||||
tax_rate *= 2
|
tax_rate *= 2
|
||||||
|
|
||||||
rate_based_dict = self.items_based_on_tax_rate\
|
rate_based_dict = self.items_based_on_tax_rate\
|
||||||
.setdefault(parent, {}).setdefault(tax_rate, [])
|
.setdefault(parent, {}).setdefault((tax_rate, account), [])
|
||||||
if item_code not in rate_based_dict:
|
if item_code not in rate_based_dict:
|
||||||
rate_based_dict.append(item_code)
|
rate_based_dict.append(item_code)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|||||||
@ -680,8 +680,7 @@ class StockEntry(StockController):
|
|||||||
'description' : item.description,
|
'description' : item.description,
|
||||||
'image' : item.image,
|
'image' : item.image,
|
||||||
'item_name' : item.item_name,
|
'item_name' : item.item_name,
|
||||||
'expense_account' : args.get("expense_account"),
|
'cost_center' : get_default_cost_center(args, item, item_group_defaults, brand_defaults, self.company),
|
||||||
'cost_center' : get_default_cost_center(args, item, item_group_defaults, brand_defaults),
|
|
||||||
'qty' : args.get("qty"),
|
'qty' : args.get("qty"),
|
||||||
'transfer_qty' : args.get('qty'),
|
'transfer_qty' : args.get('qty'),
|
||||||
'conversion_factor' : 1,
|
'conversion_factor' : 1,
|
||||||
@ -693,18 +692,20 @@ class StockEntry(StockController):
|
|||||||
'has_batch_no' : item.has_batch_no,
|
'has_batch_no' : item.has_batch_no,
|
||||||
'sample_quantity' : item.sample_quantity
|
'sample_quantity' : item.sample_quantity
|
||||||
})
|
})
|
||||||
for d in [["Account", "expense_account", "default_expense_account"],
|
|
||||||
["Cost Center", "cost_center", "cost_center"]]:
|
|
||||||
company = frappe.db.get_value(d[0], ret.get(d[1]), "company")
|
|
||||||
if not ret[d[1]] or (company and self.company != company):
|
|
||||||
ret[d[1]] = frappe.get_cached_value('Company', self.company, d[2]) if d[2] else None
|
|
||||||
|
|
||||||
# update uom
|
# update uom
|
||||||
if args.get("uom") and for_update:
|
if args.get("uom") and for_update:
|
||||||
ret.update(get_uom_details(args.get('item_code'), args.get('uom'), args.get('qty')))
|
ret.update(get_uom_details(args.get('item_code'), args.get('uom'), args.get('qty')))
|
||||||
|
|
||||||
if not ret["expense_account"]:
|
if self.purpose == 'Material Issue':
|
||||||
ret["expense_account"] = frappe.get_cached_value('Company', self.company, "stock_adjustment_account")
|
ret["expense_account"] = (item.get("expense_account") or
|
||||||
|
item_group_defaults.get("expense_account") or
|
||||||
|
frappe.get_cached_value('Company', self.company, "default_expense_account"))
|
||||||
|
|
||||||
|
for company_field, field in {'stock_adjustment_account': 'expense_account',
|
||||||
|
'cost_center': 'cost_center'}.items():
|
||||||
|
if not ret.get(field):
|
||||||
|
ret[field] = frappe.get_cached_value('Company', self.company, company_field)
|
||||||
|
|
||||||
args['posting_date'] = self.posting_date
|
args['posting_date'] = self.posting_date
|
||||||
args['posting_time'] = self.posting_time
|
args['posting_time'] = self.posting_time
|
||||||
@ -1084,8 +1085,7 @@ class StockEntry(StockController):
|
|||||||
return item_dict
|
return item_dict
|
||||||
|
|
||||||
def add_to_stock_entry_detail(self, item_dict, bom_no=None):
|
def add_to_stock_entry_detail(self, item_dict, bom_no=None):
|
||||||
expense_account, cost_center = frappe.db.get_values("Company", self.company, \
|
cost_center = frappe.db.get_value("Company", self.company, 'cost_center')
|
||||||
["default_expense_account", "cost_center"])[0]
|
|
||||||
|
|
||||||
for d in item_dict:
|
for d in item_dict:
|
||||||
stock_uom = item_dict[d].get("stock_uom") or frappe.db.get_value("Item", d, "stock_uom")
|
stock_uom = item_dict[d].get("stock_uom") or frappe.db.get_value("Item", d, "stock_uom")
|
||||||
@ -1099,7 +1099,7 @@ class StockEntry(StockController):
|
|||||||
se_child.uom = item_dict[d]["uom"] if item_dict[d].get("uom") else stock_uom
|
se_child.uom = item_dict[d]["uom"] if item_dict[d].get("uom") else stock_uom
|
||||||
se_child.stock_uom = stock_uom
|
se_child.stock_uom = stock_uom
|
||||||
se_child.qty = flt(item_dict[d]["qty"], se_child.precision("qty"))
|
se_child.qty = flt(item_dict[d]["qty"], se_child.precision("qty"))
|
||||||
se_child.expense_account = item_dict[d].get("expense_account") or expense_account
|
se_child.expense_account = item_dict[d].get("expense_account")
|
||||||
se_child.cost_center = item_dict[d].get("cost_center") or cost_center
|
se_child.cost_center = item_dict[d].get("cost_center") or cost_center
|
||||||
se_child.allow_alternative_item = item_dict[d].get("allow_alternative_item", 0)
|
se_child.allow_alternative_item = item_dict[d].get("allow_alternative_item", 0)
|
||||||
se_child.subcontracted_item = item_dict[d].get("main_item_code")
|
se_child.subcontracted_item = item_dict[d].get("main_item_code")
|
||||||
|
|||||||
@ -423,7 +423,7 @@ def get_default_deferred_account(args, item, fieldname=None):
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_default_cost_center(args, item, item_group, brand):
|
def get_default_cost_center(args, item, item_group, brand, company=None):
|
||||||
cost_center = None
|
cost_center = None
|
||||||
if args.get('project'):
|
if args.get('project'):
|
||||||
cost_center = frappe.db.get_value("Project", args.get("project"), "cost_center", cache=True)
|
cost_center = frappe.db.get_value("Project", args.get("project"), "cost_center", cache=True)
|
||||||
@ -434,7 +434,13 @@ def get_default_cost_center(args, item, item_group, brand):
|
|||||||
else:
|
else:
|
||||||
cost_center = item.get('buying_cost_center') or item_group.get('buying_cost_center') or brand.get('buying_cost_center')
|
cost_center = item.get('buying_cost_center') or item_group.get('buying_cost_center') or brand.get('buying_cost_center')
|
||||||
|
|
||||||
return cost_center or args.get("cost_center")
|
cost_center = cost_center or args.get("cost_center")
|
||||||
|
|
||||||
|
if (company and cost_center
|
||||||
|
and frappe.get_cached_value("Cost Center", cost_center, "company") != company):
|
||||||
|
return None
|
||||||
|
|
||||||
|
return cost_center
|
||||||
|
|
||||||
def get_default_supplier(args, item, item_group, brand):
|
def get_default_supplier(args, item, item_group, brand):
|
||||||
return (item.get("default_supplier")
|
return (item.get("default_supplier")
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
{% macro null_card() %}
|
{% macro null_card() %}
|
||||||
<div class="col-sm-4 mb-4 text-left">
|
<div class="col-sm-4 mb-4 text-left">
|
||||||
<div class="h-100" style="border: 1px solid rgba(209,216,221,0.5);border-radius: 0.25rem;background-color: rgb(250, 251, 252);">
|
<div class="h-100 d-none d-sm-block" style="border: 1px solid rgba(209,216,221,0.5);border-radius: 0.25rem;background-color: rgb(250, 251, 252);">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
Loading…
x
Reference in New Issue
Block a user