Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
1196 Widoki
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?

Awatar
Odrzuć
Autor Najlepsza odpowiedź

Thanks, it's working ...

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć

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>

Powiązane posty Odpowiedzi Widoki Czynność
1
lip 25
2037
4
sie 25
3304
0
mar 25
1315
2
sty 25
2464
0
sty 25
1409