Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

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

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

Persistent error : " field = target._fields[name] KeyError: 'company_id'"

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
2 Besvarelser
6648 Visninger
Avatar
Antonio Vangi
I have always the same error:
  File "/usr/lib/python3/dist-packages/odoo/fields.py", line 547, in _setup_related_full
    field = target._fields[name]
KeyError: 'company_id'

 
For me it's all ok

THIS IS MY VIEW:
===============
<odoo>
<data>

<record
id="gcond.view_move_tree" model="ir.ui.view">
<field
name="name">test.move.tree</field>
<field
name="model">test.registra.mm</field>
<field
name="arch" type="xml">
<tree
decoration-info="state == 'draft'" string="Journal Entries">
<field
name="date"/>
<field
name="name"/>
<field
name="partner_id"/>
<field
name="ref"/>
<field
name="journal_id"/>
<field
name="amount" sum="Total Amount"/>
<field
name="state"/>
<field
name="currency_id" invisible="1"/>
</tree>
</field>
</record>

<record
id="gcond.view_form_mm" model="ir.ui.view">
<field
name="name">test.account.reg.form.mm</field>
<field
name="model">test.registra.mm</field>
<field
name="arch" type="xml">
<form
string="Account Entry" duplicate="false">
<header>
<field
name="state" widget="statusbar"/>
</header>
<sheet>
<field
name="id" invisible="1"/>
<div
class="oe_button_box">
</div>
<h1>
<field
name="name" readonly="True" attrs="{'invisible':[('name','=','/')]}"/>
</h1>
<group>
<group>
<field
name="date"/>
</group>
<group>
<field
name="journal_id" options="{'no_open': True, 'no_create': True}"/>
<field
name="company_id"/>
<field
name="amount" invisible="1"/>
<field
name="currency_id" invisible="1"/>

</group>
</group>
<notebook>
<page
string="Journal Items">
<field
name="line_ids" widget="one2many_list"
context="{'line_ids': line_ids, 'journal_id': journal_id }">
<tree
editable="bottom" string="Journal Items">
<field
name="account_id" domain="[('company_id', '=', parent.company_id), ('deprecated', '=', False)]"/>
<field
name="partner_id"
domain="['|', ('parent_id', '=', False), ('is_company', '=', True)]"/>
<field
name="name"/>
<field
name="company_currency_id" invisible="1"/>
<field
name="company_id" domain="[('company_id', '=', parent.company_id)]" invisible="1"/>
<field
name="currency_id" options="{'no_create': True}" />
<field
name="debit" sum="Total Debit"/>
<field
name="credit" sum="Total Credit"/>
</tree>
<!-- Form view to cover mobile use -->
<form>
<group>

</group>
</form>
</field>
</page>
<page
string="Other Info">
<group>

</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>


<record
id="gcond.view_account_move_filter" model="ir.ui.view">
<field
name="name">test.move.select</field>
<field
name="model">test.registra.mm</field>
<field
name="arch" type="xml">
<search
string="Search Move">
<field
name="name" filter_domain="['|', ('name','ilike',self), ('ref','ilike',self)]" string="Move"/>
<field
name="date"/>
<filter
string="Unposted" name="unposted" domain="[('state','=','draft')]" help="Unposted Journal Entries"/>
<filter
string="Posted" name="posted" domain="[('state','=','posted')]" help="Posted Journal Entries"/>
<separator/>
<filter
string="Sales" name="sales" domain="[('journal_id.type','=','sale')]" context="{'default_journal_type': 'sale'}"/>
<filter
string="Purchases" name="purchases" domain="[('journal_id.type','=','purchase')]" context="{'default_journal_type': 'purchase'}"/>
<filter
string="Bank Operations" name="bankoperations" domain="[('journal_id.type','=','bank')]" context="{'default_journal_type': 'bank'}"/>
<filter
string="Cash Operations" name="cashoperations" domain="[('journal_id.type','=','cash')]" context="{'default_journal_type': 'cash'}"/>
<filter
string="Miscellaneous Operations" domain="[('journal_id.type','=','general')]" name="misc_filter" context="{'default_journal_type': 'general'}"/>
<separator/>
<field
name="partner_id"/>
<field
name="journal_id"/>
<group
expand="0" string="Group By">
<filter
string="Partner" name="partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter
string="Journal" name="journal" domain="[]" context="{'group_by':'journal_id'}"/>
<filter
string="Status" name="status" domain="[]" context="{'group_by':'state'}"/>
<filter
string="Date" name="date" domain="[]" context="{'group_by':'date'}" help="Journal Entries by Date"/>
</group>
</search>
</field>
</record>

