Skip to Content
Menu
This question has been flagged
2 Replies
1077 Views
Hello, hello everyone, could someone help me with this query? 
When closing the POS session, there is an "add a closing note" text box. Is it possible to save that closing note in a custom field within the session?

Avatar
Discard
Author Best Answer

Thanks, it's working ...

Avatar
Discard
Best Answer

Hello  Fernando Meseguer Llera ,


When closing the POS session to save that closing note in a custom filed follow below steps.



1) Create your custom module and add below code in respective pos_seeion.py file.


# -*- coding: utf-8 -*-

# Part of Odoo. See LICENSE file for full copyright and licensing details.


from odoo import fields, models


// Code1 in Comment//


2) Add below xml code in your respective pos_sesion_views.xml file.



//Code2 in comment//



Do not forget to register your pos_session.py file in __init__.py

and xml file in your mdoule's manifest.


3) When user close the session from UI side, with Closing Note, Please refere below screenshot.



4) As you can see in below screenshot, In backend side of Session, In Custom field we can get the closing

   note of closed session.



Hope this helps.

   

If you need any help in customization feel free to contact us.

       

Thanks & Regards,

Email:  odoo@aktivsoftware.com           

Skype: kalpeshmaheshwari

Avatar
Discard

Code 1:

class PosSession(models.Model):
_inherit = 'pos.session'

closing_session_note = fields.Char("Close Session Note")

def _post_cash_details_message(self, state, difference, notes):
"""Over - rided method to fetch notes when session is closed
and update closing note in custom filed in backend."""

self.write({'closing_session_note' : notes})
res = super()._post_cash_details_message(state,difference,notes)
return res

Code 2:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="pos_session_form_view_inherit" model="ir.ui.view">
<field name="name">pos.session.form.view.inherit</field>
<field name="model">pos.session</field>
<field name="inherit_id" ref="point_of_sale.view_pos_session_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='stop_at']" position="after">
<field name="closing_session_note"/>
</xpath>
</field>
</record>
</odoo>

Related Posts Replies Views Activity
1
Jul 25
1743
4
Jul 25
2953
0
Mar 25
1079
2
Jan 25
2221
0
Jan 25
1176