Skip to content

Commit

Permalink
Update simple_subscription/simple_subscription/doctype/simple_subscri…
Browse files Browse the repository at this point in the history
…ption_item/simple_subscription_item.py

Co-authored-by: Raffael Meyer <[email protected]>
  • Loading branch information
HenningWendtland and barredterra authored Sep 16, 2024
1 parent 3921263 commit 01689c2
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,38 @@ class SimpleSubscriptionItem(Document):
@property
def current_rate(self):
parent = frappe.get_doc("Simple Subscription", self.parent)
currency = parent.currency or frappe.get_cached_value(
"Company", parent.company, "default_currency"
)

party_details = get_party_details(
party=parent.customer,
account=None,
party_type="Customer",
company=parent.company,
posting_date=today(),
currency=parent.currency,
currency=currency,
doctype="Sales Invoice",
fetch_payment_terms_template=False,
)

price_list = party_details.selling_price_list or frappe.db.get_value(
"Price List", {"selling": 1, "currency": currency, "enabled": 1}
)

item_details = get_item_details(
{
"item_code": self.item,
"company": parent.company,
"doctype": "Sales Invoice",
"currency": parent.currency,
"price_list_currency": parent.currency,
"currency": currency,
"price_list_currency": currency,
"qty": self.qty,
"plc_conversion_rate": 1,
"conversion_rate": 1,
"customer": parent.customer,
"transaction_date": today(),
"price_list": party_details.selling_price_list,
"price_list": price_list,
}
)
return item_details.price_list_rate - (item_details.discount_amount or 0)
Expand Down

0 comments on commit 01689c2

Please sign in to comment.