I added the 2 fields in journal entries
<xpath expr="//page[@name='aml_tab']/field[@name='line_ids']/tree/field[@name='debit']" position="before">
<field name="deferred_start_date"/>
<field name="deferred_end_date"/>
</xpath>
in odoo default the onchange function makes the field set to false
@api.onchange('deferred_start_date')
def _onchange_deferred_start_date(self):
if not self._is_compatible_account():
self.deferred_start_date = False
@api.onchange('deferred_end_date')
def _onchange_deferred_end_date(self):
if not self._is_compatible_account():
self.deferred_end_date = False
The other function is this
def _is_compatible_account(self):
self.ensure_one()
return (
self.move_id.is_purchase_document()
and
self.account_id.account_type in ('expense', 'expense_depreciation', 'expense_direct_cost')
) or (
self.move_id.is_sale_document()
and
self.account_id.account_type in ('income', 'income_other')
)
the _is_compatible_account function also called from _get_deferred_tax_key .
and in generate entries function
def _generate_deferred_entries(self):
"""
Generates the deferred entries for the invoice.
"""
self.ensure_one()
if self.is_entry():
raise UserError(_("You cannot generate deferred entries for a miscellaneous journal entry."))
What is the specific reason odoo not allowed to generate deferred entries from journal entries . ??
i think one reason is tax .
odoo only allowed to generate entries from invoice, bills. debit note and credit notes.