Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions posawesome/posawesome/api/payment_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,18 @@ def create_payment_entry(
).format(party_account_currency=party_account_currency, currency=currency)
)
payment_type = "Receive"

naming_series = None
bank = get_bank_cash_account(company, mode_of_payment)
company_currency = frappe.get_value("Company", company, "default_currency")
conversion_rate = get_exchange_rate(currency, company_currency, date, "for_selling")
paid_amount, received_amount = set_paid_amount_and_received_amount(
party_account_currency, bank, amount, payment_type, None, conversion_rate
)
if(payment_type == "Receive"):
naming_series = frappe.db.get_single_value('POSAwesome Settings', 'receive_payment_series')
if(payment_type == "Pay"):
naming_series = frappe.db.get_single_value('POSAwesome Settings', 'pay_payment_series')


pe = frappe.new_doc("Payment Entry")
pe.payment_type = payment_type
Expand Down Expand Up @@ -73,7 +78,9 @@ def create_payment_entry(
bank_account = get_party_bank_account(pe.party_type, pe.party)
pe.set("bank_account", bank_account)
pe.set_bank_account_data()


if naming_series and naming_series != "":
pe.naming_series = naming_series
pe.setup_party_account_field()
pe.set_missing_values()

Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright (c) 2023, Youssef Restom and contributors
// For license information, please see license.txt

frappe.ui.form.on('POSAwesome Settings', {
onload: function(frm){
frm.call('get_naming_series_options')
.then(r => {
frm.set_df_property("receive_payment_series", "options", r.message);
frm.set_df_property("pay_payment_series", "options", r.message);
});
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2023-11-07 18:44:10.965838",
"default_view": "List",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"payment_entry_settings_section",
"receive_payment_series",
"pay_payment_series"
],
"fields": [
{
"fieldname": "receive_payment_series",
"fieldtype": "Select",
"label": "Receive Payment Entry Series"
},
{
"fieldname": "pay_payment_series",
"fieldtype": "Select",
"label": "Pay Payment Entry Series"
},
{
"fieldname": "payment_entry_settings_section",
"fieldtype": "Section Break",
"label": "Payment Entry Settings"
}
],
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2023-11-07 20:14:01.912036",
"modified_by": "Administrator",
"module": "POSAwesome",
"name": "POSAwesome Settings",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"print": 1,
"read": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"track_changes": 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) 2023, Youssef Restom and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document
import frappe
from frappe import _

class POSAwesomeSettings(Document):
@frappe.whitelist()
def get_naming_series_options(self):
options = frappe.get_meta('Payment Entry').get_field("naming_series").options
return options


Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2023, Youssef Restom and Contributors
# See license.txt

# import frappe
from frappe.tests.utils import FrappeTestCase


class TestPOSAwesomeSettings(FrappeTestCase):
pass
Loading