تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
1485 أدوات العرض

Hi,

I need to have a small calculation on an Odoo website.
Cause there is no function in the standard blocks I tried to use "embed code".
I am not a specialist for such code an was asking online and ChatGPT ;-)
Here is a proposal that does not work:

(why is the /code not working??? now I replaced all brakets by "..")


..div class="container mt-5"..
  ..h1..Value Calculation without JavaScript or Scripts../h1..
  ..form method="post"..
    ..div class="form-group"..
      ..label for="inputValue"..Enter a value:../label..
      ..input type="number" class="form-control" name="inputValue" id="inputValue" placeholder="Enter value"..
    ../div..
    ..button type="submit" class="btn btn-primary" name="submit"..Calculate../button..
  ../form..
  ..div class="mt-3"..
    {% if request and request.httprequest.method == 'POST' %}
      {% set input_value = request.httprequest.form.get('inputValue') | float %}
      {% set result = input_value * 0.18 %}
      ..p..The 18% value is: {{ "%.2f" | format(result) }}../p..
    {% endif %}
  ../div..
../div..


However, the part between {...} is show like a standard text - not used to calculate and show the result.
Does anyone know how to do that?

Requirements:
Input field for the customer /site user.
Button to start calculation (a fixed percentage of the input)
Result showing to the customer / site user

Any help appreciated. Thanks.

الصورة الرمزية
إهمال
أفضل إجابة

Hello, to meet your requirement, it is a must that you will need to know coding stuff just like what Mr 

Muhammad Aadil have said sir, so you can ask some developers to help you with this, hope this information help

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

Hello Muhammad Aadil,

thanks for your feedback and recommendation.
Cause I am not a programmer I can not really test, what you wrote and I have to check other solutions or wait for other answers.
Best Matthias

الصورة الرمزية
إهمال
أفضل إجابة

Have you tried Odoo API (Web controller) for it.. You have to follow proper input routine then follow your calculations and post it.. For runtime you have to do using owl js.. for static or db based you have to use web controllers..

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
أغسطس 25
359
5
أغسطس 25
9961
2
يوليو 25
1022
4
يونيو 25
1158
1
يونيو 25
1467