<!-- actions opening views on models -->

<record model="ir.actions.act_window" id="gcond.action_window">
<field
name="name">gcond window</field>
<field
name="res_model">test.registra.mm</field>
<field
name="view_mode">tree,form</field>
</record>

<record
id="gcond.action_move_journal_line" model="ir.actions.act_window">
<field
name="name">Journal Entries</field>
<field
name="res_model">test.registra.mm</field>
<field
name="view_type">form</field>
<field
name="view_mode">tree,form</field>
<field
name="view_id" ref="gcond.view_move_tree"/>
<field
name="search_view_id" ref="gcond.view_account_move_filter"/>
<field
name="context">{'search_default_misc_filter':1, 'view_no_maturity': True}</field>
<field
name="help" type="html">
<p
class="o_view_nocontent_smiling_face">
Create a journal entry
</p><p>
A journal entry consists of several journal items, each of
which is either a debit or a credit transaction.
</p>
</field>
</record>

<menuitem
name="Gcond"
id="gcond.menu_condominio"
web_icon="account,static/description/icon.png"
sequence="40"/>
<!-- Top menu item -->
<!-- menu categories -->

<menuitem name="Millesimi" id="gcond.menu_1" parent="gcond.menu_condominio"/>

<!--
<menuitem name="Menu 2" id="gcond.menu_2" parent="gcond.menu_root"/>
-->
<!-- actions -->

<menuitem name="Lista" id="gcond.menu_1_list" parent="gcond.menu_1" action="gcond.action_window"/>
<!--
<menuitem name="Server to list" id="gcond" parent="gcond.menu_2"
action="gcond.action_server"/>
-->

<menuitem
action="gcond.action_move_journal_line"
id="menu_action_move_journal_line_form"
parent="gcond.menu_condominio"
sequence="1"/>

</data>
</odoo>


THIS IS MY MODEL: ================
<odoo>
<data>

<record
id="gcond.view_move_tree" model="ir.ui.view">
<field
name="name">test.move.tree</field>
<field
name="model">test.registra.mm</field>
<field
name="arch" type="xml">
<tree
decoration-info="state == 'draft'" string="Journal Entries">
<field
name="date"/>
<field
name="name"/>
<field
name="partner_id"/>
<field
name="ref"/>
<field
name="journal_id"/>
<field
name="amount" sum="Total Amount"/>
<field
name="state"/>
<field
name="currency_id" invisible="1"/>
</tree>
</field>
</record>

<record
id="gcond.view_form_mm" model="ir.ui.view">
<field
name="name">test.account.reg.form.mm</field>
<field
name="model">test.registra.mm</field>
<field
name="arch" type="xml">
<form
string="Account Entry" duplicate="false">
<header>
<field
name="state" widget="statusbar"/>
</header>
<sheet>
<field
name="id" invisible="1"/>
<div
class="oe_button_box">
</div>
<h1>
<field
name="name" readonly="True" attrs="{'invisible':[('name','=','/')]}"/>
</h1>
<group>
<group>
<field
name="date"/>
</group>
<group>
<field
name="journal_id" options="{'no_open': True, 'no_create': True}"/>
<field
name="company_id"/>
<field
name="amount" invisible="1"/>
<field
name="currency_id" invisible="1"/>

</group>
</group>
<notebook>
<page
string="Journal Items">
<field
name="line_ids" widget="one2many_list"
context="{'line_ids': line_ids, 'journal_id': journal_id }">
<tree
editable="bottom" string="Journal Items">
<field
name="account_id" domain="[('company_id', '=', parent.company_id), ('deprecated', '=', False)]"/>
<field
name="partner_id"
domain="['|', ('parent_id', '=', False), ('is_company', '=', True)]"/>
<field
name="name"/>
<field
name="company_currency_id" invisible="1"/>
<field
name="company_id" domain="[('company_id', '=', parent.company_id)]" invisible="1"/>
<field
name="currency_id" options="{'no_create': True}" />
<field
name="debit" sum="Total Debit"/>
<field
name="credit" sum="Total Credit"/>
</tree>
<!-- Form view to cover mobile use -->
<form>
<group>

</group>
</form>
</field>
</page>
<page
string="Other Info">
<group>

</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>


