- Create Accrual Entry for the expense/revenue recognition
+ Create Accrual Entries for the expense/revenue recognition
account.accrual.accounting.wizard
form
new
diff --git a/addons/account/wizard/account_transfer_wizard.py b/addons/account/wizard/account_transfer_wizard.py
index e771cd0342a..c6d73973abf 100644
--- a/addons/account/wizard/account_transfer_wizard.py
+++ b/addons/account/wizard/account_transfer_wizard.py
@@ -2,6 +2,7 @@
from odoo import api, fields, models, _
from odoo.exceptions import UserError
+from odoo.tools.misc import format_date, formatLang
from collections import defaultdict
@@ -43,9 +44,20 @@ class AccountTransferWizard(models.TransientModel):
@api.depends('destination_account_id')
def _compute_aml_preview_data(self):
for record in self:
- record.aml_preview_data = json.dumps(self._get_lines_to_create_dict())
+ record.aml_preview_data = json.dumps({
+ 'groups_vals': [self.env['account.move']._move_dict_to_preview_vals(self._get_move_to_create_dict(), record.company_id.currency_id)],
+ 'options': {
+ 'columns': [
+ {'field': 'account_id', 'label': _('Account')},
+ {'field': 'name', 'label': _('Label')},
+ {'field': 'partner_id', 'label': _('Partner')},
+ {'field': 'debit', 'label': _('Debit'), 'class': 'text-right text-nowrap'},
+ {'field': 'credit', 'label': _('Credit'), 'class': 'text-right text-nowrap'},
+ ],
+ },
+ })
- def _get_lines_to_create_dict(self):
+ def _get_move_to_create_dict(self):
line_vals = []
# Group data from selected move lines
@@ -77,9 +89,7 @@ class AccountTransferWizard(models.TransientModel):
'debit': counterpart_vals['balance'] > 0 and self.company_id.currency_id.round(counterpart_vals['balance']) or 0,
'credit': counterpart_vals['balance'] < 0 and self.company_id.currency_id.round(-counterpart_vals['balance']) or 0,
'account_id': self.destination_account_id.id,
- 'preview-account': self.destination_account_id and self.destination_account_id.name_get()[0][1] or _('Destination Account'),
'partner_id': counterpart_partner.id or None,
- 'preview-partner': counterpart_partner and counterpart_partner.name or None,
'amount_currency': counterpart_currency and counterpart_currency.round((counterpart_vals['balance'] < 0 and -1 or 1) * abs(counterpart_vals['amount_currency'])) or 0,
'currency_id': counterpart_currency.id or None,
})
@@ -94,31 +104,20 @@ class AccountTransferWizard(models.TransientModel):
'debit': account_balance < 0 and self.company_id.currency_id.round(-account_balance) or 0,
'credit': account_balance > 0 and self.company_id.currency_id.round(account_balance) or 0,
'account_id': account.id,
- 'preview-account': account.name_get()[0][1],
'partner_id': partner.id or None,
- 'preview-partner': partner and partner.name or None,
'currency_id': currency.id or None,
'amount_currency': (account_balance > 0 and -1 or 1) * abs(account_amount_currency),
})
- return line_vals
-
- def button_transfer(self):
- all_lines_dict = self._get_lines_to_create_dict()
-
- orm_line_commands = []
- for line_dict in all_lines_dict:
- del line_dict['preview-account']
- del line_dict['preview-partner']
- orm_line_commands.append((0, 0, line_dict))
-
- new_move = self.env['account.move'].create({
+ return {
'journal_id': self.journal_id.id,
'date': self.date,
- 'ref': _("Transfer entry to %s") % self.destination_account_id.display_name,
- 'line_ids': orm_line_commands,
- })
+ 'ref': self.destination_account_id.display_name and _("Transfer entry to %s") % self.destination_account_id.display_name or '',
+ 'line_ids': [(0, 0, line) for line in line_vals],
+ }
+ def button_transfer(self):
+ new_move = self.env['account.move'].create(self._get_move_to_create_dict())
new_move.post()
# Group lines
@@ -193,4 +192,4 @@ class AccountTransferWizard(models.TransientModel):
def _format_move_link(self, move):
move_link_format = "%(move_name)s"
- return move_link_format % {'move_id': move.id, 'move_name': move.name}
\ No newline at end of file
+ return move_link_format % {'move_id': move.id, 'move_name': move.name}
diff --git a/addons/account/wizard/account_transfer_wizard.xml b/addons/account/wizard/account_transfer_wizard.xml
index 965e737f750..052bf8cdc9b 100644
--- a/addons/account/wizard/account_transfer_wizard.xml
+++ b/addons/account/wizard/account_transfer_wizard.xml
@@ -27,7 +27,7 @@
The following journal entry will be generated
-
+
-
\ No newline at end of file
+
diff --git a/addons/l10n_generic_coa/data/account.account.template.csv b/addons/l10n_generic_coa/data/account.account.template.csv
index 5d7b6010229..82f70556f4a 100644
--- a/addons/l10n_generic_coa/data/account.account.template.csv
+++ b/addons/l10n_generic_coa/data/account.account.template.csv
@@ -4,6 +4,7 @@
"stock_in","Stock Interim (Received)","1102","account.data_account_type_current_assets","l10n_generic_coa.configurable_chart_template","","True"
"stock_out","Stock Interim (Delivered)","1103","account.data_account_type_current_assets","l10n_generic_coa.configurable_chart_template","","True"
"receivable","Account Receivable","1210","account.data_account_type_receivable","l10n_generic_coa.configurable_chart_template","","True"
+"to_receive_rec","Products to receive","12101","account.data_account_type_current_assets","l10n_generic_coa.configurable_chart_template","","True"
"tax_paid","Tax Paid","1310","account.data_account_type_current_assets","l10n_generic_coa.configurable_chart_template","","False"
"tax_receivable","Tax Receivable","1320","account.data_account_type_current_assets","l10n_generic_coa.configurable_chart_template","","False"
"prepayments","Prepayments","1410","account.data_account_type_prepayments","l10n_generic_coa.configurable_chart_template","","False"
@@ -11,6 +12,7 @@
"non_current_assets","Non-current assets","1910","account.data_account_type_non_current_assets","l10n_generic_coa.configurable_chart_template","","False"
"current_liabilities","Current Liabilities","2010","account.data_account_type_current_liabilities","l10n_generic_coa.configurable_chart_template","","False"
"payable","Account Payable","2110","account.data_account_type_payable","l10n_generic_coa.configurable_chart_template","","True"
+"to_receive_pay","Bills to receive","21101","account.data_account_type_current_liabilities","l10n_generic_coa.configurable_chart_template","","True"
"tax_received","Tax Received","2510","account.data_account_type_current_liabilities","l10n_generic_coa.configurable_chart_template","","False"
"tax_payable","Tax Payable","2520","account.data_account_type_current_liabilities","l10n_generic_coa.configurable_chart_template","","False"
"non_current_liabilities","Non-current Liabilities","2910","account.data_account_type_non_current_liabilities","l10n_generic_coa.configurable_chart_template","","False"