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:
parent
e352fb754b
commit
cdcff6c26d
@ -292,12 +292,6 @@ class Asset(AccountsController):
|
||||
if self.status not in ("Submitted", "Partially Depreciated", "Fully Depreciated"):
|
||||
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):
|
||||
for d in self.get("schedules"):
|
||||
if d.journal_entry:
|
||||
|
@ -1,5 +1,5 @@
|
||||
{%- macro format_float(value) -%}
|
||||
{{ "%.2f" % value|abs }}
|
||||
{%- macro format_float(value, precision=2) -%}
|
||||
{{ value|round(frappe.utils.cint(precision)) }}
|
||||
{%- endmacro -%}
|
||||
|
||||
{%- macro render_address(address) %}
|
||||
@ -182,10 +182,10 @@
|
||||
<Descrizione>{{ html2text(item.description or '') or item.item_name }}</Descrizione>
|
||||
<Quantita>{{ format_float(item.qty) }}</Quantita>
|
||||
<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) }}
|
||||
<PrezzoTotale>{{ format_float(item.amount) }}</PrezzoTotale>
|
||||
<AliquotaIVA>{{ format_float(item.tax_rate) }}</AliquotaIVA>
|
||||
<PrezzoTotale>{{ format_float(item.amount, item_meta.get_field("amount").precision) }}</PrezzoTotale>
|
||||
<AliquotaIVA>{{ format_float(item.tax_rate, item_meta.get_field("tax_rate").precision) }}</AliquotaIVA>
|
||||
{%- if item.tax_exemption_reason %}
|
||||
<Natura>{{ item.tax_exemption_reason.split("-")[0] }}</Natura>
|
||||
{%- endif %}
|
||||
@ -197,8 +197,8 @@
|
||||
{%- if data.tax_exemption_reason %}
|
||||
<Natura>{{ data.tax_exemption_reason.split("-")[0] }}</Natura>
|
||||
{%- endif %}
|
||||
<ImponibileImporto>{{ format_float(data.taxable_amount) }}</ImponibileImporto>
|
||||
<Imposta>{{ format_float(data.tax_amount) }}</Imposta>
|
||||
<ImponibileImporto>{{ format_float(data.taxable_amount, item_meta.get_field("tax_amount").precision) }}</ImponibileImporto>
|
||||
<Imposta>{{ format_float(data.tax_amount, item_meta.get_field("tax_amount").precision) }}</Imposta>
|
||||
<EsigibilitaIVA>{{ doc.vat_collectability.split("-")[0] }}</EsigibilitaIVA>
|
||||
{%- if data.tax_exemption_law %}
|
||||
<RiferimentoNormativo>{{ data.tax_exemption_law }}</RiferimentoNormativo>
|
||||
|
@ -151,7 +151,8 @@ def get_invoice_summary(items, taxes):
|
||||
tax_rate=tax.rate,
|
||||
tax_amount=(reference_row.tax_amount * tax.rate) / 100,
|
||||
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},
|
||||
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)
|
||||
|
||||
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("&", "&")
|
||||
|
||||
xml_filename = progressive_name + ".xml"
|
||||
|
Loading…
x
Reference in New Issue
Block a user