Compare commits

...

21 Commits

Author SHA1 Message Date
Deepesh Garg
d6da1a93ae chore: version bump 2022-06-14 16:24:13 +05:30
Deepesh Garg
5af2b74039 Merge pull request #31352 from frappe/version-12-hotfix
chore: version-12 release
2022-06-14 16:19:50 +05:30
Marica
1ee62a8342 Merge pull request #31280 from RJPvT/patch-2
fix: locale Currency and Float setting in update_employee
2022-06-09 18:29:56 +05:30
RJPvT
74748c03e2 fix: locale Currency and Float setting in update_employee
In fieldtypes locale settings (example NL) . and , changes whereby the field is inproperly filled
2022-06-08 10:55:15 +02:00
mergify[bot]
73484ef1bc fix(india): e-invoice eligibility if company gstin is not configured (#31276) 2022-06-08 12:55:16 +05:30
mergify[bot]
1c25d7c6f2 fix(india): error while parsing e-invoice (backport #31053) (#31224) 2022-06-06 14:28:40 +05:30
mergify[bot]
432210d13d fix(india): minor e-invoicing fixes (backport #30553) (#31067) 2022-05-19 14:26:38 +05:30
mergify[bot]
836bfc603a fix(stock_ledger): round off values near to zero (#30803)
(cherry picked from commit 6a014d12c1)

Co-authored-by: Ankush Menat <ankush@iwebnotes.com>
2022-04-26 10:16:06 +05:30
mergify[bot]
2d7c678a9d fix: warehouse naming when suffix is present (#30621) (#30768)
(cherry picked from commit be04eaf723)

Co-authored-by: Ankush Menat <ankush@frappe.io>
2022-04-21 12:04:25 +05:30
Ankush Menat
a92c53dd2b chore: disable coverage
coverage adds overhead which isn't necessary on v12 branch now

[skip ci]
2022-04-21 11:41:08 +05:30
mergify[bot]
68fd8a1dcf fix(india): transporter name is null while generating e-way bill (backport #30736) 2022-04-20 19:48:22 +05:30
Ankush Menat
619c178049 chore: bump version 2022-04-10 11:54:57 +05:30
Ankush Menat
579a2366f6 Merge branch 'v12-pre-release' into version-12 2022-04-10 11:54:30 +05:30
mergify[bot]
5b2b76c4a7 fix: dont fetch entire barcode table in get_item_details (#30131) (#30666)
(cherry picked from commit 64905188c4)

Co-authored-by: Ankush Menat <ankush@frappe.io>
2022-04-10 11:52:35 +05:30
Deepesh Garg
5bedb88e62 chore: version bump and release notes 2022-03-28 23:27:54 +05:30
Deepesh Garg
0c4a61d4e6 Merge pull request #30456 from frappe/version-12-hotfix
chore: Release for v12.27.0
2022-03-28 19:20:52 +05:30
Saqib Ansari
c8780b0062 Merge pull request #30401 from nextchamp-saqib/add-client-cred-fields-einvoicing
feat: add client id & client secret fields in e invoice settings
2022-03-25 10:28:57 +05:30
Saqib Ansari
f531d1a69b feat: add client id & client secret fields in e invoice settings 2022-03-24 17:50:05 +05:30
Rucha Mahabal
51aa55f3b0 fix: salary slip amount rounding errors (#30250) 2022-03-15 12:23:48 +05:30
Saqib Ansari
db0e3d3fbe Merge pull request #30088 from frappe/mergify/bp/version-12-hotfix/pr-30084
fix(e-invoicing): remove batch no from e-invoices (backport #30084)
2022-03-07 11:57:29 +05:30
Saqib Ansari
ccffcf2596 fix(e-invoicing): remove batch no from e-invoices
(cherry picked from commit 031a0dd703)
2022-03-07 06:25:43 +00:00
12 changed files with 102 additions and 32 deletions

View File

@@ -16,11 +16,11 @@ jobs:
include:
- name: "Python 2.7 Server Side Test"
python: 2.7
script: bench --site test_site run-tests --app erpnext --coverage
script: bench --site test_site run-tests --app erpnext
- name: "Python 3.6 Server Side Test"
python: 3.6
script: bench --site test_site run-tests --app erpnext --coverage
script: bench --site test_site run-tests --app erpnext
- name: "Python 2.7 Patch Test"
python: 2.7
@@ -74,8 +74,3 @@ install:
- bench get-app erpnext $TRAVIS_BUILD_DIR
- bench start &
- bench --site test_site reinstall --yes
after_script:
- pip install coverage==4.5.4
- pip install python-coveralls
- coveralls -b apps/erpnext -d ../../sites/.coverage

View File

@@ -5,7 +5,7 @@ import frappe
from erpnext.hooks import regional_overrides
from frappe.utils import getdate
__version__ = '12.29.0'
__version__ = '12.31.0'
def get_default_company(user=None):
'''Get default company for user'''

View File

@@ -1,7 +1,8 @@
{%- from "templates/print_formats/standard_macros.html" import add_header, render_field, print_value -%}
{%- set einvoice = json.loads(doc.signed_einvoice) -%}
<div class="page-break">
{% if doc.signed_einvoice %}
{%- set einvoice = json.loads(doc.signed_einvoice) -%}
<div {% if print_settings.repeat_header_footer %} id="header-html" class="hidden-pdf" {% endif %}>
{% if letter_head and not no_letterhead %}
<div class="letter-head">{{ letter_head }}</div>
@@ -163,4 +164,10 @@
</tbody>
</table>
</div>
</div>
{% else %}
<div class="text-center" style="color: #98A1A9; font-size: 14px;">
You must generate IRN before you can preview GST E-Invoice.
</div>
{% endif %}
</div>

View File

@@ -0,0 +1,7 @@
## ERPNext Version 12.29.0 Release Notes
### Fixes & Enhancements
* fix(e-invoicing): remove batch no from e-invoices ([#30088](https://github.com/frappe/erpnext/pull/30088))
* fix: salary slip amount rounding errors ([#30250](https://github.com/frappe/erpnext/pull/30250))
* feat: add client id & client secret fields in e invoice settings ([#30401](https://github.com/frappe/erpnext/pull/30401))

View File

@@ -696,7 +696,7 @@ class SalarySlip(TransactionBase):
# apply rounding
if frappe.get_cached_value("Salary Component", row.salary_component, "round_to_the_nearest_integer"):
amount, additional_amount = rounded(amount), rounded(additional_amount)
amount, additional_amount = rounded(amount or 0), rounded(additional_amount or 0)
return amount, additional_amount

View File

@@ -138,6 +138,8 @@ def update_employee(employee, details, date=None, cancel=False):
new_data = getdate(new_data)
elif fieldtype =="Datetime" and new_data:
new_data = get_datetime(new_data)
elif fieldtype in ["Currency", "Float"] and new_data:
new_data = flt(new_data)
setattr(employee, item.fieldname, new_data)
if item.fieldname in ["department", "designation", "branch"]:
internal_work_history[item.fieldname] = item.new

View File

@@ -9,6 +9,10 @@
"section_break_2",
"sandbox_mode",
"credentials",
"advanced_settings_section",
"client_id",
"column_break_8",
"client_secret",
"auth_token",
"token_expiry"
],
@@ -48,12 +52,32 @@
"fieldname": "sandbox_mode",
"fieldtype": "Check",
"label": "Sandbox Mode"
},
{
"collapsible": 1,
"fieldname": "advanced_settings_section",
"fieldtype": "Section Break",
"label": "Advanced Settings"
},
{
"fieldname": "client_id",
"fieldtype": "Data",
"label": "Client ID"
},
{
"fieldname": "client_secret",
"fieldtype": "Password",
"label": "Client Secret"
},
{
"fieldname": "column_break_8",
"fieldtype": "Column Break"
}
],
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2021-01-13 12:04:49.449199",
"modified": "2021-11-16 19:50:28.029517",
"modified_by": "Administrator",
"module": "Regional",
"name": "E Invoice Settings",

View File

@@ -23,9 +23,5 @@
"StateCesAmt": "{item.state_cess_amount}",
"StateCesNonAdvlAmt": "{item.state_cess_nadv_amount}",
"OthChrg": "{item.other_charges}",
"TotItemVal": "{item.total_value}",
"BchDtls": {{
"Nm": "{item.batch_no}",
"ExpDt": "{item.batch_expiry_date}"
}}
"TotItemVal": "{item.total_value}"
}}

View File

@@ -36,6 +36,7 @@ def validate_eligibility(doc):
return False
invalid_company = not frappe.db.get_value('E Invoice User', { 'company': doc.get('company') })
invalid_company_gstin = not frappe.db.get_value('E Invoice User', {'gstin': doc.get('company_gstin')})
invalid_supply_type = doc.get('gst_category') not in ['Registered Regular', 'SEZ', 'Overseas', 'Deemed Export']
company_transaction = doc.get('billing_address_gstin') == doc.get('company_gstin')
@@ -44,7 +45,7 @@ def validate_eligibility(doc):
no_taxes_applied = not doc.get('taxes') and not doc.get('gst_category') == 'Overseas'
has_non_gst_item = any(d for d in doc.get('items', []) if d.get('is_non_gst'))
if invalid_company or invalid_supply_type or company_transaction or no_taxes_applied or has_non_gst_item:
if invalid_company or invalid_company_gstin or invalid_supply_type or company_transaction or no_taxes_applied or has_non_gst_item:
return False
return True
@@ -200,8 +201,6 @@ def get_item_list(invoice):
item.taxable_value = abs(item.taxable_value)
item.discount_amount = 0
item.batch_expiry_date = frappe.db.get_value('Batch', d.batch_no, 'expiry_date') if d.batch_no else None
item.batch_expiry_date = format_date(item.batch_expiry_date, 'dd/mm/yyyy') if item.batch_expiry_date else None
item.is_service_item = 'Y' if item.gst_hsn_code and item.gst_hsn_code[:2] == "99" else 'N'
item.serial_no = ""
@@ -308,7 +307,7 @@ def update_other_charges(tax_row, invoice_value_details, gst_accounts_list, invo
def get_payment_details(invoice):
payee_name = invoice.company
mode_of_payment = ', '.join([d.mode_of_payment for d in invoice.payments])
mode_of_payment = ""
paid_amount = invoice.base_paid_amount
outstanding_amount = invoice.outstanding_amount
@@ -459,10 +458,16 @@ def make_einvoice(invoice):
try:
einvoice = safe_json_load(einvoice)
einvoice = santize_einvoice_fields(einvoice)
except json.JSONDecodeError:
raise
except Exception:
show_link_to_error_log(invoice, einvoice)
validate_totals(einvoice)
try:
validate_totals(einvoice)
except Exception:
log_error(einvoice)
raise
return einvoice
@@ -534,7 +539,14 @@ def safe_json_load(json_string):
pos = e.pos
start, end = max(0, pos-20), min(len(json_string)-1, pos+20)
snippet = json_string[start:end]
frappe.throw(_("Error in input data. Please check for any special characters near following input: <br> {}").format(snippet))
frappe.throw(
_(
"Error in input data. Please check for any special characters near following input: <br> {}"
).format(snippet),
title=_("Invalid JSON"),
exc=e,
)
def throw_error_list(errors, title):
if len(errors) > 1:
@@ -611,10 +623,17 @@ class GSPConnector():
request_log.save(ignore_permissions=True)
frappe.db.commit()
def get_client_credentials(self):
if self.e_invoice_settings.client_id and self.e_invoice_settings.client_secret:
return self.e_invoice_settings.client_id, self.e_invoice_settings.get_password('client_secret')
return frappe.conf.einvoice_client_id, frappe.conf.einvoice_client_secret
def fetch_auth_token(self):
client_id, client_secret = self.get_client_credentials()
headers = {
'gspappid': frappe.conf.einvoice_client_id,
'gspappsecret': frappe.conf.einvoice_client_secret
'gspappid': client_id,
'gspappsecret': client_secret
}
res = {}
try:
@@ -757,12 +776,13 @@ class GSPConnector():
headers = self.get_headers()
eway_bill_details = get_eway_bill_details(args)
data = json.dumps({
'Irn': args.irn,
'Distance': cint(eway_bill_details.distance),
'TransMode': eway_bill_details.mode_of_transport,
'TransId': eway_bill_details.gstin,
'TransName': eway_bill_details.transporter,
'TransName': eway_bill_details.name,
'TrnDocDt': eway_bill_details.document_date,
'TrnDocNo': eway_bill_details.document_name,
'VehNo': eway_bill_details.vehicle_no,
@@ -854,7 +874,7 @@ class GSPConnector():
if errors:
throw_error_list(errors, title)
else:
link_to_error_list = '<a href="desk#List/Error Log/List?method=E Invoice Request Failed">Error Log</a>'
link_to_error_list = '<a href="desk#List/Error Log/List?method=E Invoice Request Failed" target="_blank">Error Log</a>'
frappe.msgprint(
_('An error occurred while making e-invoicing request. Please check {} for more information.').format(link_to_error_list),
title=title,

View File

@@ -32,6 +32,15 @@ class TestWarehouse(unittest.TestCase):
self.assertEqual(p_warehouse.name, child_warehouse.parent_warehouse)
self.assertEqual(child_warehouse.is_group, 0)
def test_naming(self):
company = "Wind Power LLC"
warehouse_name = "Named Warehouse - WP"
wh = frappe.get_doc(doctype="Warehouse", warehouse_name=warehouse_name, company=company).insert()
self.assertEqual(wh.name, warehouse_name)
warehouse_name = "Unnamed Warehouse"
wh = frappe.get_doc(doctype="Warehouse", warehouse_name=warehouse_name, company=company).insert()
self.assertIn(warehouse_name, wh.name)
def create_warehouse(warehouse_name, properties=None, company=None):
if not company:

View File

@@ -19,8 +19,9 @@ class Warehouse(NestedSet):
suffix = " - " + frappe.get_cached_value('Company', self.company, "abbr")
if not self.warehouse_name.endswith(suffix):
self.name = self.warehouse_name + suffix
else:
self.name = self.warehouse_name
return
self.name = self.warehouse_name
def onload(self):
'''load account name for General Ledger Report'''

View File

@@ -368,7 +368,7 @@ class update_entries_after(object):
batch = self.stock_queue[index]
if qty_to_pop >= batch[0]:
# consume current batch
qty_to_pop = qty_to_pop - batch[0]
qty_to_pop = _round_off_if_near_zero(qty_to_pop - batch[0])
self.stock_queue.pop(index)
if not self.stock_queue and qty_to_pop:
# stock finished, qty still remains to be withdrawn
@@ -382,8 +382,8 @@ class update_entries_after(object):
batch[0] = batch[0] - qty_to_pop
qty_to_pop = 0
stock_value = sum((flt(batch[0]) * flt(batch[1]) for batch in self.stock_queue))
stock_qty = sum((flt(batch[0]) for batch in self.stock_queue))
stock_value = _round_off_if_near_zero(sum((flt(batch[0]) * flt(batch[1]) for batch in self.stock_queue)))
stock_qty = _round_off_if_near_zero(sum((flt(batch[0]) for batch in self.stock_queue)))
if stock_qty:
self.valuation_rate = stock_value / flt(stock_qty)
@@ -549,3 +549,12 @@ def get_valuation_rate(item_code, warehouse, voucher_type, voucher_no,
frappe.throw(msg=msg, title=_("Valuation Rate Missing"))
return valuation_rate
def _round_off_if_near_zero(number, precision = 7):
"""Rounds off the number to zero only if number is close to zero for decimal
specified in precision. Precision defaults to 7.
"""
if abs(0.0 - flt(number)) < (1.0 / (10**precision)):
return 0.0
return flt(number)