Merge branch 'hotfix'
This commit is contained in:
commit
5d414af86b
@ -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.11'
|
__version__ = '11.1.12'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
@ -46,6 +46,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
}]
|
}]
|
||||||
|
|
||||||
def onload(self):
|
def onload(self):
|
||||||
|
super(PurchaseInvoice, self).onload()
|
||||||
supplier_tds = frappe.db.get_value("Supplier", self.supplier, "tax_withholding_category")
|
supplier_tds = frappe.db.get_value("Supplier", self.supplier, "tax_withholding_category")
|
||||||
self.set_onload("supplier_tds", supplier_tds)
|
self.set_onload("supplier_tds", supplier_tds)
|
||||||
|
|
||||||
|
@ -587,4 +587,4 @@ erpnext.patches.v11_1.setup_guardian_role
|
|||||||
execute:frappe.delete_doc('DocType', 'Notification Control')
|
execute:frappe.delete_doc('DocType', 'Notification Control')
|
||||||
erpnext.patches.v11_0.remove_barcodes_field_from_copy_fields_to_variants
|
erpnext.patches.v11_0.remove_barcodes_field_from_copy_fields_to_variants
|
||||||
erpnext.patches.v10_0.item_barcode_childtable_migrate # 16-02-2019
|
erpnext.patches.v10_0.item_barcode_childtable_migrate # 16-02-2019
|
||||||
erpnext.patches.v11_0.make_italian_localization_fields
|
erpnext.patches.v11_0.make_italian_localization_fields # 26-02-2019
|
||||||
|
@ -22,7 +22,9 @@ def execute():
|
|||||||
condition += " when '{0}' then '{1}'".format(frappe.db.escape(state), frappe.db.escape(code))
|
condition += " when '{0}' then '{1}'".format(frappe.db.escape(state), frappe.db.escape(code))
|
||||||
|
|
||||||
if condition:
|
if condition:
|
||||||
frappe.db.sql("""
|
condition = "state_code = (case state {0} end),".format(condition)
|
||||||
UPDATE tabAddress set state_code = (case state {condition} end)
|
|
||||||
WHERE country in ('Italy', 'Italia', 'Italian Republic', 'Repubblica Italiana')
|
frappe.db.sql("""
|
||||||
""".format(condition=condition))
|
UPDATE tabAddress set {condition} country_code = UPPER(ifnull((select code
|
||||||
|
from `tabCountry` where name = `tabAddress`.country), ''))
|
||||||
|
""".format(condition=condition))
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
{%- if address.state_code %}
|
{%- if address.state_code %}
|
||||||
<Provincia>{{ address.state_code }}</Provincia>
|
<Provincia>{{ address.state_code }}</Provincia>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
<Nazione>{{ address.country_code|upper }}</Nazione>
|
<Nazione>{{ address.country_code }}</Nazione>
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
{%- macro render_discount_or_margin(item) -%}
|
{%- macro render_discount_or_margin(item) -%}
|
||||||
@ -40,7 +40,7 @@
|
|||||||
<FatturaElettronicaHeader>
|
<FatturaElettronicaHeader>
|
||||||
<DatiTrasmissione>
|
<DatiTrasmissione>
|
||||||
<IdTrasmittente>
|
<IdTrasmittente>
|
||||||
<IdPaese>{{ doc.company_address_data.country_code|upper or "IT" }}</IdPaese>
|
<IdPaese>{{ doc.company_address_data.country_code }}</IdPaese>
|
||||||
<IdCodice>{{ doc.company_fiscal_code or doc.company_tax_id | replace("IT","") }}</IdCodice>
|
<IdCodice>{{ doc.company_fiscal_code or doc.company_tax_id | replace("IT","") }}</IdCodice>
|
||||||
</IdTrasmittente>
|
</IdTrasmittente>
|
||||||
<ProgressivoInvio>{{ doc.progressive_number }}</ProgressivoInvio>
|
<ProgressivoInvio>{{ doc.progressive_number }}</ProgressivoInvio>
|
||||||
@ -56,7 +56,7 @@
|
|||||||
<CedentePrestatore>
|
<CedentePrestatore>
|
||||||
<DatiAnagrafici>
|
<DatiAnagrafici>
|
||||||
<IdFiscaleIVA>
|
<IdFiscaleIVA>
|
||||||
<IdPaese>{{ doc.company_address_data.country_code|upper or "IT"}}</IdPaese>
|
<IdPaese>{{ doc.company_address_data.country_code }}</IdPaese>
|
||||||
<IdCodice>{{ doc.company_tax_id | replace("IT","") }}</IdCodice>
|
<IdCodice>{{ doc.company_tax_id | replace("IT","") }}</IdCodice>
|
||||||
</IdFiscaleIVA>
|
</IdFiscaleIVA>
|
||||||
{%- if doc.company_fiscal_code %}
|
{%- if doc.company_fiscal_code %}
|
||||||
@ -99,7 +99,7 @@
|
|||||||
<CodiceFiscale>{{ doc.customer_data.fiscal_code }}</CodiceFiscale>
|
<CodiceFiscale>{{ doc.customer_data.fiscal_code }}</CodiceFiscale>
|
||||||
{%- else %}
|
{%- else %}
|
||||||
<IdFiscaleIVA>
|
<IdFiscaleIVA>
|
||||||
<IdPaese>{{ doc.customer_address_data.country_code|upper or "IT" }}</IdPaese>
|
<IdPaese>{{ doc.customer_address_data.country_code }}</IdPaese>
|
||||||
<IdCodice>{{ doc.tax_id | replace("IT","") }}</IdCodice>
|
<IdCodice>{{ doc.tax_id | replace("IT","") }}</IdCodice>
|
||||||
</IdFiscaleIVA>
|
</IdFiscaleIVA>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
@ -160,7 +160,7 @@
|
|||||||
<CodiceTipo>CODICE</CodiceTipo>
|
<CodiceTipo>CODICE</CodiceTipo>
|
||||||
<CodiceValore>{{ item.item_code }}</CodiceValore>
|
<CodiceValore>{{ item.item_code }}</CodiceValore>
|
||||||
</CodiceArticolo>
|
</CodiceArticolo>
|
||||||
<Descrizione>{{ html2text(item.description) or item.item_name }}</Descrizione>
|
<Descrizione>{{ html2text(item.description or '') or item.item_name }}</Descrizione>
|
||||||
<Quantita>{{ format_float(item.qty) }}</Quantita>
|
<Quantita>{{ format_float(item.qty) }}</Quantita>
|
||||||
<UnitaMisura>{{ item.stock_uom }}</UnitaMisura>
|
<UnitaMisura>{{ item.stock_uom }}</UnitaMisura>
|
||||||
<PrezzoUnitario>{{ format_float(item.price_list_rate or item.rate) }}</PrezzoUnitario>
|
<PrezzoUnitario>{{ format_float(item.price_list_rate or item.rate) }}</PrezzoUnitario>
|
||||||
|
@ -132,7 +132,7 @@ def make_custom_fields(update=True):
|
|||||||
'Supplier Quotation Item': invoice_item_fields,
|
'Supplier Quotation Item': invoice_item_fields,
|
||||||
'Address': [
|
'Address': [
|
||||||
dict(fieldname='country_code', label='Country Code',
|
dict(fieldname='country_code', label='Country Code',
|
||||||
fieldtype='Data', insert_after='country', print_hide=1, read_only=1,
|
fieldtype='Data', insert_after='country', print_hide=1, read_only=0,
|
||||||
fetch_from="country.code"),
|
fetch_from="country.code"),
|
||||||
dict(fieldname='state_code', label='State Code',
|
dict(fieldname='state_code', label='State Code',
|
||||||
fieldtype='Data', insert_after='state', print_hide=1)
|
fieldtype='Data', insert_after='state', print_hide=1)
|
||||||
|
@ -189,7 +189,7 @@ def sales_invoice_validate(doc):
|
|||||||
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:
|
||||||
validate_address(doc.company_address, "Company")
|
validate_address(doc.company_address)
|
||||||
|
|
||||||
company_fiscal_regime = frappe.get_cached_value("Company", doc.company, 'fiscal_regime')
|
company_fiscal_regime = frappe.get_cached_value("Company", doc.company, 'fiscal_regime')
|
||||||
if not company_fiscal_regime:
|
if not company_fiscal_regime:
|
||||||
@ -217,7 +217,7 @@ def sales_invoice_validate(doc):
|
|||||||
if not doc.customer_address:
|
if not doc.customer_address:
|
||||||
frappe.throw(_("Please set the Customer Address"), title=_("E-Invoicing Information Missing"))
|
frappe.throw(_("Please set the Customer Address"), title=_("E-Invoicing Information Missing"))
|
||||||
else:
|
else:
|
||||||
validate_address(doc.customer_address, "Customer")
|
validate_address(doc.customer_address)
|
||||||
|
|
||||||
if not len(doc.taxes):
|
if not len(doc.taxes):
|
||||||
frappe.throw(_("Please set at least one row in the Taxes and Charges Table"), title=_("E-Invoicing Information Missing"))
|
frappe.throw(_("Please set at least one row in the Taxes and Charges Table"), title=_("E-Invoicing Information Missing"))
|
||||||
@ -285,13 +285,14 @@ def get_e_invoice_attachments(invoice):
|
|||||||
|
|
||||||
return out
|
return out
|
||||||
|
|
||||||
def validate_address(address_name, address_context):
|
def validate_address(address_name):
|
||||||
pincode, city = frappe.db.get_value("Address", address_name, ["pincode", "city"])
|
fields = ["pincode", "city", "country_code"]
|
||||||
if not pincode:
|
data = frappe.get_cached_value("Address", address_name, fields, as_dict=1) or {}
|
||||||
frappe.throw(_("Please set pin code on %s Address" % address_context), title=_("E-Invoicing Information Missing"))
|
|
||||||
if not city:
|
|
||||||
frappe.throw(_("Please set city on %s Address" % address_context), title=_("E-Invoicing Information Missing"))
|
|
||||||
|
|
||||||
|
for field in fields:
|
||||||
|
if not data.get(field):
|
||||||
|
frappe.throw(_("Please set {0} for address {1}".format(field.replace('-',''), address_name)),
|
||||||
|
title=_("E-Invoicing Information Missing"))
|
||||||
|
|
||||||
def get_unamended_name(doc):
|
def get_unamended_name(doc):
|
||||||
attributes = ["naming_series", "amended_from"]
|
attributes = ["naming_series", "amended_from"]
|
||||||
@ -312,6 +313,9 @@ def get_progressive_name_and_number(doc):
|
|||||||
return progressive_name, progressive_number
|
return progressive_name, progressive_number
|
||||||
|
|
||||||
def set_state_code(doc, method):
|
def set_state_code(doc, method):
|
||||||
|
if doc.get('country_code'):
|
||||||
|
doc.country_code = doc.country_code.upper()
|
||||||
|
|
||||||
if not doc.get('state'):
|
if not doc.get('state'):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ from erpnext.stock.doctype.item_price.item_price import ItemPriceDuplicateItem
|
|||||||
|
|
||||||
class TestItemPrice(unittest.TestCase):
|
class TestItemPrice(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
frappe.db.sql("delete from `tabItem Price`")
|
frappe.db.sql("delete from `tabItem Price`")
|
||||||
make_test_records_for_doctype("Item Price", force=True)
|
make_test_records_for_doctype("Item Price", force=True)
|
||||||
|
|
||||||
def test_duplicate_item(self):
|
def test_duplicate_item(self):
|
||||||
|
@ -490,7 +490,7 @@ def get_price_list_rate_for(args, item_code):
|
|||||||
price_list_rate = get_item_price(item_price_args, item_code)
|
price_list_rate = get_item_price(item_price_args, item_code)
|
||||||
if price_list_rate:
|
if price_list_rate:
|
||||||
desired_qty = args.get("qty")
|
desired_qty = args.get("qty")
|
||||||
if check_packing_list(price_list_rate[0][0], desired_qty, item_code):
|
if desired_qty and check_packing_list(price_list_rate[0][0], desired_qty, item_code):
|
||||||
item_price_data = price_list_rate
|
item_price_data = price_list_rate
|
||||||
else:
|
else:
|
||||||
for field in ["customer", "supplier", "min_qty"]:
|
for field in ["customer", "supplier", "min_qty"]:
|
||||||
@ -521,12 +521,15 @@ def check_packing_list(price_list_rate_name, desired_qty, item_code):
|
|||||||
:param qty: Derised Qt
|
:param qty: Derised Qt
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
flag = True
|
||||||
item_price = frappe.get_doc("Item Price", price_list_rate_name)
|
item_price = frappe.get_doc("Item Price", price_list_rate_name)
|
||||||
if desired_qty and item_price.packing_unit:
|
if item_price.packing_unit:
|
||||||
packing_increment = desired_qty % item_price.packing_unit
|
packing_increment = desired_qty % item_price.packing_unit
|
||||||
|
|
||||||
if packing_increment == 0:
|
if packing_increment != 0:
|
||||||
return True
|
flag = False
|
||||||
|
|
||||||
|
return flag
|
||||||
|
|
||||||
def validate_price_list(args):
|
def validate_price_list(args):
|
||||||
if args.get("price_list"):
|
if args.get("price_list"):
|
||||||
|
Loading…
Reference in New Issue
Block a user