mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-21 05:59:18 +00:00
Multiple port from v11 hotfix (#18954)
* fix: circular dependency during asset cancellation * fix: ImponibileImporto for On Previous Row Total * fix: PrezzoUnitario decimal issue
This commit is contained in:
committed by
Nabin Hait
parent
e352fb754b
commit
cdcff6c26d
@@ -292,12 +292,6 @@ class Asset(AccountsController):
|
|||||||
if self.status not in ("Submitted", "Partially Depreciated", "Fully Depreciated"):
|
if self.status not in ("Submitted", "Partially Depreciated", "Fully Depreciated"):
|
||||||
frappe.throw(_("Asset cannot be cancelled, as it is already {0}").format(self.status))
|
frappe.throw(_("Asset cannot be cancelled, as it is already {0}").format(self.status))
|
||||||
|
|
||||||
if self.purchase_invoice:
|
|
||||||
frappe.throw(_("Please cancel Purchase Invoice {0} first").format(self.purchase_invoice))
|
|
||||||
|
|
||||||
if self.purchase_receipt:
|
|
||||||
frappe.throw(_("Please cancel Purchase Receipt {0} first").format(self.purchase_receipt))
|
|
||||||
|
|
||||||
def delete_depreciation_entries(self):
|
def delete_depreciation_entries(self):
|
||||||
for d in self.get("schedules"):
|
for d in self.get("schedules"):
|
||||||
if d.journal_entry:
|
if d.journal_entry:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{%- macro format_float(value) -%}
|
{%- macro format_float(value, precision=2) -%}
|
||||||
{{ "%.2f" % value|abs }}
|
{{ value|round(frappe.utils.cint(precision)) }}
|
||||||
{%- endmacro -%}
|
{%- endmacro -%}
|
||||||
|
|
||||||
{%- macro render_address(address) %}
|
{%- macro render_address(address) %}
|
||||||
@@ -182,10 +182,10 @@
|
|||||||
<Descrizione>{{ html2text(item.description or '') 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, item_meta.get_field("rate").precision) }}</PrezzoUnitario>
|
||||||
{{ render_discount_or_margin(item) }}
|
{{ render_discount_or_margin(item) }}
|
||||||
<PrezzoTotale>{{ format_float(item.amount) }}</PrezzoTotale>
|
<PrezzoTotale>{{ format_float(item.amount, item_meta.get_field("amount").precision) }}</PrezzoTotale>
|
||||||
<AliquotaIVA>{{ format_float(item.tax_rate) }}</AliquotaIVA>
|
<AliquotaIVA>{{ format_float(item.tax_rate, item_meta.get_field("tax_rate").precision) }}</AliquotaIVA>
|
||||||
{%- if item.tax_exemption_reason %}
|
{%- if item.tax_exemption_reason %}
|
||||||
<Natura>{{ item.tax_exemption_reason.split("-")[0] }}</Natura>
|
<Natura>{{ item.tax_exemption_reason.split("-")[0] }}</Natura>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
@@ -197,8 +197,8 @@
|
|||||||
{%- if data.tax_exemption_reason %}
|
{%- if data.tax_exemption_reason %}
|
||||||
<Natura>{{ data.tax_exemption_reason.split("-")[0] }}</Natura>
|
<Natura>{{ data.tax_exemption_reason.split("-")[0] }}</Natura>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
<ImponibileImporto>{{ format_float(data.taxable_amount) }}</ImponibileImporto>
|
<ImponibileImporto>{{ format_float(data.taxable_amount, item_meta.get_field("tax_amount").precision) }}</ImponibileImporto>
|
||||||
<Imposta>{{ format_float(data.tax_amount) }}</Imposta>
|
<Imposta>{{ format_float(data.tax_amount, item_meta.get_field("tax_amount").precision) }}</Imposta>
|
||||||
<EsigibilitaIVA>{{ doc.vat_collectability.split("-")[0] }}</EsigibilitaIVA>
|
<EsigibilitaIVA>{{ doc.vat_collectability.split("-")[0] }}</EsigibilitaIVA>
|
||||||
{%- if data.tax_exemption_law %}
|
{%- if data.tax_exemption_law %}
|
||||||
<RiferimentoNormativo>{{ data.tax_exemption_law }}</RiferimentoNormativo>
|
<RiferimentoNormativo>{{ data.tax_exemption_law }}</RiferimentoNormativo>
|
||||||
|
|||||||
@@ -151,7 +151,8 @@ def get_invoice_summary(items, taxes):
|
|||||||
tax_rate=tax.rate,
|
tax_rate=tax.rate,
|
||||||
tax_amount=(reference_row.tax_amount * tax.rate) / 100,
|
tax_amount=(reference_row.tax_amount * tax.rate) / 100,
|
||||||
net_amount=reference_row.tax_amount,
|
net_amount=reference_row.tax_amount,
|
||||||
taxable_amount=reference_row.tax_amount,
|
taxable_amount=(reference_row.tax_amount if tax.charge_type == 'On Previous Row Amount'
|
||||||
|
else reference_row.total),
|
||||||
item_tax_rate={tax.account_head: tax.rate},
|
item_tax_rate={tax.account_head: tax.rate},
|
||||||
charges=True
|
charges=True
|
||||||
)
|
)
|
||||||
@@ -278,7 +279,11 @@ def prepare_and_attach_invoice(doc, replace=False):
|
|||||||
progressive_name, progressive_number = get_progressive_name_and_number(doc, replace)
|
progressive_name, progressive_number = get_progressive_name_and_number(doc, replace)
|
||||||
|
|
||||||
invoice = prepare_invoice(doc, progressive_number)
|
invoice = prepare_invoice(doc, progressive_number)
|
||||||
invoice_xml = frappe.render_template('erpnext/regional/italy/e-invoice.xml', context={"doc": invoice}, is_path=True)
|
item_meta = frappe.get_meta("Sales Invoice Item")
|
||||||
|
|
||||||
|
invoice_xml = frappe.render_template('erpnext/regional/italy/e-invoice.xml',
|
||||||
|
context={"doc": invoice, "item_meta": item_meta}, is_path=True)
|
||||||
|
|
||||||
invoice_xml = invoice_xml.replace("&", "&")
|
invoice_xml = invoice_xml.replace("&", "&")
|
||||||
|
|
||||||
xml_filename = progressive_name + ".xml"
|
xml_filename = progressive_name + ".xml"
|
||||||
|
|||||||
Reference in New Issue
Block a user