<record
id="gcond.view_account_move_filter" model="ir.ui.view">
<field
name="name">test.move.select</field>
<field
name="model">test.registra.mm</field>
<field
name="arch" type="xml">
<search
string="Search Move">
<field
name="name" filter_domain="['|', ('name','ilike',self), ('ref','ilike',self)]" string="Move"/>
<field
name="date"/>
<filter
string="Unposted" name="unposted" domain="[('state','=','draft')]" help="Unposted Journal Entries"/>
<filter
string="Posted" name="posted" domain="[('state','=','posted')]" help="Posted Journal Entries"/>
<separator/>
<filter
string="Sales" name="sales" domain="[('journal_id.type','=','sale')]" context="{'default_journal_type': 'sale'}"/>
<filter
string="Purchases" name="purchases" domain="[('journal_id.type','=','purchase')]" context="{'default_journal_type': 'purchase'}"/>
<filter
string="Bank Operations" name="bankoperations" domain="[('journal_id.type','=','bank')]" context="{'default_journal_type': 'bank'}"/>
<filter
string="Cash Operations" name="cashoperations" domain="[('journal_id.type','=','cash')]" context="{'default_journal_type': 'cash'}"/>
<filter
string="Miscellaneous Operations" domain="[('journal_id.type','=','general')]" name="misc_filter" context="{'default_journal_type': 'general'}"/>
<separator/>
<field
name="partner_id"/>
<field
name="journal_id"/>
<group
expand="0" string="Group By">
<filter
string="Partner" name="partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter
string="Journal" name="journal" domain="[]" context="{'group_by':'journal_id'}"/>
<filter
string="Status" name="status" domain="[]" context="{'group_by':'state'}"/>
<filter
string="Date" name="date" domain="[]" context="{'group_by':'date'}" help="Journal Entries by Date"/>
</group>
</search>
</field>
</record>

<!-- actions opening views on models -->

<record model="ir.actions.act_window" id="gcond.action_window">
<field
name="name">gcond window</field>
<field
name="res_model">test.registra.mm</field>
<field
name="view_mode">tree,form</field>
</record>

<record
id="gcond.action_move_journal_line" model="ir.actions.act_window">
<field
name="name">Journal Entries</field>
<field
name="res_model">test.registra.mm</field>
<field
name="view_type">form</field>
<field
name="view_mode">tree,form</field>
<field
name="view_id" ref="gcond.view_move_tree"/>
<field
name="search_view_id" ref="gcond.view_account_move_filter"/>
<field
name="context">{'search_default_misc_filter':1, 'view_no_maturity': True}</field>
<field
name="help" type="html">
<p
class="o_view_nocontent_smiling_face">
Create a journal entry
</p><p>
A journal entry consists of several journal items, each of
which is either a debit or a credit transaction.
</p>
</field>
</record>

<menuitem
name="Gcond"
id="gcond.menu_condominio"
web_icon="account,static/description/icon.png"
sequence="40"/>
<!-- Top menu item -->
<!-- menu categories -->

<menuitem name="Millesimi" id="gcond.menu_1" parent="gcond.menu_condominio"/>

<!--
<menuitem name="Menu 2" id="gcond.menu_2" parent="gcond.menu_root"/>
-->
<!-- actions -->

<menuitem name="Lista" id="gcond.menu_1_list" parent="gcond.menu_1" action="gcond.action_window"/>
<!--
<menuitem name="Server to list" id="gcond" parent="gcond.menu_2"
action="gcond.action_server"/>
-->

<menuitem
action="gcond.action_move_journal_line"
id="menu_action_move_journal_line_form"
parent="gcond.menu_condominio"
sequence="1"/>

</data>
</odoo>
0
Avatar
Kassér
Antonio Vangi
Forfatter
Thank's

Il giorno lun 1 giu 2020 alle ore 23:08 Noura EL ALLAM <nea@odoo.com> ha scritto:

Une nouvelle question Persistent error : " field = target._fields[name] KeyError: 'company_id'" le Aide a été publiée. Cliquez ici pour accéder à la question :

Voir la question


Envoyé par Odoo S.A. using Odoo.

Avatar
Antonio Vangi
Forfatter Bedste svar

SORRY THIS IS THE MODEL

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

from copy import deepcopy
import logging
import time
from datetime import date
from collections import OrderedDict, defaultdict
from odoo import api, fields, models, _
from odoo.osv import expression
from odoo.exceptions import RedirectWarning, UserError, ValidationError
from odoo.tools.misc import formatLang, format_date
from odoo.tools import float_is_zero, float_compare
from odoo.tools.safe_eval import safe_eval
from odoo.addons import decimal_precision as dp
from lxml import etree



