Add warning when using implicit rec_name target for relational domain
This commit is contained in:
+15
-15
@@ -880,7 +880,7 @@ class Account(
|
||||
'readonly': _states['readonly'],
|
||||
},
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
debit_type = fields.Many2One(
|
||||
'account.account.type', "Debit Type", ondelete='RESTRICT',
|
||||
@@ -891,7 +891,7 @@ class Account(
|
||||
| (_states['readonly']) & ~Eval('debit_type')),
|
||||
},
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
],
|
||||
help="The type used if not empty and debit > credit.")
|
||||
credit_type = fields.Many2One(
|
||||
@@ -903,7 +903,7 @@ class Account(
|
||||
| (_states['readonly']) & ~Eval('credit_type')),
|
||||
},
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
],
|
||||
help="The type used if not empty and debit < credit.")
|
||||
parent = fields.Many2One(
|
||||
@@ -952,7 +952,7 @@ class Account(
|
||||
taxes = fields.Many2Many('account.account-account.tax',
|
||||
'account', 'tax', 'Default Taxes',
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
('parent', '=', None),
|
||||
],
|
||||
help="Default taxes for documents to be applied "
|
||||
@@ -2172,12 +2172,12 @@ class GeneralLedgerAccountContext(ModelView):
|
||||
fiscalyear = fields.Many2One('account.fiscalyear', 'Fiscal Year',
|
||||
required=True,
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
],
|
||||
depends=['company'])
|
||||
start_period = fields.Many2One('account.period', 'Start Period',
|
||||
domain=[
|
||||
('fiscalyear', '=', Eval('fiscalyear')),
|
||||
('fiscalyear', '=', Eval('fiscalyear', -1)),
|
||||
('start_date', '<=', (Eval('end_period'), 'start_date')),
|
||||
],
|
||||
states={
|
||||
@@ -2185,7 +2185,7 @@ class GeneralLedgerAccountContext(ModelView):
|
||||
})
|
||||
end_period = fields.Many2One('account.period', 'End Period',
|
||||
domain=[
|
||||
('fiscalyear', '=', Eval('fiscalyear')),
|
||||
('fiscalyear', '=', Eval('fiscalyear', -1)),
|
||||
('start_date', '>=', (Eval('start_period'), 'start_date'))
|
||||
],
|
||||
states={
|
||||
@@ -2710,11 +2710,11 @@ class IncomeStatementContext(ModelView):
|
||||
fiscalyear = fields.Many2One('account.fiscalyear', 'Fiscal Year',
|
||||
required=True,
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
start_period = fields.Many2One('account.period', 'Start Period',
|
||||
domain=[
|
||||
('fiscalyear', '=', Eval('fiscalyear')),
|
||||
('fiscalyear', '=', Eval('fiscalyear', -1)),
|
||||
('start_date', '<=', (Eval('end_period'), 'start_date'))
|
||||
],
|
||||
states={
|
||||
@@ -2722,7 +2722,7 @@ class IncomeStatementContext(ModelView):
|
||||
})
|
||||
end_period = fields.Many2One('account.period', 'End Period',
|
||||
domain=[
|
||||
('fiscalyear', '=', Eval('fiscalyear')),
|
||||
('fiscalyear', '=', Eval('fiscalyear', -1)),
|
||||
('start_date', '>=', (Eval('start_period'), 'start_date')),
|
||||
],
|
||||
states={
|
||||
@@ -2757,11 +2757,11 @@ class IncomeStatementContext(ModelView):
|
||||
'invisible': ~Eval('comparison', False),
|
||||
},
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
start_period_cmp = fields.Many2One('account.period', 'Start Period',
|
||||
domain=[
|
||||
('fiscalyear', '=', Eval('fiscalyear_cmp')),
|
||||
('fiscalyear', '=', Eval('fiscalyear_cmp', -1)),
|
||||
('start_date', '<=', (Eval('end_period_cmp'), 'start_date'))
|
||||
],
|
||||
states={
|
||||
@@ -2771,7 +2771,7 @@ class IncomeStatementContext(ModelView):
|
||||
})
|
||||
end_period_cmp = fields.Many2One('account.period', 'End Period',
|
||||
domain=[
|
||||
('fiscalyear', '=', Eval('fiscalyear_cmp')),
|
||||
('fiscalyear', '=', Eval('fiscalyear_cmp', -1)),
|
||||
('start_date', '>=', (Eval('start_period_cmp'), 'start_date')),
|
||||
],
|
||||
states={
|
||||
@@ -3191,7 +3191,7 @@ class CreateChartProperties(ModelView):
|
||||
('closed', '!=', True),
|
||||
('type.receivable', '=', True),
|
||||
('party_required', '=', True),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
account_payable = fields.Many2One('account.account',
|
||||
'Default Payable Account',
|
||||
@@ -3199,7 +3199,7 @@ class CreateChartProperties(ModelView):
|
||||
('closed', '!=', True),
|
||||
('type.payable', '=', True),
|
||||
('party_required', '=', True),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
|
||||
|
||||
|
||||
@@ -685,7 +685,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="context_model">account.general_ledger.account.context</field>
|
||||
<field
|
||||
name="domain"
|
||||
eval="[If(Eval('active_ids', []) == [Eval('active_id')], ('account', '=', Eval('active_id')), ('account', 'in', Eval('active_ids')))]"
|
||||
eval="[('account', 'in', Eval('active_ids', []))]"
|
||||
pyson="1"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_general_ledger_account_party_form_view1">
|
||||
|
||||
@@ -34,7 +34,7 @@ class FiscalYear(Workflow, ModelSQL, ModelView):
|
||||
periods = fields.One2Many('account.period', 'fiscalyear', 'Periods',
|
||||
states=STATES,
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
],
|
||||
order=[('start_date', 'ASC'), ('id', 'ASC')])
|
||||
state = fields.Selection([
|
||||
@@ -47,7 +47,7 @@ class FiscalYear(Workflow, ModelSQL, ModelView):
|
||||
domain=[
|
||||
('sequence_type', '=',
|
||||
Id('account', 'sequence_type_account_move')),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
company = fields.Many2One(
|
||||
'company.company', "Company", required=True)
|
||||
@@ -426,7 +426,7 @@ class BalanceNonDeferralStart(ModelView):
|
||||
depends={'company'})
|
||||
period = fields.Many2One('account.period', 'Period', required=True,
|
||||
domain=[
|
||||
('fiscalyear', '=', Eval('fiscalyear')),
|
||||
('fiscalyear', '=', Eval('fiscalyear', -1)),
|
||||
('type', '=', 'adjustment'),
|
||||
])
|
||||
credit_account = fields.Many2One('account.account', 'Credit Account',
|
||||
@@ -603,7 +603,7 @@ class RenewFiscalYearStart(ModelView):
|
||||
previous_fiscalyear = fields.Many2One(
|
||||
'account.fiscalyear', "Previous Fiscalyear", required=True,
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
],
|
||||
help="Used as reference for fiscalyear configuration.")
|
||||
start_date = fields.Date("Start Date", required=True)
|
||||
|
||||
@@ -1898,14 +1898,14 @@ class WriteOff(DeactivableMixin, ModelSQL, ModelView):
|
||||
domain=[
|
||||
('type', '!=', None),
|
||||
('closed', '!=', True),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
debit_account = fields.Many2One('account.account', "Debit Account",
|
||||
required=True,
|
||||
domain=[
|
||||
('type', '!=', None),
|
||||
('closed', '!=', True),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
|
||||
@classmethod
|
||||
@@ -2064,7 +2064,7 @@ class ReconcileLinesWriteOff(ModelView):
|
||||
writeoff = fields.Many2One('account.move.reconcile.write_off', "Write Off",
|
||||
required=True,
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
date = fields.Date('Date', required=True)
|
||||
amount = Monetary(
|
||||
@@ -2491,8 +2491,8 @@ class ReconcileShow(ModelView):
|
||||
currency = fields.Many2One('currency.currency', "Currency", readonly=True)
|
||||
lines = fields.Many2Many('account.move.line', None, None, 'Lines',
|
||||
domain=[
|
||||
('account', '=', Eval('account')),
|
||||
('party', '=', Eval('party')),
|
||||
('account', '=', Eval('account', -1)),
|
||||
('party', '=', Eval('party', -1)),
|
||||
('reconciliation', '=', None),
|
||||
['OR',
|
||||
[
|
||||
|
||||
@@ -380,7 +380,7 @@ class TaxCodeLine(ModelSQL, ModelView):
|
||||
tax = fields.Many2One(
|
||||
'account.tax', "Tax", required=True, states=_states,
|
||||
domain=[
|
||||
('company', '=', Eval('_parent_code', {}).get('company')),
|
||||
('company', '=', Eval('_parent_code', {}).get('company', -1)),
|
||||
],
|
||||
depends={'code'})
|
||||
amount = fields.Selection([
|
||||
@@ -820,7 +820,7 @@ class Tax(sequence_ordered(), ModelSQL, ModelView, DeactivableMixin):
|
||||
credit_note_account = fields.Many2One('account.account',
|
||||
'Credit Note Account',
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
('type.statement', '=', 'balance'),
|
||||
('closed', '!=', True),
|
||||
],
|
||||
@@ -1575,7 +1575,7 @@ class TaxRuleLineTemplate(sequence_ordered(), ModelSQL, ModelView):
|
||||
domain=[
|
||||
('parent', '=', None),
|
||||
('account', '=', Eval('_parent_rule', {}).get('account', 0)),
|
||||
('group', '=', Eval('group')),
|
||||
('group', '=', Eval('group', -1)),
|
||||
['OR',
|
||||
('group', '=', None),
|
||||
If(Eval('_parent_rule', {}).get('kind', 'both') == 'sale',
|
||||
@@ -1596,7 +1596,7 @@ class TaxRuleLineTemplate(sequence_ordered(), ModelSQL, ModelView):
|
||||
domain=[
|
||||
('parent', '=', None),
|
||||
('account', '=', Eval('_parent_rule', {}).get('account', 0)),
|
||||
('group', '=', Eval('group')),
|
||||
('group', '=', Eval('group', -1)),
|
||||
['OR',
|
||||
('group', '=', None),
|
||||
If(Eval('_parent_rule', {}).get('kind', 'both') == 'sale',
|
||||
@@ -1696,7 +1696,7 @@ class TaxRuleLine(sequence_ordered(), ModelSQL, ModelView, MatchMixin):
|
||||
origin_tax = fields.Many2One('account.tax', 'Original Tax',
|
||||
domain=[
|
||||
('parent', '=', None),
|
||||
('company', '=', Eval('_parent_rule', {}).get('company')),
|
||||
('company', '=', Eval('_parent_rule', {}).get('company', -1)),
|
||||
('group', '=', Eval('group')),
|
||||
['OR',
|
||||
('group', '=', None),
|
||||
@@ -1717,7 +1717,7 @@ class TaxRuleLine(sequence_ordered(), ModelSQL, ModelView, MatchMixin):
|
||||
tax = fields.Many2One('account.tax', 'Substitution Tax',
|
||||
domain=[
|
||||
('parent', '=', None),
|
||||
('company', '=', Eval('_parent_rule', {}).get('company')),
|
||||
('company', '=', Eval('_parent_rule', {}).get('company', -1)),
|
||||
('group', '=', Eval('group')),
|
||||
['OR',
|
||||
('group', '=', None),
|
||||
|
||||
@@ -292,7 +292,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Taxes</field>
|
||||
<field name="res_model">account.tax</field>
|
||||
<field name="domain"
|
||||
eval="[('company', '=', Eval('company')), ('parent', '=', None)]"
|
||||
eval="[('company', '=', Eval('company', -1)), ('parent', '=', None)]"
|
||||
pyson="1"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_tax_list_view1">
|
||||
@@ -456,7 +456,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<record model="ir.action.act_window" id="act_tax_rule_form">
|
||||
<field name="name">Rules</field>
|
||||
<field name="res_model">account.tax.rule</field>
|
||||
<field name="domain" eval="[('company', '=', Eval('company'))]"
|
||||
<field name="domain" eval="[('company', '=', Eval('company', -1))]"
|
||||
pyson="1"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_tax_rule_form_view1">
|
||||
|
||||
@@ -125,7 +125,7 @@ class BEVATCustomerContext(ModelView):
|
||||
fiscalyear = fields.Many2One(
|
||||
'account.fiscalyear', "Fiscal Year", required=True,
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -93,7 +93,7 @@ class Invoice(metaclass=PoolMeta):
|
||||
consolidation_company = fields.Many2One(
|
||||
'company.company', "Consolidation Company",
|
||||
domain=[
|
||||
('party', '=', Eval('party')),
|
||||
('party', '=', Eval('party', -1)),
|
||||
],
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
|
||||
@@ -27,7 +27,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="res_model">account.move.line</field>
|
||||
<field
|
||||
name="domain"
|
||||
eval="[('account.type.deposit', '=', True), If(Eval('active_ids', []) == [Eval('active_id')], ('party', '=', Eval('active_id')), ('party', 'in', Eval('active_ids')))]"
|
||||
eval="[('account.type.deposit', '=', True), ('party', 'in', Eval('active_ids', []))]"
|
||||
pyson="1"/>
|
||||
<field name="search_value" eval="[('reconciliation', '=', None)]" pyson="1"/>
|
||||
<field name="order" eval="[('date', 'DESC')]" pyson="1"/>
|
||||
|
||||
@@ -720,16 +720,16 @@ class ESVATBookContext(ModelView):
|
||||
fiscalyear = fields.Many2One('account.fiscalyear', "Fiscal Year",
|
||||
required=True,
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
start_period = fields.Many2One('account.period', "Start Period",
|
||||
domain=[
|
||||
('fiscalyear', '=', Eval('fiscalyear')),
|
||||
('fiscalyear', '=', Eval('fiscalyear', -1)),
|
||||
('start_date', '<=', (Eval('end_period'), 'start_date')),
|
||||
])
|
||||
end_period = fields.Many2One('account.period', "End Period",
|
||||
domain=[
|
||||
('fiscalyear', '=', Eval('fiscalyear')),
|
||||
('fiscalyear', '=', Eval('fiscalyear', -1)),
|
||||
('start_date', '>=', (Eval('start_period'), 'start_date'))
|
||||
])
|
||||
es_vat_book_type = fields.Selection([
|
||||
|
||||
@@ -116,12 +116,12 @@ class ECSalesListContext(ModelView):
|
||||
fiscalyear = fields.Many2One(
|
||||
'account.fiscalyear', "Fiscal Year", required=True,
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
period = fields.Many2One(
|
||||
'account.period', "Period",
|
||||
domain=[
|
||||
('fiscalyear', '=', Eval('fiscalyear')),
|
||||
('fiscalyear', '=', Eval('fiscalyear', -1)),
|
||||
])
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -318,7 +318,7 @@ class FrFECStart(ModelView):
|
||||
deferral_period = fields.Many2One(
|
||||
'account.period', "Deferral Period", required=True,
|
||||
domain=[
|
||||
('fiscalyear', '=', Eval('fiscalyear')),
|
||||
('fiscalyear', '=', Eval('fiscalyear', -1)),
|
||||
('type', '=', 'adjustment'),
|
||||
],
|
||||
help="The period to exclude which contains "
|
||||
|
||||
@@ -91,7 +91,7 @@ class InvoiceSequence(sequence_ordered(), ModelSQL, ModelView, MatchMixin):
|
||||
])
|
||||
period = fields.Many2One('account.period', 'Period',
|
||||
domain=[
|
||||
('fiscalyear', '=', Eval('fiscalyear')),
|
||||
('fiscalyear', '=', Eval('fiscalyear', -1)),
|
||||
('type', '=', 'standard'),
|
||||
])
|
||||
in_invoice_sequence = fields.Many2One('ir.sequence.strict',
|
||||
@@ -99,28 +99,28 @@ class InvoiceSequence(sequence_ordered(), ModelSQL, ModelView, MatchMixin):
|
||||
domain=[
|
||||
('sequence_type', '=',
|
||||
Id('account_invoice', 'sequence_type_account_invoice')),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
in_credit_note_sequence = fields.Many2One('ir.sequence.strict',
|
||||
'Supplier Credit Note Sequence', required=True,
|
||||
domain=[
|
||||
('sequence_type', '=',
|
||||
Id('account_invoice', 'sequence_type_account_invoice')),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
out_invoice_sequence = fields.Many2One('ir.sequence.strict',
|
||||
'Customer Invoice Sequence', required=True,
|
||||
domain=[
|
||||
('sequence_type', '=',
|
||||
Id('account_invoice', 'sequence_type_account_invoice')),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
out_credit_note_sequence = fields.Many2One('ir.sequence.strict',
|
||||
'Customer Credit Note Sequence', required=True,
|
||||
domain=[
|
||||
('sequence_type', '=',
|
||||
Id('account_invoice', 'sequence_type_account_invoice')),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
|
||||
@classmethod
|
||||
@@ -149,7 +149,7 @@ class MoveLine(metaclass=PoolMeta):
|
||||
domain=[
|
||||
('account', '=', Eval('account', -1)),
|
||||
If(Bool(Eval('party')),
|
||||
('party', '=', Eval('party')),
|
||||
('party', '=', Eval('party', -1)),
|
||||
(),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -163,7 +163,8 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin, InvoiceReportMixin):
|
||||
party_lang = fields.Function(fields.Char('Party Language'),
|
||||
'on_change_with_party_lang')
|
||||
invoice_address = fields.Many2One('party.address', 'Invoice Address',
|
||||
required=True, states=_states, domain=[('party', '=', Eval('party'))])
|
||||
required=True, states=_states,
|
||||
domain=[('party', '=', Eval('party', -1))])
|
||||
currency = fields.Many2One('currency.currency', 'Currency', required=True,
|
||||
states={
|
||||
'readonly': (
|
||||
@@ -2142,7 +2143,7 @@ class InvoicePaymentLine(ModelSQL):
|
||||
line = fields.Many2One(
|
||||
'account.move.line', "Payment Line", ondelete='CASCADE', required=True,
|
||||
domain=[
|
||||
('account', '=', Eval('invoice_account')),
|
||||
('account', '=', Eval('invoice_account', -1)),
|
||||
['OR',
|
||||
('party', '=', Eval('invoice_party', -1)),
|
||||
('party', 'in', Eval('invoice_alternative_payees', [])),
|
||||
@@ -3261,14 +3262,14 @@ class PaymentMethod(DeactivableMixin, ModelSQL, ModelView):
|
||||
domain=[
|
||||
('type', '!=', None),
|
||||
('closed', '!=', True),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
debit_account = fields.Many2One('account.account', "Debit Account",
|
||||
required=True,
|
||||
domain=[
|
||||
('type', '!=', None),
|
||||
('closed', '!=', True),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
|
||||
@classmethod
|
||||
@@ -3427,9 +3428,9 @@ class PayInvoiceStart(ModelView):
|
||||
payment_method = fields.Many2One(
|
||||
'account.invoice.payment.method', "Payment Method", required=True,
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('debit_account', '!=', Eval('invoice_account')),
|
||||
('credit_account', '!=', Eval('invoice_account')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
('debit_account', '!=', Eval('invoice_account', -1)),
|
||||
('credit_account', '!=', Eval('invoice_account', -1)),
|
||||
],
|
||||
depends={'amount'})
|
||||
date = fields.Date('Date', required=True)
|
||||
@@ -3456,7 +3457,7 @@ class PayInvoiceAsk(ModelView):
|
||||
writeoff = fields.Many2One(
|
||||
'account.move.reconcile.write_off', "Write Off",
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
],
|
||||
states={
|
||||
'invisible': Eval('type') != 'writeoff',
|
||||
|
||||
@@ -801,7 +801,7 @@ class StatementLine(metaclass=PoolMeta):
|
||||
cls.related_to.domain['account.payment'] = [
|
||||
('company', '=', Eval('company', -1)),
|
||||
If(Bool(Eval('party')),
|
||||
('party', '=', Eval('party')),
|
||||
('party', '=', Eval('party', -1)),
|
||||
()),
|
||||
('state', 'in', ['processing', 'succeeded', 'failed']),
|
||||
If(Eval('second_currency'),
|
||||
|
||||
@@ -350,7 +350,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Payments</field>
|
||||
<field name="res_model">account.payment</field>
|
||||
<field name="domain"
|
||||
eval="[If(Eval('active_ids', []) == [Eval('active_id')], ('party', '=', Eval('active_id')), ('party', 'in', Eval('active_ids')))]"
|
||||
eval="[('party', 'in', Eval('active_ids', []))]"
|
||||
pyson="1"/>
|
||||
<field name="search_value" eval="[('state', 'not in', ['succeeded', 'failed'])]" pyson="1"/>
|
||||
</record>
|
||||
@@ -390,7 +390,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Payments</field>
|
||||
<field name="res_model">account.payment</field>
|
||||
<field name="domain"
|
||||
eval="[If(Eval('active_ids', []) == [Eval('active_id')], ('line', '=', Eval('active_id')), ('line', 'in', Eval('active_ids')))]"
|
||||
eval="[('line', 'in', Eval('active_ids', []))]"
|
||||
pyson="1"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
|
||||
@@ -13,7 +13,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Mandates</field>
|
||||
<field name="res_model">account.payment.sepa.mandate</field>
|
||||
<field name="domain"
|
||||
eval="[If(Eval('active_ids', []) == [Eval('active_id')], ('party', '=', Eval('active_id')), ('party', 'in', Eval('active_ids')))]"
|
||||
eval="[('party', 'in', Eval('active_ids', []))]"
|
||||
pyson="1"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_mandate_form2_view1">
|
||||
|
||||
@@ -14,14 +14,14 @@ class CreateChartProperties(metaclass=PoolMeta):
|
||||
domain=[
|
||||
('closed', '!=', True),
|
||||
('type.expense', '=', True),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
category_account_revenue = fields.Many2One(
|
||||
'account.account', 'Default Revenue Account',
|
||||
domain=[
|
||||
('closed', '!=', True),
|
||||
('type.revenue', '=', True),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class Journal(DeactivableMixin, ModelSQL, ModelView):
|
||||
domain=[
|
||||
('type', '!=', None),
|
||||
('closed', '!=', True),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
('party_required', '=', False),
|
||||
])
|
||||
|
||||
|
||||
@@ -764,7 +764,7 @@ class Line(origin_mixin(_states), sequence_ordered(), ModelSQL, ModelView):
|
||||
],
|
||||
[]),
|
||||
If(Bool(Eval('account')),
|
||||
('account', '=', Eval('account')),
|
||||
('account', '=', Eval('account', -1)),
|
||||
()),
|
||||
If(Eval('statement_state') == 'draft',
|
||||
('state', '=', 'posted'),
|
||||
|
||||
@@ -72,7 +72,7 @@ class StatementRule(sequence_ordered(), ModelSQL, ModelView):
|
||||
'account.statement.journal', "Journal",
|
||||
domain=[
|
||||
If(Eval('company'),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
()),
|
||||
])
|
||||
amount_low = Monetary(
|
||||
@@ -292,7 +292,7 @@ class StatementRuleLine(sequence_ordered(), ModelSQL, ModelView):
|
||||
account = fields.Many2One(
|
||||
'account.account', "Account",
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
('type', '!=', None),
|
||||
],
|
||||
states={
|
||||
|
||||
@@ -81,7 +81,7 @@ class LandedCost(Workflow, ModelSQL, ModelView, MatchMixin):
|
||||
'readonly': Eval('state') != 'draft',
|
||||
},
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
('state', 'in', ['received', 'done']),
|
||||
])
|
||||
invoice_lines = fields.One2Many('account.invoice.line', 'landed_cost',
|
||||
|
||||
@@ -38,7 +38,7 @@ class Line(ModelSQL, ModelView):
|
||||
'active_test': False,
|
||||
},
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
['OR',
|
||||
('start_date', '=', None),
|
||||
('start_date', '<=', Eval('date', None)),
|
||||
|
||||
@@ -13,7 +13,7 @@ class Agent(metaclass=PoolMeta):
|
||||
domain=[
|
||||
('type', '!=', None),
|
||||
('closed', '!=', True),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
],
|
||||
help="The account the agent's waiting commission amounts are posted "
|
||||
"to.")
|
||||
|
||||
@@ -62,7 +62,7 @@ class Address(
|
||||
identifiers = fields.One2Many(
|
||||
'party.identifier', 'address', "Identifiers",
|
||||
domain=[
|
||||
('party', '=', Eval('party')),
|
||||
('party', '=', Eval('party', -1)),
|
||||
('type', 'in', ['fr_siret']),
|
||||
])
|
||||
contact_mechanisms = fields.One2Many(
|
||||
|
||||
@@ -20,7 +20,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Price Lists</field>
|
||||
<field name="res_model">product.price_list</field>
|
||||
<field name="domain"
|
||||
eval="[('company', '=', Eval('company'))]" pyson="1"/>
|
||||
eval="[('company', '=', Eval('company', -1))]" pyson="1"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_price_list_form_view1">
|
||||
<field name="sequence" eval="10"/>
|
||||
|
||||
@@ -47,13 +47,13 @@ class Move(metaclass=PoolMeta):
|
||||
__name__ = 'stock.move'
|
||||
production_input = fields.Many2One(
|
||||
'production', "Production Input", readonly=True, ondelete='CASCADE',
|
||||
domain=[('company', '=', Eval('company'))],
|
||||
domain=[('company', '=', Eval('company', -1))],
|
||||
states={
|
||||
'invisible': ~Eval('production_input'),
|
||||
})
|
||||
production_output = fields.Many2One(
|
||||
'production', "Production Output", readonly=True, ondelete='CASCADE',
|
||||
domain=[('company', '=', Eval('company'))],
|
||||
domain=[('company', '=', Eval('company', -1))],
|
||||
states={
|
||||
'invisible': ~Eval('production_output'),
|
||||
})
|
||||
|
||||
@@ -136,7 +136,7 @@ class Work(sequence_ordered(), tree(separator='\\'), ModelSQL, ModelView):
|
||||
},
|
||||
depends={'company'})
|
||||
party_address = fields.Many2One('party.address', 'Contact Address',
|
||||
domain=[('party', '=', Eval('party'))],
|
||||
domain=[('party', '=', Eval('party', -1))],
|
||||
states={
|
||||
'invisible': Eval('type') != 'project',
|
||||
})
|
||||
|
||||
@@ -452,9 +452,9 @@ class ProductSupplier(
|
||||
if operator.endswith('like') and is_full_text(operand):
|
||||
code_value = lstrip_wildcard(operand)
|
||||
domain = [bool_op,
|
||||
('template', operator, operand, *extra),
|
||||
('product', operator, operand, *extra),
|
||||
('party', operator, operand, *extra),
|
||||
('template.rec_name', operator, operand, *extra),
|
||||
('product.rec_name', operator, operand, *extra),
|
||||
('party.rec_name', operator, operand, *extra),
|
||||
('code', operator, code_value, *extra),
|
||||
('name', operator, operand, *extra),
|
||||
]
|
||||
|
||||
@@ -475,8 +475,8 @@ class BlanketAgreementLine(ModelSQL, ModelView):
|
||||
('product', '=', Eval('product')),
|
||||
],
|
||||
[]),
|
||||
('party', '=', Eval('_parent_blanket_agreement', {}).get(
|
||||
'supplier')),
|
||||
('party', '=',
|
||||
Eval('_parent_blanket_agreement', {}).get('supplier', -1)),
|
||||
],
|
||||
states=_states)
|
||||
product_uom_category = fields.Function(
|
||||
|
||||
@@ -117,7 +117,7 @@ class Quotation(Workflow, ModelSQL, ModelView):
|
||||
depends={'company'})
|
||||
supplier_address = fields.Many2One('party.address', 'Supplier Address',
|
||||
domain=[
|
||||
('party', '=', Eval('supplier')),
|
||||
('party', '=', Eval('supplier', -1)),
|
||||
])
|
||||
lines = fields.One2Many('purchase.request.quotation.line', 'quotation',
|
||||
'Lines', states={
|
||||
|
||||
@@ -161,7 +161,7 @@ class Sale(
|
||||
shipment_address = fields.Many2One('party.address', 'Shipment Address',
|
||||
domain=['OR',
|
||||
('party', '=', If(Bool(Eval('shipment_party')),
|
||||
Eval('shipment_party'), Eval('party'))),
|
||||
Eval('shipment_party', -1), Eval('party', -1))),
|
||||
('warehouses', 'where', [
|
||||
('id', '=', Eval('warehouse', -1)),
|
||||
If(Eval('state').in_(['draft', 'quotation']),
|
||||
|
||||
@@ -164,7 +164,7 @@ class AdvancePaymentCondition(ModelSQL, ModelView):
|
||||
'account.account', "Account", required=True,
|
||||
domain=[
|
||||
('type.unearned_revenue', '=', True),
|
||||
('company', '=', Eval('sale_company')),
|
||||
('company', '=', Eval('sale_company', -1)),
|
||||
],
|
||||
states=_states)
|
||||
block_supply = fields.Boolean("Block Supply", states=_states)
|
||||
|
||||
@@ -255,9 +255,10 @@ class AmendmentLine(ModelSQL, ModelView):
|
||||
shipment_address = fields.Many2One(
|
||||
'party.address', "Shipment Address",
|
||||
domain=['OR',
|
||||
('party', '=', If(Eval('shipment_party'),
|
||||
Eval('shipment_party'), Eval('party'))),
|
||||
('warehouses', '=', Eval('warehouse')),
|
||||
('party', '=',
|
||||
If(Eval('shipment_party'),
|
||||
Eval('shipment_party', -1), Eval('party', -1))),
|
||||
('warehouses', '=', Eval('warehouse', -1)),
|
||||
],
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
|
||||
@@ -62,9 +62,9 @@ class Complaint(Workflow, ModelSQL, ModelView):
|
||||
domain={
|
||||
'sale.sale': [
|
||||
If(Eval('customer'),
|
||||
('party', '=', Eval('customer')),
|
||||
('party', '=', Eval('customer', -1)),
|
||||
()),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
('state', 'in', ['confirmed', 'processing', 'done']),
|
||||
],
|
||||
'sale.line': [
|
||||
@@ -77,9 +77,9 @@ class Complaint(Workflow, ModelSQL, ModelView):
|
||||
],
|
||||
'account.invoice': [
|
||||
If(Eval('customer'),
|
||||
('party', '=', Eval('customer')),
|
||||
('party', '=', Eval('customer', -1)),
|
||||
()),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
('type', '=', 'out'),
|
||||
('state', 'in', ['posted', 'paid']),
|
||||
],
|
||||
|
||||
@@ -59,7 +59,7 @@ class SaleOpportunity(
|
||||
depends=['party', 'company'])
|
||||
address = fields.Many2One(
|
||||
'party.address', "Address", states=_states_stop,
|
||||
domain=[('party', '=', Eval('party'))],
|
||||
domain=[('party', '=', Eval('party', -1))],
|
||||
help="The default address for the invoice and shipment.\n"
|
||||
"Leave empty to use the default values.")
|
||||
company = fields.Many2One(
|
||||
@@ -88,7 +88,7 @@ class SaleOpportunity(
|
||||
'readonly': _states_stop['readonly'],
|
||||
'required': ~Eval('state').in_(['lead', 'lost', 'cancelled']),
|
||||
},
|
||||
domain=[('company', '=', Eval('company'))])
|
||||
domain=[('company', '=', Eval('company', -1))])
|
||||
start_date = fields.Date("Start Date", required=True, states=_states_start)
|
||||
end_date = fields.Date("End Date", states=_states_stop)
|
||||
description = fields.Char('Description', states=_states_stop)
|
||||
|
||||
@@ -13,7 +13,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Sales Leads/Opportunities</field>
|
||||
<field name="res_model">sale.opportunity</field>
|
||||
<field name="domain"
|
||||
eval="[If(Eval('active_ids', []) == [Eval('active_id')], ('party', '=', Eval('active_id')), ('party', 'in', Eval('active_ids')))]"
|
||||
eval="[('party', 'in', Eval('active_ids', []))]"
|
||||
pyson="1"/>
|
||||
<field name="search_value" eval="[('state', 'not in', ['won', 'cancelled', 'lost'])]" pyson="1"/>
|
||||
</record>
|
||||
|
||||
@@ -989,7 +989,7 @@ class POSPayment(ModelSQL, ModelView):
|
||||
method = fields.Many2One(
|
||||
'sale.point.payment.method', "Method", required=True,
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
If(Eval('amount', 0) < 0,
|
||||
('cash', '=', True),
|
||||
()),
|
||||
@@ -1118,7 +1118,7 @@ class POSPaymentMethod(DeactivableMixin, ModelSQL, ModelView):
|
||||
domain=[
|
||||
('type', '!=', None),
|
||||
('closed', '!=', True),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
])
|
||||
cash = fields.Boolean("Cash")
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class Sale(metaclass=PoolMeta):
|
||||
__name__ = 'sale.sale'
|
||||
price_list = fields.Many2One('product.price_list', 'Price List',
|
||||
help="Use to compute the unit price of lines.",
|
||||
domain=[('company', '=', Eval('company'))],
|
||||
domain=[('company', '=', Eval('company', -1))],
|
||||
states={
|
||||
'readonly': Or(Not(Equal(Eval('state'), 'draft')),
|
||||
Bool(Eval('lines', [0]))),
|
||||
|
||||
@@ -179,7 +179,7 @@ class BlanketAgreementLine(metaclass=PoolMeta):
|
||||
],
|
||||
[]),
|
||||
('party', '=', Eval('_parent_blanket_agreement', {}).get(
|
||||
'customer')),
|
||||
'customer', -1)),
|
||||
],
|
||||
states={
|
||||
'readonly': Eval('agreement_state') != 'draft'
|
||||
|
||||
@@ -77,7 +77,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Subscriptions</field>
|
||||
<field name="res_model">sale.subscription</field>
|
||||
<field name="domain"
|
||||
eval="[If(Eval('active_ids', []) == [Eval('active_id')], ('party', '=', Eval('active_id')), ('party', 'in', Eval('active_ids', [])))]"
|
||||
eval="[('party', 'in', Eval('active_ids', []))]"
|
||||
pyson="1"/>
|
||||
<field name="search_value" eval="[('state', 'not in', ['closed', 'cancelled'])]" pyson="1"/>
|
||||
</record>
|
||||
|
||||
@@ -26,7 +26,7 @@ class Request(metaclass=PoolMeta):
|
||||
},
|
||||
depends={'company'})
|
||||
delivery_address = fields.Many2One('party.address', 'Delivery Address',
|
||||
domain=[('party', '=', Eval('customer'))],
|
||||
domain=[('party', '=', Eval('customer', -1))],
|
||||
states={
|
||||
'invisible': ~Eval('customer'),
|
||||
'readonly': Eval('state') != 'draft',
|
||||
@@ -72,7 +72,7 @@ class Purchase(metaclass=PoolMeta):
|
||||
},
|
||||
depends={'company'})
|
||||
delivery_address = fields.Many2One('party.address', 'Delivery Address',
|
||||
domain=[('party', '=', Eval('customer'))],
|
||||
domain=[('party', '=', Eval('customer', -1))],
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
'invisible': ~Eval('customer'),
|
||||
|
||||
@@ -89,7 +89,7 @@ class ShipmentDrop(
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
},
|
||||
domain=[('party', '=', Eval('supplier'))])
|
||||
domain=[('party', '=', Eval('supplier', -1))])
|
||||
customer = fields.Many2One('party.party', 'Customer', required=True,
|
||||
states={
|
||||
'readonly': (((Eval('state') != 'draft')
|
||||
@@ -105,10 +105,10 @@ class ShipmentDrop(
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
},
|
||||
domain=[('party', '=', Eval('customer'))])
|
||||
domain=[('party', '=', Eval('customer', -1))])
|
||||
moves = fields.One2Many('stock.move', 'shipment', 'Moves',
|
||||
domain=[
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
['OR',
|
||||
[
|
||||
('from_location.type', '=', 'supplier'),
|
||||
|
||||
@@ -191,7 +191,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Drop Shipments</field>
|
||||
<field name="res_model">stock.shipment.drop</field>
|
||||
<field name="domain"
|
||||
eval="['OR', ('customer', 'in', Eval('active_ids')), ('supplier', 'in', Eval('active_ids'))]"
|
||||
eval="['OR', ('customer', 'in', Eval('active_ids', [])), ('supplier', 'in', Eval('active_ids', []))]"
|
||||
pyson="1"/>
|
||||
<field name="search_value" eval="[('state', 'not in', ['done', 'cancelled'])]" pyson="1"/>
|
||||
</record>
|
||||
|
||||
+17
-15
@@ -337,7 +337,8 @@ class ShipmentIn(
|
||||
contact_address = fields.Many2One('party.address', 'Contact Address',
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
}, domain=[('party', '=', Eval('supplier'))],
|
||||
},
|
||||
domain=[('party', '=', Eval('supplier', -1))],
|
||||
help="The address at which the supplier can be contacted.")
|
||||
warehouse = fields.Many2One('stock.location', "Warehouse",
|
||||
required=True, domain=[('type', '=', 'warehouse')],
|
||||
@@ -397,7 +398,7 @@ class ShipmentIn(
|
||||
('to_location', 'child_of',
|
||||
[Eval('warehouse_input', -1)], 'parent'),
|
||||
('to_location', '=', Eval('warehouse_input'))),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
],
|
||||
states={
|
||||
'readonly': (
|
||||
@@ -418,7 +419,7 @@ class ShipmentIn(
|
||||
Eval('warehouse')),
|
||||
],
|
||||
[],),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
],
|
||||
order=[
|
||||
('to_location', 'ASC'),
|
||||
@@ -434,7 +435,7 @@ class ShipmentIn(
|
||||
'get_inventory_moves', setter='set_inventory_moves')
|
||||
moves = fields.One2Many(
|
||||
'stock.move', 'shipment', "Moves",
|
||||
domain=[('company', '=', Eval('company'))],
|
||||
domain=[('company', '=', Eval('company', -1))],
|
||||
states={
|
||||
'readonly': True,
|
||||
})
|
||||
@@ -796,7 +797,7 @@ class ShipmentInReturn(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
'readonly': Eval('state') != 'draft',
|
||||
},
|
||||
domain=['OR',
|
||||
('party', '=', Eval('supplier')),
|
||||
('party', '=', Eval('supplier', -1)),
|
||||
('warehouses', 'where', [
|
||||
('id', '=', Eval('warehouse', -1)),
|
||||
If(Eval('state') == 'draft',
|
||||
@@ -835,7 +836,7 @@ class ShipmentInReturn(ShipmentAssignMixin, Workflow, ModelSQL, ModelView):
|
||||
[Eval('to_location', -1)], 'parent'),
|
||||
],
|
||||
[])),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
],
|
||||
order=[
|
||||
('from_location', 'ASC'),
|
||||
@@ -1160,7 +1161,7 @@ class ShipmentOut(
|
||||
'readonly': Eval('state') != 'draft',
|
||||
},
|
||||
domain=['OR',
|
||||
('party', '=', Eval('customer')),
|
||||
('party', '=', Eval('customer', -1)),
|
||||
('warehouses', 'where', [
|
||||
('id', '=', Eval('warehouse', -1)),
|
||||
If(Eval('state') == 'draft',
|
||||
@@ -1210,7 +1211,7 @@ class ShipmentOut(
|
||||
If(~Eval('state').in_(['done', 'cancelled']),
|
||||
('to_location', '=', Eval('customer_location')),
|
||||
()),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
],
|
||||
order=[
|
||||
('product', 'ASC'),
|
||||
@@ -1235,7 +1236,7 @@ class ShipmentOut(
|
||||
[Eval('warehouse_storage', -1)], 'parent'),
|
||||
()),
|
||||
('to_location', '=', Eval('warehouse_output')),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
],
|
||||
order=[
|
||||
('from_location', 'ASC'),
|
||||
@@ -1253,7 +1254,7 @@ class ShipmentOut(
|
||||
'get_inventory_moves', setter='set_inventory_moves')
|
||||
moves = fields.One2Many(
|
||||
'stock.move', 'shipment', "Moves",
|
||||
domain=[('company', '=', Eval('company'))],
|
||||
domain=[('company', '=', Eval('company', -1))],
|
||||
states={
|
||||
'readonly': True,
|
||||
})
|
||||
@@ -1882,7 +1883,8 @@ class ShipmentOutReturn(
|
||||
'party.address', "Contact Address",
|
||||
states={
|
||||
'readonly': Eval('state') != 'draft',
|
||||
}, domain=[('party', '=', Eval('customer'))],
|
||||
},
|
||||
domain=[('party', '=', Eval('customer', -1))],
|
||||
help="The address the customer can be contacted at.")
|
||||
warehouse = fields.Many2One('stock.location', "Warehouse", required=True,
|
||||
states={
|
||||
@@ -1925,7 +1927,7 @@ class ShipmentOutReturn(
|
||||
('to_location', 'child_of',
|
||||
[Eval('warehouse_input', -1)], 'parent'),
|
||||
('to_location', '=', Eval('warehouse_input'))),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
],
|
||||
order=[
|
||||
('product', 'ASC'),
|
||||
@@ -1949,7 +1951,7 @@ class ShipmentOutReturn(
|
||||
Eval('warehouse')),
|
||||
],
|
||||
[]),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
],
|
||||
order=[
|
||||
('to_location', 'ASC'),
|
||||
@@ -1965,7 +1967,7 @@ class ShipmentOutReturn(
|
||||
'get_inventory_moves', setter='set_inventory_moves')
|
||||
moves = fields.One2Many(
|
||||
'stock.move', 'shipment', "Moves",
|
||||
domain=[('company', '=', Eval('company'))],
|
||||
domain=[('company', '=', Eval('company', -1))],
|
||||
states={
|
||||
'readonly': True,
|
||||
})
|
||||
@@ -2385,7 +2387,7 @@ class ShipmentInternal(
|
||||
],
|
||||
]),
|
||||
[])),
|
||||
('company', '=', Eval('company')),
|
||||
('company', '=', Eval('company', -1)),
|
||||
],
|
||||
order=[
|
||||
('from_location', 'ASC'),
|
||||
|
||||
@@ -41,7 +41,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="res_model">web.user</field>
|
||||
<field
|
||||
name="domain"
|
||||
eval="['OR', ('party', 'in', Eval('active_ids')), ('secondary_parties', 'in', Eval('active_ids'))]"
|
||||
eval="['OR', ('party', 'in', Eval('active_ids', [])), ('secondary_parties', 'in', Eval('active_ids', []))]"
|
||||
pyson="1"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_user_form_party_view1">
|
||||
|
||||
+4
-4
@@ -1873,13 +1873,13 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (['many2one', 'one2many', 'many2many', 'one2one',
|
||||
'many2many', 'one2one'].includes(field.type)) {
|
||||
field_name += '.rec_name';
|
||||
}
|
||||
if (value instanceof Array) {
|
||||
value = value.map(
|
||||
v => this.convert_value(field, v, this.context));
|
||||
if (~['many2one', 'one2many', 'many2many', 'one2one',
|
||||
'many2many', 'one2one'].indexOf(field.type)) {
|
||||
field_name += '.rec_name';
|
||||
}
|
||||
} else {
|
||||
value = this.convert_value(field, value, this.context);
|
||||
}
|
||||
|
||||
+21
-2
@@ -1961,14 +1961,26 @@
|
||||
},
|
||||
'relation': {
|
||||
'string': "Relation",
|
||||
'relation': 'relation',
|
||||
'name': 'relation',
|
||||
'type': 'many2one',
|
||||
'relation_fields': {
|
||||
'name': {
|
||||
'string': "Name",
|
||||
'name': 'name',
|
||||
'type': 'char',
|
||||
},
|
||||
'm2o': {
|
||||
'string': "M2O",
|
||||
'name': 'm2o',
|
||||
'type': 'many2one',
|
||||
'relation_fields': {
|
||||
'foo': {
|
||||
'string': "Foo",
|
||||
'name': 'foo',
|
||||
'type': 'integer',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -2029,12 +2041,19 @@
|
||||
['OR', c(['name', 'ilike', '%John%']),
|
||||
c(['name', 'ilike', '%Jane%'])
|
||||
]],
|
||||
[[c(['Many2One', null, 'John'])], [['many2one', 'ilike', '%John%']]],
|
||||
[[c(['Many2One', null, 'John'])],
|
||||
[['many2one.rec_name', 'ilike', '%John%']]],
|
||||
[[c(['Many2One', null, ['John', 'Jane']])],
|
||||
[['many2one.rec_name', 'in', ['John', 'Jane']]]],
|
||||
[[[c(['John'])]], [[['rec_name', 'ilike', '%John%']]]],
|
||||
[[c(['Relation', null, 'John'])],
|
||||
[['relation.rec_name', 'ilike', '%John%']]],
|
||||
[[c(['Relation.Name', null, "Test"])],
|
||||
[['relation.name', 'ilike', "%Test%"]]],
|
||||
[[c(['Relation.M2O', null, "Foo"])],
|
||||
[['relation.m2o.rec_name', 'ilike', "%Foo%"]]],
|
||||
[[c(['Relation.M2O.Foo', null, "42"])],
|
||||
[['relation.m2o.foo', '=', 42]]],
|
||||
[[c(['OR'])], [['rec_name', 'ilike', "%OR%"]]],
|
||||
[[c(['AND'])], [['rec_name', 'ilike', "%AND%"]]],
|
||||
].forEach(function(test) {
|
||||
|
||||
@@ -867,12 +867,13 @@ class DomainParser(object):
|
||||
(field_name, '<=', rvalue),
|
||||
])
|
||||
continue
|
||||
if field['type'] in {
|
||||
'many2one', 'one2many', 'many2many', 'one2one',
|
||||
}:
|
||||
field_name += '.rec_name'
|
||||
if isinstance(value, list):
|
||||
value = [convert_value(field, v, self.context)
|
||||
for v in value]
|
||||
if field['type'] in ('many2one', 'one2many',
|
||||
'many2many', 'one2one'):
|
||||
field_name += '.rec_name'
|
||||
else:
|
||||
value = convert_value(field, value, self.context)
|
||||
if 'like' in operator:
|
||||
|
||||
@@ -956,14 +956,26 @@ class DomainParserTestCase(TestCase):
|
||||
},
|
||||
'relation': {
|
||||
'string': "Relation",
|
||||
'relation': 'relation',
|
||||
'name': 'relation',
|
||||
'type': 'many2one',
|
||||
'relation_fields': {
|
||||
'name': {
|
||||
'string': "Name",
|
||||
'name': 'name',
|
||||
'type': 'char',
|
||||
},
|
||||
'm2o': {
|
||||
'string': "M2O",
|
||||
'name': 'm2o',
|
||||
'type': 'many2one',
|
||||
'relation_fields': {
|
||||
'foo': {
|
||||
'string': "Foo",
|
||||
'name': 'foo',
|
||||
'type': 'integer',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -1088,7 +1100,7 @@ class DomainParserTestCase(TestCase):
|
||||
])
|
||||
self.assertEqual(
|
||||
rlist(dom.parse_clause([('Many2One', None, 'John')])), [
|
||||
('many2one', 'ilike', '%John%'),
|
||||
('many2one.rec_name', 'ilike', '%John%'),
|
||||
])
|
||||
self.assertEqual(
|
||||
rlist(dom.parse_clause([('Many2One', None, ['John', 'Jane'])])), [
|
||||
@@ -1097,9 +1109,18 @@ class DomainParserTestCase(TestCase):
|
||||
self.assertEqual(
|
||||
rlist(dom.parse_clause(iter([iter([['John']])]))), [
|
||||
[('rec_name', 'ilike', '%John%')]])
|
||||
self.assertEqual(
|
||||
rlist(dom.parse_clause(iter([['Relation', None, "Test"]]))),
|
||||
[('relation.rec_name', 'ilike', "%Test%")])
|
||||
self.assertEqual(
|
||||
rlist(dom.parse_clause(iter([['Relation.Name', None, "Test"]]))),
|
||||
[('relation.name', 'ilike', "%Test%")])
|
||||
self.assertEqual(
|
||||
rlist(dom.parse_clause(iter([['Relation.M2O', None, "Foo"]]))),
|
||||
[('relation.m2o.rec_name', 'ilike', "%Foo%")])
|
||||
self.assertEqual(
|
||||
rlist(dom.parse_clause(iter([['Relation.M2O.Foo', None, '42']]))),
|
||||
[('relation.m2o.foo', '=', 42)])
|
||||
self.assertEqual(
|
||||
rlist(dom.parse_clause(iter([['OR']]))),
|
||||
[('rec_name', 'ilike', "%OR%")])
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
import warnings
|
||||
from collections import defaultdict
|
||||
from itertools import chain
|
||||
|
||||
@@ -455,6 +456,10 @@ class Many2Many(Field):
|
||||
return expression
|
||||
else:
|
||||
if isinstance(value, str):
|
||||
if not operator.endswith('where'):
|
||||
warnings.warn(
|
||||
f"Missing target field "
|
||||
f"in operand of domain {domain}")
|
||||
target_name = 'rec_name'
|
||||
else:
|
||||
target_name = 'id'
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
import warnings
|
||||
|
||||
from sql import As, Column, Expression, Literal, Query, With
|
||||
from sql.aggregate import Max
|
||||
from sql.conditionals import Coalesce
|
||||
@@ -260,6 +262,8 @@ class Many2One(Field):
|
||||
return super(Many2One, self).convert_domain(domain, tables,
|
||||
Model)
|
||||
else:
|
||||
warnings.warn(
|
||||
f"Missing target field in operand of domain {domain}")
|
||||
target_name = 'rec_name'
|
||||
else:
|
||||
_, target_name = name.split('.', 1)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
import warnings
|
||||
from collections import defaultdict
|
||||
from itertools import chain
|
||||
|
||||
@@ -386,6 +387,10 @@ class One2Many(Field):
|
||||
return expression
|
||||
else:
|
||||
if isinstance(value, str):
|
||||
if not operator.endswith('where'):
|
||||
warnings.warn(
|
||||
f"Missing target field "
|
||||
f"in operand of domain {domain}")
|
||||
target_name = 'rec_name'
|
||||
else:
|
||||
target_name = 'id'
|
||||
|
||||
@@ -34,7 +34,7 @@ class CommonTestCaseMixin:
|
||||
}])
|
||||
|
||||
many2manys = Many2Many.search([
|
||||
('targets', '=', "Target"),
|
||||
('targets.rec_name', '=', "Target"),
|
||||
])
|
||||
|
||||
self.assertListEqual(many2manys, [many2many])
|
||||
@@ -49,7 +49,7 @@ class CommonTestCaseMixin:
|
||||
}])
|
||||
|
||||
many2manys = Many2Many.search([
|
||||
('targets', '=', "Target"),
|
||||
('targets.rec_name', '=', "Target"),
|
||||
])
|
||||
|
||||
self.assertListEqual(many2manys, [many2many])
|
||||
@@ -63,7 +63,7 @@ class CommonTestCaseMixin:
|
||||
}])
|
||||
|
||||
many2manys = Many2Many.search([
|
||||
('targets', '!=', "Target"),
|
||||
('targets.rec_name', '!=', "Target"),
|
||||
])
|
||||
|
||||
self.assertListEqual(many2manys, [])
|
||||
@@ -110,7 +110,7 @@ class CommonTestCaseMixin:
|
||||
}])
|
||||
|
||||
many2manys = Many2Many.search([
|
||||
('targets', '!=', "Target"),
|
||||
('targets.rec_name', '!=', "Target"),
|
||||
])
|
||||
|
||||
self.assertListEqual(many2manys, [no_link])
|
||||
|
||||
@@ -20,7 +20,7 @@ class SearchTestCaseMixin:
|
||||
}])
|
||||
|
||||
one2manys = One2Many.search([
|
||||
('targets', '=', "Target"),
|
||||
('targets.rec_name', '=', "Target"),
|
||||
])
|
||||
|
||||
self.assertListEqual(one2manys, [one2many])
|
||||
@@ -35,7 +35,7 @@ class SearchTestCaseMixin:
|
||||
}])
|
||||
|
||||
one2manys = One2Many.search([
|
||||
('targets', '=', "Target"),
|
||||
('targets.rec_name', '=', "Target"),
|
||||
])
|
||||
|
||||
self.assertListEqual(one2manys, [one2many])
|
||||
@@ -49,7 +49,7 @@ class SearchTestCaseMixin:
|
||||
}])
|
||||
|
||||
one2manys = One2Many.search([
|
||||
('targets', '!=', "Target"),
|
||||
('targets.rec_name', '!=', "Target"),
|
||||
])
|
||||
|
||||
self.assertListEqual(one2manys, [])
|
||||
@@ -96,7 +96,7 @@ class SearchTestCaseMixin:
|
||||
}])
|
||||
|
||||
one2manys = One2Many.search([
|
||||
('targets', '!=', "Target"),
|
||||
('targets.rec_name', '!=', "Target"),
|
||||
])
|
||||
|
||||
self.assertListEqual(one2manys, [no_link])
|
||||
|
||||
@@ -140,7 +140,7 @@ class FieldOne2OneTestCase(TestCase):
|
||||
}])
|
||||
|
||||
one2ones = One2One.search([
|
||||
('one2one', '=', "Target"),
|
||||
('one2one.rec_name', '=', "Target"),
|
||||
])
|
||||
|
||||
self.assertListEqual(one2ones, [one2one])
|
||||
@@ -157,7 +157,7 @@ class FieldOne2OneTestCase(TestCase):
|
||||
}])
|
||||
|
||||
one2ones = One2One.search([
|
||||
('one2one', '!=', "Target"),
|
||||
('one2one.rec_name', '!=', "Target"),
|
||||
])
|
||||
|
||||
self.assertListEqual(one2ones, [])
|
||||
|
||||
Reference in New Issue
Block a user