Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
1100 Visualizzazioni
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
Abbandona
Autore Risposta migliore

Thanks, it's working ...

Avatar
Abbandona
Risposta migliore

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
Abbandona

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>

Post correlati Risposte Visualizzazioni Attività
1
lug 25
1829
4
lug 25
3057
0
mar 25
1138
2
gen 25
2295
0
gen 25
1238