İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
1090 Görünümler
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
Vazgeç
Üretici En İyi Yanıt

Thanks, it's working ...

Avatar
Vazgeç
En İyi Yanıt

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
Vazgeç

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>

İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Tem 25
1797
4
Tem 25
3035
0
Mar 25
1126
2
Oca 25
2278
0
Oca 25
1222