Merge branch 'develop' into purchase-taxes-and-charges-account-name-issue

This commit is contained in:
Jannat Patel 2020-11-11 16:46:01 +05:30 committed by GitHub
commit a9e02bba77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 68 additions and 41 deletions

View File

@ -160,6 +160,8 @@ class ReceivablePayableReport(object):
else: else:
# advance / unlinked payment or other adjustment # advance / unlinked payment or other adjustment
row.paid -= gle_balance row.paid -= gle_balance
if gle.cost_center:
row.cost_center = str(gle.cost_center)
def update_sub_total_row(self, row, party): def update_sub_total_row(self, row, party):
total_row = self.total_row_map.get(party) total_row = self.total_row_map.get(party)
@ -210,7 +212,6 @@ class ReceivablePayableReport(object):
for key, row in self.voucher_balance.items(): for key, row in self.voucher_balance.items():
row.outstanding = flt(row.invoiced - row.paid - row.credit_note, self.currency_precision) row.outstanding = flt(row.invoiced - row.paid - row.credit_note, self.currency_precision)
row.invoice_grand_total = row.invoiced row.invoice_grand_total = row.invoiced
if abs(row.outstanding) > 1.0/10 ** self.currency_precision: if abs(row.outstanding) > 1.0/10 ** self.currency_precision:
# non-zero oustanding, we must consider this row # non-zero oustanding, we must consider this row
@ -577,7 +578,7 @@ class ReceivablePayableReport(object):
self.gl_entries = frappe.db.sql(""" self.gl_entries = frappe.db.sql("""
select select
name, posting_date, account, party_type, party, voucher_type, voucher_no, name, posting_date, account, party_type, party, voucher_type, voucher_no, cost_center,
against_voucher_type, against_voucher, account_currency, remarks, {0} against_voucher_type, against_voucher, account_currency, remarks, {0}
from from
`tabGL Entry` `tabGL Entry`
@ -741,6 +742,7 @@ class ReceivablePayableReport(object):
self.add_column(_("Customer Contact"), fieldname='customer_primary_contact', self.add_column(_("Customer Contact"), fieldname='customer_primary_contact',
fieldtype='Link', options='Contact') fieldtype='Link', options='Contact')
self.add_column(label=_('Cost Center'), fieldname='cost_center', fieldtype='Data')
self.add_column(label=_('Voucher Type'), fieldname='voucher_type', fieldtype='Data') self.add_column(label=_('Voucher Type'), fieldname='voucher_type', fieldtype='Data')
self.add_column(label=_('Voucher No'), fieldname='voucher_no', fieldtype='Dynamic Link', self.add_column(label=_('Voucher No'), fieldname='voucher_no', fieldtype='Dynamic Link',
options='voucher_type', width=180) options='voucher_type', width=180)

View File

@ -1,12 +1,14 @@
{ {
"actions": [],
"autoname": "Prompt", "autoname": "Prompt",
"creation": "2019-06-05 11:48:30.572795", "creation": "2019-06-05 11:48:30.572795",
"doctype": "DocType", "doctype": "DocType",
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"communication_channel",
"communication_medium_type", "communication_medium_type",
"catch_all",
"column_break_3", "column_break_3",
"catch_all",
"provider", "provider",
"disabled", "disabled",
"timeslots_section", "timeslots_section",
@ -54,9 +56,16 @@
"fieldtype": "Table", "fieldtype": "Table",
"label": "Timeslots", "label": "Timeslots",
"options": "Communication Medium Timeslot" "options": "Communication Medium Timeslot"
},
{
"fieldname": "communication_channel",
"fieldtype": "Select",
"label": "Communication Channel",
"options": "\nExotel"
} }
], ],
"modified": "2019-06-05 11:49:30.769006", "links": [],
"modified": "2020-10-27 16:22:08.068542",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Communication", "module": "Communication",
"name": "Communication Medium", "name": "Communication Medium",

View File

