Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

[V8]Use on_change to calculate a timedate field?

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
v8pythonpostimestampdefinition
5908 Widoki
Awatar
FEDERICO LEONI

I'm trying to calculate how much time expressed in minutes passed from the creation of a pos.order till the end on a  work center. I'm inherit the point_of_sale with a custom module:

class pos_order(osv.Model):
    _inherit = 'pos.order'

def on_change_kot_time(self,cr,user,ids,date_order,x_kot_time,context=None):
fmt = '%m/%d/%Y %H:%M:%S'
d1 = datetime.strptime(date_order, fmt)
d2 = datetime.strptime(x_kot_time, fmt)
d1_ts = time.mktime(d1.timetuple())
d2_ts = time.mktime(d2.timetuple())
timekot = int(d2_ts-d1_ts) / 60
res = {
'value': {
'x_minutes': timekot,
}
}
return res

but calling the definition with

<field name="field" on_change="on_change_kot_time(date_order,x_kot_time)/> 

on pos.order for the field date_order and my two custom fields (x_kot_time and x_minutes) didn't out the result and rise no errors. Just a side note: the x_kot_time is a timedate populated by a (working) server action with the python expression

datetime.datetime.now()

What I'm missing?

0
Awatar
Odrzuć
Yenthe Van Ginneken (Mainframe Monkey)

Have you tried adding alerts in your JS to see what is inside your variables and if it even goes off? I can't see any explicit problem at the moment. Try to debug your values to see if those methods are actually triggered and see what is in the variables.

FEDERICO LEONI
Autor

Yenthe, I have no idea on how to do that.

FEDERICO LEONI
Autor

Still stuck. I played around with the Chrome console but I can't see any error. Any idea?

Yenthe Van Ginneken (Mainframe Monkey)

You could try with a simple window.alert? And if you want to do debugging/logging in Python, this tutorial works great: http://www.mindissoftware.com/2014/09/07/Odoo-logging-configuration-usage-implementation/

FEDERICO LEONI
Autor

Tried with:

import logging

_logger = logging.getLogger(__name__)
LOG_FILENAME = '/home/effe/divina_log'
logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG)
And at the end of the function:
	_logger.debug("date_order value : %r", d1)
	_logger.debug("end_date value : %r", d2)
	_logger.debug("date_order_timestamp value : %r", d1_ts)
	_logger.debug("end_date_timestamp value : %r", d2_ts)
	_logger.debug("timekot value : %r", timekot)
	_logger.debug("minutes value : %r", minutes)
    
But the log file remains blank.
FEDERICO LEONI
Autor

Please note I've changed the name of the variables. Again it works fine directly on pycharm with psycopg2.

FEDERICO LEONI
Autor

I give up. In less than an hour I create a new .py that is listening to the db and update it out from Odoo. No issues so far after processing more than 500 orders (+/- 900 rows) while using Odoo at the same time. I'm sorry to say that even with the new "skin" Odoo documentation is really inadequate.

Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
[SOLVED] [V8] Is it possible to concatenate fields after filter them? Rozwiązane
v8 python pos personalization concatenate
Awatar
1
cze 15
5516
[V8] How to add timestamp to a processed order and calculate the time?
v8 fields pos custom timestamp
Awatar
1
cze 15
6557
Any method to group products in POS terminal?
v8 pos
Awatar
Awatar
1
lip 19
5000
POS and payment method
v8 pos
Awatar
Awatar
1
cze 16
5256
POS and product description
v8 pos
Awatar
0
cze 16
4401
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now