• ¡Welcome to Square Theme!
  • This news are in header template.
  • Please ignore this message.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random numbers in Basic Rate
#1
I am encountering an impossible bug.

I have created a Server Script to handle Before Submit of a Delivery Note.
The required functionality is record a special Material Transfer type Stock Entry

Today for the first time after more than 1500 executions, over the last two months, the script suddenly failed with the error …

""frappe.exceptions.Update After Submit Error:
____ Not allowed to change Basic Rate (as per Stock UOM) after submission"

… as you can see here below:

Code:
:       :       :       :       :       :
File "apps/frappe/frappe/model/document.py", line 868, in validate_update_after_submit
  d._validate_update_after_submit()
File "apps/frappe/frappe/model/base_document.py", line 857, in _validate_update_after_submit
  frappe.throw(
File "apps/frappe/frappe/__init__.py", line 504, in throw
  msgprint(
File "apps/frappe/frappe/__init__.py", line 479, in msgprint
  _raise_exception()
File "apps/frappe/frappe/__init__.py", line 434, in _raise_exception
  raise raise_exception(msg)
frappe.exceptions.UpdateAfterSubmitError:
   Not allowed to change Basic Rate (as per Stock UOM) after submission

After poking around for hours I edited the Frappe source code to add print statement line
Code:
print(f"df.label: {df.label} || self_value: ({self_value})  versus  db_value: ({db_value})")
… just before the thrown exception, like this …

File : frappe/frappe/model/base_document.py

My Date and Number Format settings specify Float = 9, but evidently the random number generated can be Float = 12 and causes this first “collision” after >1500 executions.

Even more annoying … it is not random!!! because I get the value 0.004792216125 every single time.
Questions:

    From where does Basic Rate (as per Stock UOM) get its value?
    How can I force a value of zero?
    Why do I get an “after submission” fault, if I am inserting a new record?
 
Reply
#2
It's odd how it keeps generating the same random value every time. Have you tried exploring your system settings to trace where that value might be coming from?And that "after submission" fault you're encountering—even with new records—is definitely unexpected. It might be worth revisiting any validation rules or restrictions in your system to see what's causing it.Your workaround with setting 'docstatus': 0 seems to provide a temporary fix, but it's important to unravel the underlying issue. But if you're ever stuck, you can always use a d20 roller to shake things up and approach the problem from a different angle.
 
Reply
#3
If you’re looking to generate random numbers or perform calculations related to basic rates, you can use an online tool to make it easier. For instance, the Online calculadora provides a variety of calculation options that can help you with quick number generation or rate calculations.
 
Reply
#4
(11-15-2024, 02:54 AM)Avaraine Wrote: If you’re looking to generate random numbers or perform calculations related to basic rates, you can use an online tool to make it easier. For instance, the Online calculadora provides a variety of calculation options that can help you with quick number generation or rate calculations.

YouTube Vanced App is an advanced version of YouTube. It has all of YouTube's main features, along with additional free Premium ones. youtube vanced apk
 
Reply
#5
In the context of Basic Rate, random numbers are often used in various applications such as simulations, statistical analysis, or generating unpredictable sequences for cryptographic purposes. Basic Rate refers to a standard level of data transmission or service, and incorporating random numbers can aid in system testing or network management. By leveraging tools like Calculators, users can generate random numbers to model or experiment with different scenarios under Basic Rate conditions. These calculators simplify the process, making it easier to integrate randomness into projects that require unpredictable or non-repeating values.
 
Reply
#6
Generating random numbers in basic rate can be useful for simulations, games, or testing algorithms. In programming, random numbers are usually generated within a specified range. To generate random numbers at a basic rate, you can use built-in functions such as `RND` in BASIC programming languages. By specifying a seed value or using system time, you can control the randomness. These numbers are often used for creating unpredictable outcomes or patterns. For more details on how to implement random number generation at a basic rate in your projects, visit gbappsdl.net.
 
Reply
#7
If you are planning a short trip to the United Arab Emirates, the 2 weeks uae visa is the perfect option. It is a simple and convenient visa for travelers who want to explore the UAE for a short time. This blog will explain what a 2 weeks visa UAE is, how to apply for it, the documents you need, and its cost. UAE Visa Online
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)