Hello community,
I've encountered this and I am not sure how it works. It's in the accounting module in the Journal entries form view
Its about that line:
<field name="account_id" domain="[('company_id', '=', parent.company_id), ('deprecated', '=', False)]"/>
What is parent standing for here? Is the notebook (or the widget one2many_list) considered as a child of the <sheet> of the form view. So parent.account_id refers to the account id of the record that's open on the form?
<record id="view_move_form" model="ir.ui.view">
<field name="name">account.move.form</field>
<field name="model">account.move</field>
<field name="arch" type="xml">
<form string="Account Entry">
<header>
<button name="post" states="draft" string="Post" type="object" class="oe_highlight" groups="account.group_account_invoice"/>
<button name="%(action_view_account_move_reversal)d" states="posted" string="Reverse Entry" type="action" groups="account.group_account_invoice"/>
<button name="button_cancel" states="posted" string="Cancel Entry" type="object" groups="account.group_account_invoice"/>
<field name="state" widget="statusbar"/>
</header>
<sheet>
<div class="oe_button_box">
<button name="open_reconcile_view"
class="oe_stat_button"
icon="fa-bars"
type="object"
string="Reconciled entries">
</button>
</div>
<label for="name" class="oe_edit_only" attrs="{'invisible':[('name','=','/')]}"/>
<h1>
<field name="name" readonly="True" attrs="{'invisible':[('name','=','/')]}"/>
</h1>
<group>
<group>
<field name="journal_id" options="{'no_open': True, 'no_create': True}"/>
<field name="date"/>
</group>
<group>
<field name="ref"/>
<field name="company_id" required="1" groups="base.group_multi_company"/>
<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="analytic_account_id" groups="analytic.group_analytic_accounting"/>
<field name="amount_currency" groups="base.group_multi_currency"/>
<field name="company_currency_id" invisible="1"/>
<field name="currency_id" options="{'no_create': True}" groups="base.group_multi_currency"/>
<field name="debit" sum="Total Debit"/>
<field name="credit" sum="Total Credit"/>
<field name="date_maturity" required="0"/>
</tree>
</field>
<field name="narration" colspan="4" placeholder="Add an internal note..." nolabel="1" height="50"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>