Merge branch 'master' into develop
This commit is contained in:
commit
482ebd2c7c
@ -5,7 +5,7 @@ import frappe
|
|||||||
from erpnext.hooks import regional_overrides
|
from erpnext.hooks import regional_overrides
|
||||||
from frappe.utils import getdate
|
from frappe.utils import getdate
|
||||||
|
|
||||||
__version__ = '11.1.8'
|
__version__ = '11.1.9'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
@ -24,7 +24,6 @@ from erpnext.accounts.general_ledger import get_round_off_account_and_cost_cente
|
|||||||
from erpnext.accounts.doctype.loyalty_program.loyalty_program import \
|
from erpnext.accounts.doctype.loyalty_program.loyalty_program import \
|
||||||
get_loyalty_program_details_with_points, get_loyalty_details, validate_loyalty_points
|
get_loyalty_program_details_with_points, get_loyalty_details, validate_loyalty_points
|
||||||
from erpnext.accounts.deferred_revenue import validate_service_stop_date
|
from erpnext.accounts.deferred_revenue import validate_service_stop_date
|
||||||
from erpnext.controllers.accounts_controller import on_submit_regional, on_cancel_regional
|
|
||||||
|
|
||||||
from erpnext.healthcare.utils import manage_invoice_submit_cancel
|
from erpnext.healthcare.utils import manage_invoice_submit_cancel
|
||||||
|
|
||||||
@ -199,8 +198,6 @@ class SalesInvoice(SellingController):
|
|||||||
if "Healthcare" in active_domains:
|
if "Healthcare" in active_domains:
|
||||||
manage_invoice_submit_cancel(self, "on_submit")
|
manage_invoice_submit_cancel(self, "on_submit")
|
||||||
|
|
||||||
on_submit_regional(self)
|
|
||||||
|
|
||||||
def validate_pos_paid_amount(self):
|
def validate_pos_paid_amount(self):
|
||||||
if len(self.payments) == 0 and self.is_pos:
|
if len(self.payments) == 0 and self.is_pos:
|
||||||
frappe.throw(_("At least one mode of payment is required for POS invoice."))
|
frappe.throw(_("At least one mode of payment is required for POS invoice."))
|
||||||
@ -256,8 +253,6 @@ class SalesInvoice(SellingController):
|
|||||||
if "Healthcare" in active_domains:
|
if "Healthcare" in active_domains:
|
||||||
manage_invoice_submit_cancel(self, "on_cancel")
|
manage_invoice_submit_cancel(self, "on_cancel")
|
||||||
|
|
||||||
on_cancel_regional(self)
|
|
||||||
|
|
||||||
def update_status_updater_args(self):
|
def update_status_updater_args(self):
|
||||||
if cint(self.update_stock):
|
if cint(self.update_stock):
|
||||||
self.status_updater.extend([{
|
self.status_updater.extend([{
|
||||||
|
@ -1186,11 +1186,3 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil
|
|||||||
@erpnext.allow_regional
|
@erpnext.allow_regional
|
||||||
def validate_regional(doc):
|
def validate_regional(doc):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@erpnext.allow_regional
|
|
||||||
def on_submit_regional(doc):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@erpnext.allow_regional
|
|
||||||
def on_cancel_regional(doc):
|
|
||||||
pass
|
|
||||||
|
@ -211,7 +211,8 @@ doc_events = {
|
|||||||
"validate": "erpnext.portal.doctype.products_settings.products_settings.home_page_is_products"
|
"validate": "erpnext.portal.doctype.products_settings.products_settings.home_page_is_products"
|
||||||
},
|
},
|
||||||
"Sales Invoice": {
|
"Sales Invoice": {
|
||||||
"on_submit": "erpnext.regional.france.utils.create_transaction_log",
|
"on_submit": ["erpnext.regional.france.utils.create_transaction_log", "erpnext.regional.italy.utils.sales_invoice_on_submit"],
|
||||||
|
"on_cancel": "erpnext.regional.italy.utils.sales_invoice_on_cancel",
|
||||||
"on_trash": "erpnext.regional.check_deletion_permission"
|
"on_trash": "erpnext.regional.check_deletion_permission"
|
||||||
},
|
},
|
||||||
"Payment Entry": {
|
"Payment Entry": {
|
||||||
@ -316,7 +317,5 @@ regional_overrides = {
|
|||||||
'Italy': {
|
'Italy': {
|
||||||
'erpnext.controllers.taxes_and_totals.update_itemised_tax_data': 'erpnext.regional.italy.utils.update_itemised_tax_data',
|
'erpnext.controllers.taxes_and_totals.update_itemised_tax_data': 'erpnext.regional.italy.utils.update_itemised_tax_data',
|
||||||
'erpnext.controllers.accounts_controller.validate_regional': 'erpnext.regional.italy.utils.sales_invoice_validate',
|
'erpnext.controllers.accounts_controller.validate_regional': 'erpnext.regional.italy.utils.sales_invoice_validate',
|
||||||
'erpnext.controllers.accounts_controller.on_submit_regional': 'erpnext.regional.italy.utils.sales_invoice_on_submit',
|
|
||||||
'erpnext.controllers.accounts_controller.on_cancel_regional': 'erpnext.regional.italy.utils.sales_invoice_on_cancel'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,11 +8,11 @@ import frappe
|
|||||||
|
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
|
|
||||||
company = frappe.get_all('Company', filters = {'country': 'Italy'})
|
company = frappe.get_all('Company', filters = {'country': 'Italy'})
|
||||||
if not company:
|
if not company:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
frappe.reload_doc('regional', 'report', 'electronic_invoice_register')
|
||||||
make_custom_fields()
|
make_custom_fields()
|
||||||
setup_report()
|
setup_report()
|
||||||
|
|
||||||
|
@ -183,6 +183,9 @@ def get_invoice_summary(items, taxes):
|
|||||||
#Preflight for successful e-invoice export.
|
#Preflight for successful e-invoice export.
|
||||||
def sales_invoice_validate(doc):
|
def sales_invoice_validate(doc):
|
||||||
#Validate company
|
#Validate company
|
||||||
|
if doc.doctype != 'Sales Invoice':
|
||||||
|
return
|
||||||
|
|
||||||
if not doc.company_address:
|
if not doc.company_address:
|
||||||
frappe.throw(_("Please set an Address on the Company '%s'" % doc.company), title=_("E-Invoicing Information Missing"))
|
frappe.throw(_("Please set an Address on the Company '%s'" % doc.company), title=_("E-Invoicing Information Missing"))
|
||||||
else:
|
else:
|
||||||
@ -219,8 +222,12 @@ def sales_invoice_validate(doc):
|
|||||||
|
|
||||||
|
|
||||||
#Ensure payment details are valid for e-invoice.
|
#Ensure payment details are valid for e-invoice.
|
||||||
def sales_invoice_on_submit(doc):
|
def sales_invoice_on_submit(doc, method):
|
||||||
#Validate payment details
|
#Validate payment details
|
||||||
|
if get_company_country(doc.company) not in ['Italy',
|
||||||
|
'Italia', 'Italian Republic', 'Repubblica Italiana']:
|
||||||
|
return
|
||||||
|
|
||||||
if not len(doc.payment_schedule):
|
if not len(doc.payment_schedule):
|
||||||
frappe.throw(_("Please set the Payment Schedule"), title=_("E-Invoicing Information Missing"))
|
frappe.throw(_("Please set the Payment Schedule"), title=_("E-Invoicing Information Missing"))
|
||||||
else:
|
else:
|
||||||
@ -244,10 +251,17 @@ def prepare_and_attach_invoice(doc):
|
|||||||
save_file(xml_filename, invoice_xml, dt=doc.doctype, dn=doc.name, is_private=True)
|
save_file(xml_filename, invoice_xml, dt=doc.doctype, dn=doc.name, is_private=True)
|
||||||
|
|
||||||
#Delete e-invoice attachment on cancel.
|
#Delete e-invoice attachment on cancel.
|
||||||
def sales_invoice_on_cancel(doc):
|
def sales_invoice_on_cancel(doc, method):
|
||||||
|
if get_company_country(doc.company) not in ['Italy',
|
||||||
|
'Italia', 'Italian Republic', 'Repubblica Italiana']:
|
||||||
|
return
|
||||||
|
|
||||||
for attachment in get_e_invoice_attachments(doc):
|
for attachment in get_e_invoice_attachments(doc):
|
||||||
remove_file(attachment.name, attached_to_doctype=doc.doctype, attached_to_name=doc.name)
|
remove_file(attachment.name, attached_to_doctype=doc.doctype, attached_to_name=doc.name)
|
||||||
|
|
||||||
|
def get_company_country(company):
|
||||||
|
return frappe.get_cached_value('Company', company, 'country')
|
||||||
|
|
||||||
def get_e_invoice_attachments(invoice):
|
def get_e_invoice_attachments(invoice):
|
||||||
out = []
|
out = []
|
||||||
attachments = get_attachments(invoice.doctype, invoice.name)
|
attachments = get_attachments(invoice.doctype, invoice.name)
|
||||||
|
@ -91,7 +91,7 @@ frappe.ui.form.on('Material Request', {
|
|||||||
|
|
||||||
// stop
|
// stop
|
||||||
frm.add_custom_button(__('Stop'),
|
frm.add_custom_button(__('Stop'),
|
||||||
() => frm.events.update_status(frm, 'Stop'));
|
() => frm.events.update_status(frm, 'Stopped'));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user