Odoo Help

3

0
2 Answers
0
Victor Lopes Brazil
4/16/18, 2:31 PM

Hi there, you've probably found your answer by now, but for those looking for this, here is a step-by-step way of doing it, in Odoo 10:

As Jainesh stated above, you have to find a way of selecting sessions in a "opened" (in progress) state and then calling the proper method in order to close them.

If you look at the FormView of the "close" page of a given POS session (using the developer menu) you'll note that the method that the button "Validate Closing & Post Entries" calls is the following:

      action_pos_session_closing_control

You will find this method in the file pos_session.py, around line 238. You have to create a new method in this POS module to select the sessions you want and call this action_pos_session_closing_control method for them:

1. Edit the file your_odoo_server_path/addons/point_of_sale/models/pos_session.py and include the following code:

@api.model

def auto_close_pos_session(self):

""" Method called by scheduled actions to close currently open sessions """

return self.search([('state', '=', 'opened')]).action_pos_session_closing_control()

You can place it right bellow the other method, for example. Please mind the spaces, as python has a specific indentation syntax. Restart Odoo's service using: service odoo-server restart

Note that we're creating a new method called "auto_close_pos_session", searching for sessions with state = opened and calling the method we discussed.

2. In Odoo, activate the developer mode and go to "Technical > Scheduled Actions" in the Settings module. Create a new scheduled action and, in the "Technical Data" tab (section "Action to Trigger") provide the following info:

Object: pos.session

Method: auto_close_pos_session

Arguments: ()

Then give this scheduled action a name, plus the interval and date you want and save it.

0
Avatar

Jainesh Shah India

--Jainesh Shah--
4407
| 6 3 9
Ahmedabad, India
--Jainesh Shah--

Started off with a small number and here we are serving multiple Odoo development organizations as a backend technical and functional Odoo force.
Apart from various business-oriented goals, we as a team have strongly emphasized on serving the Odoo Community. Being into the development of the open-source community we continuously thrive to learn, share and contribute to Odoo. Odoo having 20,000+ people contributing to the community from around the globe, we are proud that we belong here.
Talking about our contribution to Odoo Community we have prepared over 50+ Aktiv app modules. Moreover, we have launched wide range of modules that enhance the out-of-box functionalities of Odoo and meets the real-time business scenarios.
-POS
-Project Management
-Website
-Accounting
-Sales
-Productivity
-Inventory
-Document Management
-Human Resources
-Payment module (Payment Reminder)
-User Accessibility (Sign Up with Mobile Number, Activity Log)
-Report Modules (PDF, Printing, Invoice)
All in all, we combine the ERP solutions to add icing on the cake thereby beautifying the base of default Odoo functionalities. So, raise the bar of your business with our Go-To Odoo Apps.
To know more about the latest trends and innovations in Odoo you can also stay in tune with our social media profiles and grab relevant inside scoops.
“Your rewards are always in direct proportion to your contribution”. Keep Sharing, Keep Growing!

Jainesh Shah India
6/15/17, 8:41 AM

Create scheduler which calls every day by 12:00 am in which you need to find all active session(which is in 'open' state)and call open_existing_session_cb_clos method to close sessions.

Ask a Question
Writer
1096
JC
Keep Informed
2 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now