@ -15,10 +15,10 @@ app_logo_url = '/assets/erpnext/images/erp-icon.svg'
develop_version = '13.x.x-develop' develop_version = '13.x.x-develop'
app_include_js = "assets/js/erpnext.min.js" app_include_js = "/assets/js/erpnext.min.js"
app_include_css = "assets/css/erpnext.css" app_include_css = "/assets/css/erpnext.css"
web_include_js = "assets/js/erpnext-web.min.js" web_include_js = "/assets/js/erpnext-web.min.js"
web_include_css = "assets/css/erpnext-web.css" web_include_css = "/assets/css/erpnext-web.css"
doctype_js = { doctype_js = {
"Address": "public/js/address.js", "Address": "public/js/address.js",

View File

@ -45,7 +45,7 @@ erpnext.salary_slip_deductions_report_filters = {
}, },
{ {
fieldname: "branch", fieldname: "branch",
label: __("Barnch"), label: __("Branch"),
fieldtype: "Link", fieldtype: "Link",
options: "Branch", options: "Branch",
} }
@ -63,4 +63,4 @@ erpnext.salary_slip_deductions_report_filters = {
} }
}); });
} }
} }

View File

@ -15,8 +15,7 @@ REQUIRED_FIELDS = {
}, },
{ {
"field_name": "taxes", "field_name": "taxes",
"regulation": "§ 14 Abs. 4 Nr. 8 UStG", "regulation": "§ 14 Abs. 4 Nr. 8 UStG"
"condition": "not exempt_from_sales_tax"
}, },
{ {
"field_name": "customer_address", "field_name": "customer_address",

View File

@ -155,20 +155,22 @@ def get_header(filters, csv_class):
return header return header
def download_csv_files_as_zip(csv_data_list): def zip_and_download(zip_filename, csv_files):
""" """
Put CSV files in a zip archive and send that to the client. Put CSV files in a zip archive and send that to the client.
Params: Params:
csv_data_list -- list of dicts [{'file_name': 'EXTF_Buchunsstapel.zip', 'csv_data': get_datev_csv()}] zip_filename Name of the zip file
csv_files list of dicts [{'file_name': 'my_file.csv', 'csv_data': 'comma,separated,values'}]
""" """
zip_buffer = BytesIO() zip_buffer = BytesIO()
datev_zip = zipfile.ZipFile(zip_buffer, mode='w', compression=zipfile.ZIP_DEFLATED) zip_file = zipfile.ZipFile(zip_buffer, mode='w', compression=zipfile.ZIP_DEFLATED)
for csv_file in csv_data_list: for csv_file in csv_files:
datev_zip.writestr(csv_file.get('file_name'), csv_file.get('csv_data')) zip_file.writestr(csv_file.get('file_name'), csv_file.get('csv_data'))
datev_zip.close()
zip_file.close()
frappe.response['filecontent'] = zip_buffer.getvalue() frappe.response['filecontent'] = zip_buffer.getvalue()
frappe.response['filename'] = 'DATEV.zip' frappe.response['filename'] = zip_filename
frappe.response['type'] = 'binary' frappe.response['type'] = 'binary'

View File

@ -11,10 +11,11 @@ from __future__ import unicode_literals
import json import json
import frappe import frappe
from frappe import _
from six import string_types from six import string_types
from frappe import _
from erpnext.accounts.utils import get_fiscal_year from erpnext.accounts.utils import get_fiscal_year
from erpnext.regional.germany.utils.datev.datev_csv import download_csv_files_as_zip, get_datev_csv from erpnext.regional.germany.utils.datev.datev_csv import zip_and_download, get_datev_csv
from erpnext.regional.germany.utils.datev.datev_constants import Transactions, DebtorsCreditors, AccountNames from erpnext.regional.germany.utils.datev.datev_constants import Transactions, DebtorsCreditors, AccountNames
COLUMNS = [ COLUMNS = [
@ -344,7 +345,8 @@ def download_datev_csv(filters):
customers = get_customers(filters) customers = get_customers(filters)
suppliers = get_suppliers(filters) suppliers = get_suppliers(filters)
download_csv_files_as_zip([ zip_name = '{} DATEV.zip'.format(frappe.utils.datetime.date.today())
zip_and_download(zip_name, [
{ {
'file_name': 'EXTF_Buchungsstapel.csv', 'file_name': 'EXTF_Buchungsstapel.csv',
'csv_data': get_datev_csv(transactions, filters, csv_class=Transactions) 'csv_data': get_datev_csv(transactions, filters, csv_class=Transactions)

View File

@ -90,29 +90,41 @@ frappe.ui.form.on("Company", {
frm.toggle_enable("default_currency", (frm.doc.__onload && frm.toggle_enable("default_currency", (frm.doc.__onload &&
!frm.doc.__onload.transactions_exist)); !frm.doc.__onload.transactions_exist));
frm.add_custom_button(__('Create Tax Template'), function() { if (frm.has_perm('write')) {
frm.trigger("make_default_tax_template"); frm.add_custom_button(__('Create Tax Template'), function() {
}); frm.trigger("make_default_tax_template");
});
}
frm.add_custom_button(__('Cost Centers'), function() { if (frappe.perm.has_perm("Cost Center", 0, 'read')) {
frappe.set_route('Tree', 'Cost Center', {'company': frm.doc.name}) frm.add_custom_button(__('Cost Centers'), function() {
}, __("View")); frappe.set_route('Tree', 'Cost Center', {'company': frm.doc.name});
}, __("View"));
}
frm.add_custom_button(__('Chart of Accounts'), function() { if (frappe.perm.has_perm("Account", 0, 'read')) {
frappe.set_route('Tree', 'Account', {'company': frm.doc.name}) frm.add_custom_button(__('Chart of Accounts'), function() {
}, __("View")); frappe.set_route('Tree', 'Account', {'company': frm.doc.name});
}, __("View"));
}
frm.add_custom_button(__('Sales Tax Template'), function() { if (frappe.perm.has_perm("Sales Taxes and Charges Template", 0, 'read')) {
frappe.set_route('List', 'Sales Taxes and Charges Template', {'company': frm.doc.name}); frm.add_custom_button(__('Sales Tax Template'), function() {
}, __("View")); frappe.set_route('List', 'Sales Taxes and Charges Template', {'company': frm.doc.name});
}, __("View"));
}
frm.add_custom_button(__('Purchase Tax Template'), function() { if (frappe.perm.has_perm("Purchase Taxes and Charges Template", 0, 'read')) {
frappe.set_route('List', 'Purchase Taxes and Charges Template', {'company': frm.doc.name}); frm.add_custom_button(__('Purchase Tax Template'), function() {
}, __("View")); frappe.set_route('List', 'Purchase Taxes and Charges Template', {'company': frm.doc.name});
}, __("View"));
}
frm.add_custom_button(__('Default Tax Template'), function() { if (frm.has_perm('write')) {
frm.trigger("make_default_tax_template"); frm.add_custom_button(__('Default Tax Template'), function() {
}, __('Create')); frm.trigger("make_default_tax_template");
}, __('Create'));
}
} }
erpnext.company.set_chart_of_accounts_options(frm.doc); erpnext.company.set_chart_of_accounts_options(frm.doc);

View File

@ -27,7 +27,8 @@ def delete_company_transactions(company_name):
if doctype not in ("Account", "Cost Center", "Warehouse", "Budget", if doctype not in ("Account", "Cost Center", "Warehouse", "Budget",
"Party Account", "Employee", "Sales Taxes and Charges Template", "Party Account", "Employee", "Sales Taxes and Charges Template",
"Purchase Taxes and Charges Template", "POS Profile", "BOM", "Purchase Taxes and Charges Template", "POS Profile", "BOM",
"Company", "Bank Account"): "Company", "Bank Account", "Item Tax Template", "Mode Of Payment",
"Item Default"):
delete_for_doctype(doctype, company_name) delete_for_doctype(doctype, company_name)
# reset company values # reset company values