Merge pull request #9815 from nabinhait/develop
Set company address while making invoice from SO, don't show taxes in print if amount is zero, fixed state code
This commit is contained in:
commit
de609a2fb6
@ -8,9 +8,10 @@ import datetime
|
||||
from frappe import _, msgprint, scrub
|
||||
from frappe.defaults import get_user_permissions
|
||||
from frappe.model.utils import get_fetch_values
|
||||
from frappe.utils import add_days, getdate, formatdate, get_first_day, date_diff, \
|
||||
add_years, get_timestamp, nowdate, flt
|
||||
from frappe.contacts.doctype.address.address import get_address_display, get_default_address
|
||||
from frappe.utils import (add_days, getdate, formatdate, get_first_day, date_diff,
|
||||
add_years, get_timestamp, nowdate, flt)
|
||||
from frappe.contacts.doctype.address.address import (get_address_display,
|
||||
get_default_address, get_company_address)
|
||||
from frappe.contacts.doctype.contact.contact import get_contact_details, get_default_contact
|
||||
from erpnext.exceptions import PartyFrozen, PartyDisabled, InvalidAccountCurrency
|
||||
from erpnext.accounts.utils import get_fiscal_year
|
||||
@ -77,8 +78,9 @@ def set_address_details(out, party, party_type, doctype=None, company=None):
|
||||
out.update(get_fetch_values(doctype, 'shipping_address_name', out.shipping_address_name))
|
||||
|
||||
if doctype and doctype in ['Sales Invoice']:
|
||||
out.company_address = get_default_address('Company', company)
|
||||
out.update(get_fetch_values(doctype, 'company_address', out.company_address))
|
||||
out.update(get_company_address(company))
|
||||
if out.company_address:
|
||||
out.update(get_fetch_values(doctype, 'company_address', out.company_address))
|
||||
|
||||
def set_contact_details(out, party, party_type):
|
||||
out.contact_person = get_default_contact(party_type, party.name)
|
||||
|
@ -559,7 +559,7 @@ class calculate_taxes_and_totals(object):
|
||||
|
||||
item_tax[item_code][tax.name] = [tax_rate, tax_amount]
|
||||
else:
|
||||
item_tax[item_code][tax.name] = [cstr(flt(tax_data, tax_rate_precision)) + "%", ""]
|
||||
item_tax[item_code][tax.name] = [cstr(flt(tax_data, tax_rate_precision)) + "%", "0.00"]
|
||||
tax_accounts.append([tax.name, tax.account_head])
|
||||
|
||||
return item_tax, tax_accounts
|
||||
|
@ -415,4 +415,5 @@ erpnext.patches.v8_1.removed_roles_from_gst_report_non_indian_account
|
||||
erpnext.patches.v8_1.gst_fixes #2017-07-06
|
||||
erpnext.patches.v8_0.update_production_orders
|
||||
erpnext.patches.v8_1.remove_sales_invoice_from_returned_serial_no
|
||||
erpnext.patches.v8_1.allow_invoice_copy_to_edit_after_submit
|
||||
erpnext.patches.v8_1.allow_invoice_copy_to_edit_after_submit
|
||||
erpnext.patches.v8_1.update_gst_state
|
6
erpnext/patches/v8_1/update_gst_state.py
Normal file
6
erpnext/patches/v8_1/update_gst_state.py
Normal file
@ -0,0 +1,6 @@
|
||||
import frappe
|
||||
from erpnext.regional.india import states
|
||||
|
||||
def execute():
|
||||
frappe.db.sql("update `tabCustom Field` set options=%s where fieldname='gst_state'", '\n'.join(states))
|
||||
frappe.db.sql("update `tabAddress` set gst_state='Chhattisgarh' where gst_state='Chattisgarh'")
|
@ -675,7 +675,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
||||
|
||||
item_tax[item_code][tax.name] = [tax_rate, tax_amount];
|
||||
} else {
|
||||
item_tax[item_code][tax.name] = [flt(tax_data, tax_rate_precision) + "%", ""];
|
||||
item_tax[item_code][tax.name] = [flt(tax_data, tax_rate_precision) + "%", "0.00"];
|
||||
}
|
||||
});
|
||||
tax_accounts.push([tax.name, tax.account_head]);
|
||||
|
@ -6,7 +6,7 @@ states = [
|
||||
'Assam',
|
||||
'Bihar',
|
||||
'Chandigarh',
|
||||
'Chattisgarh',
|
||||
'Chhattisgarh',
|
||||
'Dadra and Nagar Haveli',
|
||||
'Daman and Diu',
|
||||
'Delhi',
|
||||
@ -26,6 +26,7 @@ states = [
|
||||
'Mizoram',
|
||||
'Nagaland',
|
||||
'Odisha',
|
||||
'Other Territory',
|
||||
'Pondicherry',
|
||||
'Punjab',
|
||||
'Rajasthan',
|
||||
@ -45,7 +46,7 @@ state_numbers = {
|
||||
"Assam": "18",
|
||||
"Bihar": "10",
|
||||
"Chandigarh": "04",
|
||||
"Chattisgarh": "22",
|
||||
"Chhattisgarh": "22",
|
||||
"Dadra and Nagar Haveli": "26",
|
||||
"Daman and Diu": "25",
|
||||
"Delhi": "07",
|
||||
@ -65,6 +66,7 @@ state_numbers = {
|
||||
"Mizoram": "15",
|
||||
"Nagaland": "13",
|
||||
"Odisha": "21",
|
||||
"Other Territory": "98",
|
||||
"Pondicherry": "34",
|
||||
"Punjab": "03",
|
||||
"Rajasthan": "08",
|
||||
@ -74,5 +76,5 @@ state_numbers = {
|
||||
"Tripura": "16",
|
||||
"Uttar Pradesh": "09",
|
||||
"Uttarakhand": "05",
|
||||
"West Bengal": "19"
|
||||
"West Bengal": "19",
|
||||
}
|
@ -7,11 +7,12 @@ import json
|
||||
import frappe.utils
|
||||
from frappe.utils import cstr, flt, getdate, comma_and, cint
|
||||
from frappe import _
|
||||
from frappe.model.utils import get_fetch_values
|
||||
from frappe.model.mapper import get_mapped_doc
|
||||
from erpnext.stock.stock_balance import update_bin_qty, get_reserved_qty
|
||||
from frappe.desk.notifications import clear_doctype_notifications
|
||||
from erpnext.controllers.recurring_document import month_map, get_next_date
|
||||
|
||||
from frappe.contacts.doctype.address.address import get_company_address
|
||||
from erpnext.controllers.selling_controller import SellingController
|
||||
|
||||
form_grid_templates = {
|
||||
@ -504,6 +505,11 @@ def make_sales_invoice(source_name, target_doc=None, ignore_permissions=False):
|
||||
target.run_method("set_missing_values")
|
||||
target.run_method("calculate_taxes_and_totals")
|
||||
|
||||
# set company address
|
||||
target.update(get_company_address(target.company))
|
||||
if target.company_address:
|
||||
target.update(get_fetch_values("Sales Invoice", 'company_address', target.company_address))
|
||||
|
||||
def update_item(source, target, source_parent):
|
||||
target.amount = flt(source.amount) - flt(source.billed_amt)
|
||||
target.base_amount = target.amount * flt(source_parent.conversion_rate)
|
||||
|
@ -8,10 +8,12 @@ from frappe.utils import flt, cint
|
||||
|
||||
from frappe import msgprint, _
|
||||
import frappe.defaults
|
||||
from frappe.model.utils import get_fetch_values
|
||||
from frappe.model.mapper import get_mapped_doc
|
||||
from erpnext.controllers.selling_controller import SellingController
|
||||
from frappe.desk.notifications import clear_doctype_notifications
|
||||
from erpnext.stock.doctype.batch.batch import set_batch_nos
|
||||
from frappe.contacts.doctype.address.address import get_company_address
|
||||
|
||||
form_grid_templates = {
|
||||
"items": "templates/form_grid/item_grid.html"
|
||||
@ -371,7 +373,7 @@ def get_invoiced_qty_map(delivery_note):
|
||||
def make_sales_invoice(source_name, target_doc=None):
|
||||
invoiced_qty_map = get_invoiced_qty_map(source_name)
|
||||
|
||||
def update_accounts(source, target):
|
||||
def set_missing_values(source, target):
|
||||
target.is_pos = 0
|
||||
target.ignore_pricing_rule = 1
|
||||
target.run_method("set_missing_values")
|
||||
@ -381,6 +383,11 @@ def make_sales_invoice(source_name, target_doc=None):
|
||||
|
||||
target.run_method("calculate_taxes_and_totals")
|
||||
|
||||
# set company address
|
||||
target.update(get_company_address(target.company))
|
||||
if target.company_address:
|
||||
target.update(get_fetch_values("Sales Invoice", 'company_address', target.company_address))
|
||||
|
||||
def update_item(source_doc, target_doc, source_parent):
|
||||
target_doc.qty = source_doc.qty - invoiced_qty_map.get(source_doc.name, 0)
|
||||
|
||||
@ -415,7 +422,7 @@ def make_sales_invoice(source_name, target_doc=None):
|
||||
},
|
||||
"add_if_empty": True
|
||||
}
|
||||
}, target_doc, update_accounts)
|
||||
}, target_doc, set_missing_values)
|
||||
|
||||
return doc
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
{{ render_discount_amount(doc) }}
|
||||
{%- endif -%}
|
||||
{%- for charge in data -%}
|
||||
{%- if not charge.included_in_print_rate -%}
|
||||
{%- if charge.tax_amount and not charge.included_in_print_rate -%}
|
||||
<div class="row">
|
||||
<div class="col-xs-5 {%- if not doc._align_labels_left %} text-right{%- endif -%}">
|
||||
<label>{{ charge.get_formatted("description") }}</label></div>
|
||||
|
Loading…
Reference in New Issue
Block a user