_logger = logging.getLogger(__name__)


class TestMove(models.Model):
_name = "test.registra.mm"
_description = "Journal Entries mm"
_order = 'date desc, id desc'


@api.multi
def _get_default_journal(self):
#raise UserError("test sul company_id dell'utente (n. %d), questo è il test su 'default_journal_type' : %s" % (self.env.user.company_id.id, self.env.context.get('default_journal_type')))
if self.env.context.get('default_journal_type'):
return self.env['account.journal'].search([('company_id', '=', self.env.user.company_id.id), ('type', '=', self.env.context['default_journal_type'])], limit=1).id

@api.one
@api.depends('company_id')
def _compute_currency(self):
_logger.info("========================================= user -> company (n. %s)" % (str(self.env.user.company_id)))
self.currency_id = self.company_id.currency_id or self.env.user.company_id.currency_id


@api.multi
@api.depends('line_ids.partner_id')
def _compute_partner_id(self):
for move in self:
partner = move.line_ids.mapped('partner_id')
move.partner_id = partner.id if len(partner) == 1 else False



@api.multi
@api.depends('line_ids.debit', 'line_ids.credit')
def _amount_compute(self):
for move in self:
total = 0.0
for line in move.line_ids:
total += line.debit
move.amount = total


name = fields.Char(string='Number', required=True, copy=False, default='/')
ref = fields.Char(string='Reference', copy=False)
date = fields.Date(required=True, index=True, default=fields.Date.context_today)
line_ids = fields.One2many('test.move.line', 'move_id', string='Journal Items', copy=True)
journal_id = fields.Many2one('account.journal', string='Journal', required=True,
states={'posted': [('readonly', True)]},
default=_get_default_journal)
partner_id = fields.Many2one('res.partner', compute='_compute_partner_id', string="Partner", store=True, readonly=True)
amount = fields.Monetary(compute='_amount_compute', store=True)

currency_id = fields.Many2one('res.currency', compute='_compute_currency', store=True, string="Currency")
state = fields.Selection([('draft', 'Unposted'), ('posted', 'Posted')], string='Status',
required=True, readonly=True, copy=False, default='draft',
help='All manually created new journal entries are usually in the status \'Unposted\', '
'but you can set the option to skip that status on the related journal. '
'In that case, they will behave as journal entries automatically created by the '
'system on document validation (invoices, bank statements...) and will be created '
'in \'Posted\' status.')
# qui dovrebbe essereci l'errore: abbiamo il registro (ed anche l'azienda) ma ma non lo vede come secondo livello
company_id = fields.Many2one('res.company', related='journal_id.company_id', string='Company', store=True,
readonly=False)

@api.multi
def assert_balanced(self):
if not self.ids:
return True

# /!\ As this method is called in create / write, we can't make the assumption the computed stored fields
# are already done. Then, this query MUST NOT depend of computed stored fields (e.g. balance).
# It happens as the ORM makes the create with the 'no_recompute' statement.
self._cr.execute('''
SELECT line.move_id, ROUND(SUM(line.debit - line.credit), currency.decimal_places)
FROM test_move_line line
JOIN test_registra_mm move ON move.id = line.move_id
JOIN account_journal journal ON journal.id = move.journal_id
JOIN res_company company ON company.id = journal.company_id
JOIN res_currency currency ON currency.id = company.currency_id
WHERE line.move_id IN %s
GROUP BY line.move_id, currency.decimal_places
HAVING ROUND(SUM(line.debit - line.credit), currency.decimal_places) != 0.0;
''', [tuple(self.ids)])

res = self._cr.fetchone()
if res:
raise UserError(
_("Cannot create unbalanced journal entry.") +
"\n\n{}{}".format(_('Difference debit - credit: '), res[1])
)
return True

@api.model
def create(self, vals):
move = super(TestMove,
self.with_context(check_move_validity=False, partner_id=vals.get('partner_id'))).create(vals)
_logger.info("===================================================")
_logger.info("\n\n{}{}".format(_('funzione create: '), str(vals)))
move.assert_balanced()
return move

@api.multi
def write(self, vals):
if 'line_ids' in vals:
res = super(TestMove, self.with_context(check_move_validity=False)).write(vals)
self.assert_balanced()
else:
res = super(TestMove, self).write(vals)
_logger.info("========================================= risultato (n. %s)" % (str(vals)))
return res




