İçereği Atla
Menü
Bu soru işaretlendi

Hello everyone, I need help from the forum.


I have created an import script from odoo 8 to odoo 16, and almost everything works correctly, but there is only one thing that does not work correctly, and that is when closing the POS sessions using the odoo 16 api. I have all the amounts of the orders and payments of these orders rounded and compared with the total to be able to record the same payment without decimal variations and that the totals of orders and payments are the same and this is true, but at the time of closing the session from the api with the "action_pos_session_closing_control" sometimes closes it but other times it does not close it, and I have to manually access odoo and close it, when I do this it shows me a message of "Force session closure" There is a difference between the amounts to be posted and order amounts, is probably due to taxes or changes to accounting settings. This difference is -0.01, which is impossible since I have reviewed all the totals and everything is perfect and not even 1 cent is missing. Is there a way to log out just like I do it manually in Odoo 16, to do it with the API? Still doing forced logout. I have tried all the methods included in the "pos_session.py" class of the odoo 16 core but it is impossible, the session is not closed. And if not, what happens is this due to an odoo 16 error? Since I have seen many people on the forum with this same problem.



I leave you part of my code that I use to close the sessions and that in some the method works and in others it does not, causing the problem of forcing the session to close.

models_target.execute_kw(db_target, uid_target, password_target,    
​​'pos.session', ​
​'action_pos_session_closing_control',
​​[[id_new_pos_session]]
)


This code is the one I try to use when the session does not close because it has an imbalance of -0.01 and it does not work, the session is still in closing control.

models_target.execute_kw(db_target, uid_target, password_target,
​'pos.session', ​
​'action_pos_session_closing_control',
​​[[id_new_pos_session]],
​​{'context': { ​ ​
​'active_model': 'pos.session', ​ ​
​'active_id': id_new_pos_session, ​ ​
​'active_ids': [id_new_pos_session], ​
​​'force_close': True, ​
​​'cash_control': False,
​​}}
)

wizard_id = models_target.execute_kw(db_target, uid_target, password_target, ​
​'pos.close.session.wizard',
​​'create',
​​[{}]
)

models_target.execute_kw(db_target, uid_target, password_target, ​
​'pos.close.session.wizard',
​​'close_session',
​​[[(wizard_id)]],
​​{'context': { ​
​​'active_model': 'pos.session', ​ ​​
​'active_ids': [id_new_pos_session], ​
​}}
)

I hope someone can help me, thank you.

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Ağu 25
1006
1
Ağu 25
1247
2
Tem 25
4041
3
Tem 25
1326
1
Haz 25
3099