mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-21 14:09:19 +00:00
Merge pull request #25204 from ankush/invoice-name-12
fix(India): create property setters for shorter naming series (#25134)
This commit is contained in:
@@ -43,7 +43,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"grand_total": 0,
|
"grand_total": 0,
|
||||||
"naming_series": "_T-BILL",
|
"naming_series": "T-PINV-",
|
||||||
"taxes": [
|
"taxes": [
|
||||||
{
|
{
|
||||||
"account_head": "_Test Account Shipping Charges - _TC",
|
"account_head": "_Test Account Shipping Charges - _TC",
|
||||||
@@ -168,7 +168,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"grand_total": 0,
|
"grand_total": 0,
|
||||||
"naming_series": "_T-Purchase Invoice-",
|
"naming_series": "T-PINV-",
|
||||||
"taxes": [
|
"taxes": [
|
||||||
{
|
{
|
||||||
"account_head": "_Test Account Shipping Charges - _TC",
|
"account_head": "_Test Account Shipping Charges - _TC",
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
"base_grand_total": 561.8,
|
"base_grand_total": 561.8,
|
||||||
"grand_total": 561.8,
|
"grand_total": 561.8,
|
||||||
"is_pos": 0,
|
"is_pos": 0,
|
||||||
"naming_series": "_T-Sales Invoice-",
|
"naming_series": "T-SINV-",
|
||||||
"base_net_total": 500.0,
|
"base_net_total": 500.0,
|
||||||
"taxes": [
|
"taxes": [
|
||||||
{
|
{
|
||||||
@@ -103,7 +103,7 @@
|
|||||||
"base_grand_total": 630.0,
|
"base_grand_total": 630.0,
|
||||||
"grand_total": 630.0,
|
"grand_total": 630.0,
|
||||||
"is_pos": 0,
|
"is_pos": 0,
|
||||||
"naming_series": "_T-Sales Invoice-",
|
"naming_series": "T-SINV-",
|
||||||
"base_net_total": 500.0,
|
"base_net_total": 500.0,
|
||||||
"taxes": [
|
"taxes": [
|
||||||
{
|
{
|
||||||
@@ -174,7 +174,7 @@
|
|||||||
],
|
],
|
||||||
"grand_total": 0,
|
"grand_total": 0,
|
||||||
"is_pos": 0,
|
"is_pos": 0,
|
||||||
"naming_series": "_T-Sales Invoice-",
|
"naming_series": "T-SINV-",
|
||||||
"taxes": [
|
"taxes": [
|
||||||
{
|
{
|
||||||
"account_head": "_Test Account Shipping Charges - _TC",
|
"account_head": "_Test Account Shipping Charges - _TC",
|
||||||
@@ -300,7 +300,7 @@
|
|||||||
],
|
],
|
||||||
"grand_total": 0,
|
"grand_total": 0,
|
||||||
"is_pos": 0,
|
"is_pos": 0,
|
||||||
"naming_series": "_T-Sales Invoice-",
|
"naming_series": "T-SINV-",
|
||||||
"taxes": [
|
"taxes": [
|
||||||
{
|
{
|
||||||
"account_head": "_Test Account Excise Duty - _TC",
|
"account_head": "_Test Account Excise Duty - _TC",
|
||||||
|
|||||||
@@ -2063,6 +2063,7 @@ def create_sales_invoice(**args):
|
|||||||
si.return_against = args.return_against
|
si.return_against = args.return_against
|
||||||
si.currency=args.currency or "INR"
|
si.currency=args.currency or "INR"
|
||||||
si.conversion_rate = args.conversion_rate or 1
|
si.conversion_rate = args.conversion_rate or 1
|
||||||
|
si.naming_series = args.naming_series or "T-SINV-"
|
||||||
|
|
||||||
si.append("items", {
|
si.append("items", {
|
||||||
"item_code": args.item or args.item_code or "_Test Item",
|
"item_code": args.item or args.item_code or "_Test Item",
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
import frappe, os, json
|
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_fields
|
||||||
|
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
|
||||||
from frappe.permissions import add_permission, update_permission_property
|
from frappe.permissions import add_permission, update_permission_property
|
||||||
from erpnext.regional.india import states
|
from erpnext.regional.india import states
|
||||||
from erpnext.accounts.utils import get_fiscal_year, FiscalYearError
|
from erpnext.accounts.utils import get_fiscal_year, FiscalYearError
|
||||||
@@ -19,6 +20,7 @@ def setup(company=None, patch=True):
|
|||||||
# TODO: for all countries
|
# TODO: for all countries
|
||||||
def setup_company_independent_fixtures():
|
def setup_company_independent_fixtures():
|
||||||
make_custom_fields()
|
make_custom_fields()
|
||||||
|
make_property_setters()
|
||||||
add_permissions()
|
add_permissions()
|
||||||
add_custom_roles_for_reports()
|
add_custom_roles_for_reports()
|
||||||
frappe.enqueue('erpnext.regional.india.setup.add_hsn_sac_codes', now=frappe.flags.in_test)
|
frappe.enqueue('erpnext.regional.india.setup.add_hsn_sac_codes', now=frappe.flags.in_test)
|
||||||
@@ -98,6 +100,11 @@ def add_print_formats():
|
|||||||
frappe.db.sql(""" update `tabPrint Format` set disabled = 0 where
|
frappe.db.sql(""" update `tabPrint Format` set disabled = 0 where
|
||||||
name in('GST POS Invoice', 'GST Tax Invoice', 'GST E-Invoice') """)
|
name in('GST POS Invoice', 'GST Tax Invoice', 'GST E-Invoice') """)
|
||||||
|
|
||||||
|
def make_property_setters():
|
||||||
|
# GST rules do not allow for an invoice no. bigger than 16 characters
|
||||||
|
make_property_setter('Sales Invoice', 'naming_series', 'options', 'SINV-.YY.-\nSRET-.YY.-', '')
|
||||||
|
make_property_setter('Purchase Invoice', 'naming_series', 'options', 'PINV-.YY.-\nPRET-.YY.-', '')
|
||||||
|
|
||||||
def make_custom_fields(update=True):
|
def make_custom_fields(update=True):
|
||||||
hsn_sac_field = dict(fieldname='gst_hsn_code', label='HSN/SAC',
|
hsn_sac_field = dict(fieldname='gst_hsn_code', label='HSN/SAC',
|
||||||
fieldtype='Data', fetch_from='item_code.gst_hsn_code', insert_after='description',
|
fieldtype='Data', fetch_from='item_code.gst_hsn_code', insert_after='description',
|
||||||
@@ -397,9 +404,9 @@ def make_custom_fields(update=True):
|
|||||||
si_einvoice_fields = [
|
si_einvoice_fields = [
|
||||||
dict(fieldname='irn', label='IRN', fieldtype='Data', read_only=1, insert_after='customer', no_copy=1, print_hide=1,
|
dict(fieldname='irn', label='IRN', fieldtype='Data', read_only=1, insert_after='customer', no_copy=1, print_hide=1,
|
||||||
depends_on='eval:in_list(["Registered Regular", "SEZ", "Overseas", "Deemed Export"], doc.gst_category) && doc.irn_cancelled === 0'),
|
depends_on='eval:in_list(["Registered Regular", "SEZ", "Overseas", "Deemed Export"], doc.gst_category) && doc.irn_cancelled === 0'),
|
||||||
|
|
||||||
dict(fieldname='ack_no', label='Ack. No.', fieldtype='Data', read_only=1, hidden=1, insert_after='irn', no_copy=1, print_hide=1),
|
dict(fieldname='ack_no', label='Ack. No.', fieldtype='Data', read_only=1, hidden=1, insert_after='irn', no_copy=1, print_hide=1),
|
||||||
|
|
||||||
dict(fieldname='ack_date', label='Ack. Date', fieldtype='Data', read_only=1, hidden=1, insert_after='ack_no', no_copy=1, print_hide=1),
|
dict(fieldname='ack_date', label='Ack. Date', fieldtype='Data', read_only=1, hidden=1, insert_after='ack_no', no_copy=1, print_hide=1),
|
||||||
|
|
||||||
dict(fieldname='irn_cancelled', label='IRN Cancelled', fieldtype='Check', no_copy=1, print_hide=1,
|
dict(fieldname='irn_cancelled', label='IRN Cancelled', fieldtype='Check', no_copy=1, print_hide=1,
|
||||||
@@ -616,7 +623,7 @@ def set_tax_withholding_category(company):
|
|||||||
fy_exist = [k for k in doc.get('rates') if k.get('fiscal_year')==fiscal_year]
|
fy_exist = [k for k in doc.get('rates') if k.get('fiscal_year')==fiscal_year]
|
||||||
if not fy_exist:
|
if not fy_exist:
|
||||||
doc.append("rates", d.get('rates')[0])
|
doc.append("rates", d.get('rates')[0])
|
||||||
|
|
||||||
doc.flags.ignore_permissions = True
|
doc.flags.ignore_permissions = True
|
||||||
doc.flags.ignore_mandatory = True
|
doc.flags.ignore_mandatory = True
|
||||||
doc.save()
|
doc.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user