class TestMoveLine(models.Model):
_name = "test.move.line"
_description = "Dettaglio registrazione millesimi"
_order = "date desc, id desc"

@api.model
def _get_currency(self):
currency = False
context = self._context or {}
if context.get('default_journal_id', False):
currency = self.env['account.journal'].browse(context['default_journal_id']).currency_id
return currency

@api.model
def _debug_contexet(self):
contesto = dict(self.env.context)
_logger.info("================" + str(contesto))

name = fields.Char(string="Label")

company_currency_id = fields.Many2one('res.currency', related='company_id.currency_id', string="Company Currency",
readonly=True,
help='Utility field to express amount currency', store=True)
currency_id = fields.Many2one('res.currency', string='Currency', default=_get_currency, help="The optional other currency if it is a multi-currency entry.")

account_id = fields.Many2one('account.account', string='Account', required=True, index=True,
ondelete='restrict', domain=[('deprecated', '=', True)],
default=lambda self: self._context.get('account_id', False))
move_id = fields.Many2one('test.registra.mm', string='Journal Entry', ondelete="cascade", help="The move of this entry line.", index=True, required=True, auto_join=True)
debit = fields.Monetary(default=0.0, currency_field='company_currency_id')
credit = fields.Monetary(default=0.0, currency_field='company_currency_id')
balance = fields.Monetary(store=True, currency_field='company_currency_id', help="Technical field holding the debit - credit in order to open meaningful graph views from reports")

journal_id = fields.Many2one('account.journal', related='move_id.journal_id', string='Journal', readonly=False,
index=True, store=True, copy=False) # related is required

date = fields.Date(related='move_id.date', string='Date', index=True, store=True, copy=False,
readonly=False) # related is required
partner_id = fields.Many2one('res.partner', string='Partner', ondelete='restrict')
company_id = fields.Many2one('res.company', related='account_id.company_id', string='Company', store=True,
readonly=True)

@api.model
def _query_get(self, domain=None):

self.check_access_rights('read')

context = dict(self._context or {})
_logger.info("========================================= contesto query (n. %s)" % (str(context)))

domain = domain or []
if not isinstance(domain, (list, tuple)):
domain = safe_eval(domain)

date_field = 'date'
if context.get('aged_balance'):
date_field = 'date_maturity'
if context.get('date_to'):
domain += [(date_field, '<=', context['date_to'])]
if context.get('date_from'):
if not context.get('strict_range'):
domain += ['|', (date_field, '>=', context['date_from']),
('account_id.user_type_id.include_initial_balance', '=', True)]
elif context.get('initial_bal'):
domain += [(date_field, '<', context['date_from'])]
else:
domain += [(date_field, '>=', context['date_from'])]

if context.get('journal_ids'):
domain += [('journal_id', 'in', context['journal_ids'])]

state = context.get('state')
if state and state.lower() != 'all':
domain += [('move_id.state', '=', state)]

if context.get('company_id'):
domain += [('company_id', '=', context['company_id'])]

if 'company_ids' in context:
domain += [('company_id', 'in', context['company_ids'])]

if context.get('reconcile_date'):
domain += ['|', ('reconciled', '=', False), '|',
('matched_debit_ids.max_date', '>', context['reconcile_date']),
('matched_credit_ids.max_date', '>', context['reconcile_date'])]

if context.get('account_tag_ids'):
domain += [('account_id.tag_ids', 'in', context['account_tag_ids'].ids)]

if context.get('account_ids'):
domain += [('account_id', 'in', context['account_ids'].ids)]

if context.get('analytic_tag_ids'):
domain += [('analytic_tag_ids', 'in', context['analytic_tag_ids'].ids)]

if context.get('analytic_account_ids'):
domain += [('analytic_account_id', 'in', context['analytic_account_ids'].ids)]

if context.get('partner_ids'):
domain += [('partner_id', 'in', context['partner_ids'].ids)]

if context.get('partner_categories'):
domain += [('partner_id.category_id', 'in', context['partner_categories'].ids)]

where_clause = ""
where_clause_params = []
tables = ''
if domain:
query = self._where_calc(domain)

# Wrap the query with 'company_id IN (...)' to avoid bypassing company access rights.
self._apply_ir_rules(query)

tables, where_clause, where_clause_params = query.get_sql()
return tables, where_clause, where_clause_params
0
Avatar
Kassér
Enjoying the discussion? Don't just read, join in!

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

Tilmeld dig
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة 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 er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

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