Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Pos Orders: add a field from lines

Subscriure's

Get notified when there's activity on this post

This question has been flagged
posodoo11community
2 Respostes
4760 Vistes
Avatar
Carlos Cosme

Hi,

    we are working with a standar Odoo 11 POS module, we use two payment methods (cash and card). We know that a pos order can be paid with both methods (50% - 50% por example), but we just need to show in the order header the first payment method used.

Payment lines are stored in the "statement_ids" of "pos.order", and the field we need to show is "journal_id".

We tried:

1. adding a field in the header "<field name="statement_ids.journal_id"/>

2. adding a field in the header "<field name="statement_ids[0].journal_id"/>

3. adding a new field in the pos.order model using the advanced properties (dependencies, etc.)

But no one seems to work.

Another good option could be to simple be able to add a filter in the "Sales Details" report to show the standard information filtered by the payment method. My customer needs to know the information displayed there (productos sold in a period) but they need to know the payment method used (taking into account they only use one method by order).

Hope someone could help me.

Thanks.

0
Avatar
Descartar
Avatar
Volodymyr
Best Answer

Hi,

I would suggest you to add a new computed field which would be set with statement_ids[0].journal_id in the compute function.

first_journal_id = fields.Many2one('account.journal', compute='_compute_first_journal', store=True)

@api.depends('statement_ids', 'statement_ids.journal_id')
def _compute_first_journal(self):

    for record in self:

        record.first_journal_id = record.statement_ids[0].journal_id.id

Then you can use the new field in the view simply like usual field:

<field name="first_journal_id"/>


PS: be aware - I haven't tested that piece of code above, so please use it as a pre-sample :)

PSPS: if you like the answer - please don't forget to upvote it :) Thanks!

1
Avatar
Descartar
Avatar
Carlos Cosme
Autor Best Answer

Hi volodymyr,

    seems to be a good aproach but still didn't reach to solve it, surely is because I'm a functional consultant and only know a bit of technical issues.

Created a new field "x_first_journal_id", type "text".
Base properties: readonly "true", store "false", all others "false"
Advanced properties: dependencies "statement_ids", compute:

x_first_journal_id = fields.Many2one('account.journal', compute='_compute_first_journal', store=True)
@api.depends('statement_ids', 'statement_ids.journal_id')
def _compute_first_journal(self):
    for record in self:
        record.x_first_journal_id = record.statement_ids[0].journal_id.id

Saves OK but when I display in a form I get this error:

File "/usr/lib/python3/dist-packages/odoo/tools/safe_eval.py", line 189, in assert_valid_codeobj
    raise ValueError("forbidden opcode(s) in %r: %s" % (expr, ', '.join(opname[x] for x in codes)))
ValueError: forbidden opcode(s) in 'lambda': STORE_ATTR

Tried:
1. changing "store=true"
2. changing the last line for: "record.x_first_journal_id = record.statement_ids[0].journal_id", because I'm not sure about the ".id"

But get the same error, I don't still feel comfortable with the technical-code part. Any idea with this error?.
Thanks for your help ! 



0
Avatar
Descartar
Volodymyr

Carlos, I would advise to use a bit of technical support for this issue, because the way you've done it is not correct.

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
POS cash rounding Odoo 11
pos odoo11community
Avatar
Avatar
2
de febr. 20
3489
Can not close POS session. Odoo11
pos odoo11community
Avatar
Avatar
1
de des. 19
3222
(((Oficial ~ I.B.E.R.I.A!@!Costa~Rica))) ¿Cómo puedo llamar a Iberia en Costa Rica?
pos
Avatar
0
de des. 25
88
Kitchen printing printer other than odoo provided list
pos
Avatar
Avatar
1
de nov. 25
320
POS Table Synchronization Issue Between Devices in Odoo v17 CE
pos
Avatar
Avatar
Avatar
2
de nov. 25
2795
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now