account
This commit is contained in:
14
account_reports/wizard/__init__.py
Normal file
14
account_reports/wizard/__init__.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import account_change_lock_date
|
||||
from . import base_partner_merge
|
||||
from . import account_report_send
|
||||
from . import account_report_file_download_error_wizard
|
||||
from . import fiscal_year
|
||||
from . import multicurrency_revaluation
|
||||
from . import report_export_wizard
|
||||
from . import return_generic_payment_wizard
|
||||
from . import return_creation_wizard
|
||||
from . import return_submission_wizard
|
||||
from . import qr_code_payment_wizard
|
||||
from . import mail_compose_message
|
||||
23
account_reports/wizard/account_change_lock_date.py
Normal file
23
account_reports/wizard/account_change_lock_date.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class AccountChangeLockDate(models.TransientModel):
|
||||
"""
|
||||
This wizard is used to change the lock date
|
||||
"""
|
||||
_inherit = 'account.change.lock.date'
|
||||
|
||||
def _create_default_report_external_values(self, lock_date_field):
|
||||
"""
|
||||
Calls the _generate_default_external_values in account_report
|
||||
to create default external values for either all reports except the tax reports,
|
||||
or only the tax reports, depending on the lock date type:
|
||||
- max(fiscalyear_lock_date, hard_lock_date) is used to create default values in all reports except the tax reports for that date
|
||||
- tax_lock_date is used to create default values only in tax reports for that date
|
||||
"""
|
||||
# extends account.accountant
|
||||
date_from, date_to = self._get_current_period_dates(lock_date_field)
|
||||
self.env['account.report']._generate_default_external_values(date_from, date_to, lock_date_field == 'tax_lock_date')
|
||||
@@ -0,0 +1,27 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class AccountReportFileDownloadErrorWizard(models.TransientModel):
|
||||
_name = 'account.report.file.download.error.wizard'
|
||||
_description = "Manage the file generation errors from report exports."
|
||||
|
||||
actionable_errors = fields.Json()
|
||||
file_name = fields.Char()
|
||||
file_content = fields.Binary()
|
||||
has_danger_actionable_errors = fields.Boolean(compute='_compute_has_danger_actionable_errors')
|
||||
|
||||
@api.depends('actionable_errors')
|
||||
def _compute_has_danger_actionable_errors(self):
|
||||
for record in self:
|
||||
record.has_danger_actionable_errors = any(error.get('level') == 'danger' for error in record.actionable_errors.values())
|
||||
|
||||
def button_download(self):
|
||||
self.ensure_one()
|
||||
if self.file_name:
|
||||
return {
|
||||
'type': 'ir.actions.act_url',
|
||||
'url': f'/web/content/account.report.file.download.error.wizard/{self.id}/file_content/{self.file_name}?download=1',
|
||||
'close': True,
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="view_account_report_file_download_error_wizard_form" model="ir.ui.view">
|
||||
<field name="name">account.report.file.download.error.wizard.form</field>
|
||||
<field name="model">account.report.file.download.error.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="File Download Errors">
|
||||
<field name="file_content" invisible="1"/>
|
||||
<div invisible="file_content">
|
||||
<span>One or more error(s) occurred during file generation:</span>
|
||||
</div>
|
||||
<div>
|
||||
<field name="actionable_errors" class="o_field_html w-100" widget="actionable_errors"/>
|
||||
<p invisible="not has_danger_actionable_errors"><i>Errors marked with <i class="oi" data-icon="warning"/> are critical and will produce an invalid file.</i></p>
|
||||
</div>
|
||||
<footer>
|
||||
<button string="Download Anyway"
|
||||
name="button_download"
|
||||
type="object"
|
||||
class="btn btn-primary"
|
||||
close="1"
|
||||
data-hotkey="d"/>
|
||||
<button string="Close"
|
||||
class="btn btn-secondary"
|
||||
special="cancel"
|
||||
data-hotkey="z"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
316
account_reports/wizard/account_report_send.py
Normal file
316
account_reports/wizard/account_report_send.py
Normal file
@@ -0,0 +1,316 @@
|
||||
from odoo import _, api, fields, models
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools.misc import get_lang
|
||||
|
||||
|
||||
class AccountReportSend(models.TransientModel):
|
||||
_name = 'account.report.send'
|
||||
_description = "Account Report Send"
|
||||
|
||||
partner_ids = fields.Many2many(
|
||||
comodel_name='res.partner',
|
||||
compute='_compute_partner_ids',
|
||||
)
|
||||
mode = fields.Selection(
|
||||
selection=[
|
||||
('single', "Single Recipient"),
|
||||
('multi', "Multiple Recipients"),
|
||||
],
|
||||
compute='_compute_mode',
|
||||
readonly=False,
|
||||
store=True,
|
||||
)
|
||||
|
||||
# == PRINT ==
|
||||
enable_download = fields.Boolean()
|
||||
checkbox_download = fields.Boolean(string="Download")
|
||||
|
||||
# == MAIL ==
|
||||
enable_send_mail = fields.Boolean(default=True)
|
||||
checkbox_send_mail = fields.Boolean(string="Email", default=True)
|
||||
|
||||
display_mail_composer = fields.Boolean(compute='_compute_send_mail_extra_fields')
|
||||
warnings = fields.Json(compute='_compute_warnings')
|
||||
send_mail_readonly = fields.Boolean(compute='_compute_send_mail_extra_fields')
|
||||
mail_template_id = fields.Many2one(
|
||||
comodel_name='mail.template',
|
||||
string="Email template",
|
||||
domain="[('model', '=', 'res.partner')]",
|
||||
)
|
||||
|
||||
account_report_id = fields.Many2one(
|
||||
comodel_name='account.report',
|
||||
string="Report",
|
||||
)
|
||||
report_options = fields.Json()
|
||||
|
||||
mail_lang = fields.Char(
|
||||
string="Lang",
|
||||
compute='_compute_mail_lang',
|
||||
)
|
||||
mail_partner_ids = fields.Many2many(
|
||||
comodel_name='res.partner',
|
||||
string="Recipients",
|
||||
compute='_compute_mail_partner_ids',
|
||||
store=True,
|
||||
readonly=False,
|
||||
)
|
||||
mail_subject = fields.Char(
|
||||
string="Subject",
|
||||
compute='_compute_mail_subject_body',
|
||||
store=True,
|
||||
readonly=False,
|
||||
)
|
||||
mail_body = fields.Html(
|
||||
string="Contents",
|
||||
sanitize_style=True,
|
||||
compute='_compute_mail_subject_body',
|
||||
store=True,
|
||||
readonly=False,
|
||||
)
|
||||
mail_attachments_widget = fields.Json(
|
||||
compute='_compute_mail_attachments_widget',
|
||||
store=True,
|
||||
readonly=False,
|
||||
)
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields):
|
||||
# EXTENDS 'base'
|
||||
results = super().default_get(fields)
|
||||
|
||||
context_options = self.env.context.get('default_report_options', {})
|
||||
if 'account_report_id' in fields and 'account_report_id' not in results:
|
||||
report_id = context_options.get('report_id', False)
|
||||
results['account_report_id'] = report_id
|
||||
results['report_options'] = context_options
|
||||
|
||||
return results
|
||||
|
||||
@api.model
|
||||
def _get_mail_field_value(self, partner, mail_template, mail_lang, field, **kwargs):
|
||||
if not mail_template:
|
||||
return
|
||||
return mail_template\
|
||||
.with_context(lang=mail_lang)\
|
||||
._render_field(field, partner.ids, **kwargs)[partner._origin.id]
|
||||
|
||||
def _get_default_mail_attachments_widget(self, partner, mail_template):
|
||||
return self._get_placeholder_mail_attachments_data(partner) \
|
||||
+ self._get_mail_template_attachments_data(mail_template)
|
||||
|
||||
def _get_wizard_values(self):
|
||||
self.ensure_one()
|
||||
options = self.report_options
|
||||
if not options.get('partner_ids', []):
|
||||
options['partner_ids'] = self.partner_ids.ids
|
||||
return {
|
||||
'mail_template_id': self.mail_template_id.id,
|
||||
'checkbox_download': self.checkbox_download,
|
||||
'checkbox_send_mail': self.checkbox_send_mail,
|
||||
'report_options': options,
|
||||
}
|
||||
|
||||
def _get_placeholder_mail_attachments_data(self, partner):
|
||||
""" Returns all the placeholder data.
|
||||
Should be extended to add placeholder based on the checkboxes.
|
||||
:param: partner: The partner for which this report is generated.
|
||||
:returns: A list of dictionary for each placeholder.
|
||||
* id: str: The (fake) id of the attachment, this is needed in rendering in t-key.
|
||||
* name: str: The name of the attachment.
|
||||
* mimetype: str: The mimetype of the attachment.
|
||||
* placeholder bool: Should be true to prevent download / deletion.
|
||||
"""
|
||||
self.ensure_one()
|
||||
filename = self.account_report_id.get_default_partner_report_filename(partner, self.report_options)
|
||||
|
||||
return [{
|
||||
'id': f'placeholder_{filename}',
|
||||
'name': filename,
|
||||
'mimetype': 'application/pdf',
|
||||
'placeholder': True,
|
||||
}]
|
||||
|
||||
@api.model
|
||||
def _get_mail_template_attachments_data(self, mail_template):
|
||||
""" Returns all the placeholder data and mail template data
|
||||
"""
|
||||
return [
|
||||
{
|
||||
'id': attachment.id,
|
||||
'name': attachment.name,
|
||||
'mimetype': attachment.mimetype,
|
||||
'placeholder': False,
|
||||
'mail_template_id': mail_template.id,
|
||||
}
|
||||
for attachment in mail_template.attachment_ids
|
||||
]
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# COMPUTE METHODS
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
@api.depends('partner_ids')
|
||||
def _compute_mode(self):
|
||||
for wizard in self:
|
||||
wizard.mode = 'single' if len(wizard.partner_ids) == 1 else 'multi'
|
||||
|
||||
@api.depends('checkbox_send_mail')
|
||||
def _compute_send_mail_extra_fields(self):
|
||||
for wizard in self:
|
||||
wizard.display_mail_composer = wizard.mode == 'single'
|
||||
partners_without_mail_data = wizard.mail_partner_ids.filtered(lambda x: not x.email)
|
||||
wizard.send_mail_readonly = partners_without_mail_data == wizard.mail_partner_ids
|
||||
|
||||
@api.depends('mail_partner_ids', 'checkbox_send_mail', 'send_mail_readonly')
|
||||
def _compute_warnings(self):
|
||||
for wizard in self:
|
||||
warnings = {}
|
||||
|
||||
partners_without_mail = wizard.mail_partner_ids.filtered(lambda x: not x.email)
|
||||
if wizard.send_mail_readonly or (wizard.checkbox_send_mail and partners_without_mail):
|
||||
warnings['account_missing_email'] = {
|
||||
'message': _("Partner(s) should have an email address."),
|
||||
'action_text': _("View Partner(s)"),
|
||||
'action': partners_without_mail._get_records_action(name=_("Check Partner(s) Email(s)"))
|
||||
}
|
||||
|
||||
wizard.warnings = warnings
|
||||
|
||||
@api.depends('partner_ids')
|
||||
def _compute_mail_lang(self):
|
||||
for wizard in self:
|
||||
if wizard.mode == 'single':
|
||||
wizard.mail_lang = wizard.partner_ids.lang
|
||||
else:
|
||||
wizard.mail_lang = get_lang(self.env).code
|
||||
|
||||
@api.depends('account_report_id', 'report_options')
|
||||
def _compute_partner_ids(self):
|
||||
for wizard in self:
|
||||
wizard.partner_ids = wizard.account_report_id._get_report_send_recipients(wizard.report_options)
|
||||
|
||||
@api.depends('account_report_id', 'report_options', 'mail_template_id')
|
||||
def _compute_mail_partner_ids(self):
|
||||
for wizard in self:
|
||||
wizard.mail_partner_ids = wizard.partner_ids
|
||||
|
||||
@api.depends('mail_template_id', 'mail_lang', 'mode')
|
||||
def _compute_mail_subject_body(self):
|
||||
for wizard in self:
|
||||
if wizard.mode == 'single' and wizard.mail_template_id:
|
||||
wizard.mail_subject = self._get_mail_field_value(wizard.mail_partner_ids, wizard.mail_template_id, wizard.mail_lang, 'subject')
|
||||
wizard.mail_body = self._get_mail_field_value(wizard.mail_partner_ids, wizard.mail_template_id, wizard.mail_lang, 'body_html', options={'post_process': True})
|
||||
else:
|
||||
wizard.mail_subject = wizard.mail_body = None
|
||||
|
||||
@api.depends('mail_template_id', 'mode')
|
||||
def _compute_mail_attachments_widget(self):
|
||||
for wizard in self:
|
||||
if wizard.mode == 'single':
|
||||
wizard.mail_attachments_widget = wizard._get_default_mail_attachments_widget(wizard.mail_partner_ids, wizard.mail_template_id)
|
||||
else:
|
||||
wizard.mail_attachments_widget = []
|
||||
|
||||
@api.model
|
||||
def _action_download(self, attachments):
|
||||
""" Download the PDF attachment, or a zip of attachments if there are more than one. """
|
||||
return {
|
||||
'type': 'ir.actions.act_url',
|
||||
'url': f'/account_reports/download_attachments/{",".join(map(str, attachments.ids))}',
|
||||
'close': True,
|
||||
}
|
||||
|
||||
def _process_send_and_print(self, report, options, recipient_partner_ids=None, wizard=None):
|
||||
""" Generate a report for one partner based on the options (send_and_print_values stored on the report).
|
||||
:param options: dict of report options (should contain one partner id in options['partner_ids'])
|
||||
:param recipient_partner_ids: list of partner ids that will receive the mail message.
|
||||
:param wizard: account.report.send wizard if exists. Indicates if sending by cron.
|
||||
"""
|
||||
wizard_vals = report.send_and_print_values if not wizard else wizard._get_wizard_values()
|
||||
to_email = wizard_vals['checkbox_send_mail']
|
||||
to_download = wizard_vals['checkbox_download']
|
||||
|
||||
mail_template_id = self.env['mail.template'].browse(wizard_vals['mail_template_id'])
|
||||
if wizard:
|
||||
attachments_ids = [att['id'] for att in wizard.mail_attachments_widget or [] if not att['placeholder']]
|
||||
else:
|
||||
attachments_ids = mail_template_id.attachment_ids.ids
|
||||
|
||||
options['unfold_all'] = True
|
||||
|
||||
partner_ids = options.get('partner_ids', [])
|
||||
partners = self.env['res.partner'].browse(partner_ids)
|
||||
if not recipient_partner_ids:
|
||||
recipient_partner_ids = partners.filtered('email').ids
|
||||
|
||||
email_from = mail_template_id._render_field('email_from', partner_ids) if mail_template_id else {}
|
||||
downloadable_attachments = self.env['ir.attachment']
|
||||
|
||||
for partner in partners:
|
||||
options['partner_ids'] = partner.ids
|
||||
report_attachment = partner._get_partner_account_report_attachment(report, options)
|
||||
|
||||
if to_email and recipient_partner_ids:
|
||||
if wizard and wizard.mode == 'single':
|
||||
subject = self.mail_subject
|
||||
body = self.mail_body
|
||||
else:
|
||||
subject = self._get_mail_field_value(partner, mail_template_id, partner.lang, 'subject')
|
||||
body = self._get_mail_field_value(partner, mail_template_id, partner.lang, 'body_html', options={'post_process': True})
|
||||
|
||||
partner.message_post(
|
||||
body=body,
|
||||
subject=subject,
|
||||
email_from=email_from.get(partner.id),
|
||||
partner_ids=recipient_partner_ids,
|
||||
attachment_ids=attachments_ids + report_attachment.ids,
|
||||
email_add_signature=False,
|
||||
)
|
||||
|
||||
if to_download:
|
||||
downloadable_attachments += report_attachment
|
||||
|
||||
if downloadable_attachments:
|
||||
return self._action_download(downloadable_attachments)
|
||||
|
||||
def action_send_and_print(self, force_synchronous=False):
|
||||
""" Create the documents and send them to the end customers.
|
||||
If we are sending multiple statements and not downloading them we will process the moves asynchronously.
|
||||
:param force_synchronous: Flag indicating if the method should be done synchronously.
|
||||
"""
|
||||
self.ensure_one()
|
||||
|
||||
if self.mode == 'multi' and self.checkbox_send_mail and not self.mail_template_id:
|
||||
raise UserError(_('Please select a mail template to send multiple statements.'))
|
||||
|
||||
force_synchronous = force_synchronous or self.checkbox_download
|
||||
process_later = self.mode == 'multi' and not force_synchronous
|
||||
if process_later:
|
||||
# Set sending information on report
|
||||
if self.account_report_id.send_and_print_values:
|
||||
raise UserError(_('There are currently reports waiting to be sent, please try again later.'))
|
||||
|
||||
self.account_report_id.send_and_print_values = self._get_wizard_values()
|
||||
|
||||
self.env.ref('account_reports.ir_cron_account_report_send')._trigger()
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'display_notification',
|
||||
'params': {
|
||||
'type': 'info',
|
||||
'title': _('Sending statements'),
|
||||
'message': _('Statements are being sent in the background.'),
|
||||
'next': {'type': 'ir.actions.act_window_close'},
|
||||
},
|
||||
}
|
||||
options = {
|
||||
**self.report_options,
|
||||
'partner_ids': self.partner_ids.ids,
|
||||
}
|
||||
return self._process_send_and_print(
|
||||
report=self.account_report_id,
|
||||
options=options,
|
||||
recipient_partner_ids=self.mail_partner_ids.ids,
|
||||
wizard=self,
|
||||
)
|
||||
99
account_reports/wizard/account_report_send.xml
Normal file
99
account_reports/wizard/account_report_send.xml
Normal file
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="account_report_send_form" model="ir.ui.view">
|
||||
<field name="name">account.report.send.form</field>
|
||||
<field name="model">account.report.send</field>
|
||||
<field name="group_ids" eval="[Command.link(ref('base.group_user'))]"/>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<!-- Invisible fields -->
|
||||
<field name="mode" invisible="1"/>
|
||||
<field name="enable_download" invisible="1"/>
|
||||
<field name="enable_send_mail" invisible="1"/>
|
||||
<field name="send_mail_readonly" invisible="1"/>
|
||||
<field name="display_mail_composer" invisible="1"/>
|
||||
<field name="mail_lang" invisible="1"/>
|
||||
<field name="account_report_id" invisible="1"/>
|
||||
<field name="report_options" invisible="1"/>
|
||||
|
||||
<div class="m-0" name="warnings" invisible="not warnings">
|
||||
<field name="warnings" class="o_field_html" widget="actionable_errors"/>
|
||||
</div>
|
||||
|
||||
<!-- Options -->
|
||||
<div name="options" class="row">
|
||||
<div name="standard_options" class="col-3">
|
||||
<div name="option_send_mail"
|
||||
invisible="not enable_send_mail">
|
||||
<i class="oi ml4"
|
||||
data-icon="help"
|
||||
role="img"
|
||||
aria-label="Warning"
|
||||
title="The email address is unknown on the partner"
|
||||
invisible="not send_mail_readonly"/>
|
||||
</div>
|
||||
</div>
|
||||
<div name="advanced_options" class="col-3"/>
|
||||
</div>
|
||||
|
||||
<!-- Mail -->
|
||||
<div invisible="not checkbox_send_mail">
|
||||
<group invisible="not display_mail_composer">
|
||||
<label for="mail_partner_ids" string="Recipients"/>
|
||||
<div>
|
||||
<field name="mail_partner_ids"
|
||||
widget="many2many_tags_email"
|
||||
placeholder="Add contacts to notify..."
|
||||
options="{'no_quick_create': True}"
|
||||
context="{'show_email': True, 'form_view_ref': 'base.view_partner_simple_form'}"/>
|
||||
</div>
|
||||
<field name="mail_subject"
|
||||
placeholder="Subject..."
|
||||
required="checkbox_send_mail and mode == 'single'"/>
|
||||
</group>
|
||||
<field name="mail_body"
|
||||
class="oe-bordered-editor"
|
||||
widget="html_mail"
|
||||
invisible="not display_mail_composer"/>
|
||||
<group>
|
||||
<group invisible="not display_mail_composer">
|
||||
<field name="mail_attachments_widget"
|
||||
widget="mail_attachments"
|
||||
string="Attach a file"
|
||||
nolabel="1"
|
||||
colspan="2"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="mail_template_id"
|
||||
required="mode == 'multi'"
|
||||
options="{'no_create': True, 'no_edit': True}"
|
||||
context="{'default_model': 'res.partner'}"
|
||||
invisible="mode == 'single'"/>
|
||||
</group>
|
||||
</group>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<button string="Print & Send"
|
||||
invisible="not checkbox_send_mail and not checkbox_download"
|
||||
data-hotkey="q"
|
||||
name="action_send_and_print"
|
||||
type="object"
|
||||
class="print btn-primary o_mail_send">
|
||||
</button>
|
||||
<button data-hotkey="x"
|
||||
special="cancel"
|
||||
class="btn-secondary"/>
|
||||
<div class="d-flex align-items-center gap-2" invisible="mode == 'multi'">
|
||||
<label for="mail_template_id" string="Email Template"/>
|
||||
<field name="mail_template_id"
|
||||
options="{'no_create': True, 'no_edit': True}"
|
||||
context="{'default_model': 'res.partner'}"/>
|
||||
</div>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
17
account_reports/wizard/base_partner_merge.py
Normal file
17
account_reports/wizard/base_partner_merge.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from odoo import models
|
||||
|
||||
|
||||
class BasePartnerMergeAutomaticWizard(models.TransientModel):
|
||||
_inherit = 'base.partner.merge.automatic.wizard'
|
||||
|
||||
def _merge(self, partner_ids, dst_partner=None, extra_checks=True):
|
||||
rslt = super()._merge(partner_ids, dst_partner=dst_partner, extra_checks=extra_checks)
|
||||
|
||||
# Merging partners rewrites partner_id on move lines at SQL level, without any lock date protection;
|
||||
# snapshots grouped by partner may contain stale results afterwards, and need to be regenerated.
|
||||
snapshots_to_unlink = self.env['account.report.snapshot'].sudo().search([('groupby', '=', 'partner_id')])
|
||||
if snapshots_to_unlink:
|
||||
snapshots_to_unlink.unlink()
|
||||
self.env.ref('account_reports.ir_cron_create_snapshots')._trigger()
|
||||
|
||||
return rslt
|
||||
39
account_reports/wizard/fiscal_year.py
Normal file
39
account_reports/wizard/fiscal_year.py
Normal file
@@ -0,0 +1,39 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class AccountFinancialYearOp(models.TransientModel):
|
||||
_inherit = 'account.financial.year.op'
|
||||
_description = 'Opening Balance of Financial Year'
|
||||
|
||||
account_return_periodicity = fields.Selection(related='company_id.account_return_periodicity', string='Periodicity in month', readonly=False, required=True)
|
||||
account_return_periodicity_label = fields.Char(compute="_compute_account_return_periodicity_label")
|
||||
account_tax_return_journal_id = fields.Many2one(related='company_id.account_tax_return_journal_id', string='Journal', readonly=False)
|
||||
account_return_reminder_day = fields.Integer(related='company_id.account_return_reminder_day', string='Reminder', readonly=False, required=True)
|
||||
vat_label = fields.Char(related="company_id.country_id.vat_label")
|
||||
|
||||
def _company_fields_to_update(self):
|
||||
# Changing any of these fields can trigger generation of tax returns. We are including them here so the
|
||||
# company is updated in a single write and return generation isn't run multiple times.
|
||||
return super()._company_fields_to_update() | {'account_return_periodicity', 'account_tax_return_journal_id', 'account_return_reminder_day'}
|
||||
|
||||
def action_save_onboarding_fiscal_year(self):
|
||||
result_action = super().action_save_onboarding_fiscal_year()
|
||||
if self.company_id.vat_disabled:
|
||||
self.company_id.account_tax_return_journal_id.show_on_dashboard = False
|
||||
elif self.env.context.get('open_account_return_on_save'):
|
||||
return self.env['account.return'].action_open_tax_return_view(
|
||||
self.env.context.get('additional_return_domain'),
|
||||
self.env.context.get('additional_return_context')
|
||||
)
|
||||
return result_action
|
||||
|
||||
@api.depends('vat_label')
|
||||
def _compute_account_return_periodicity_label(self):
|
||||
for wizard in self:
|
||||
wizard.account_return_periodicity_label = (
|
||||
self.env._("%(vat_label)s Periodicity", vat_label=wizard.vat_label)
|
||||
if wizard.vat_label
|
||||
else self.env._("Periodicity")
|
||||
)
|
||||
16
account_reports/wizard/fiscal_year.xml
Normal file
16
account_reports/wizard/fiscal_year.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="setup_financial_year_opening_form" model="ir.ui.view">
|
||||
<field name="name">account.financial.year.op.setup.wizard.form</field>
|
||||
<field name="model">account.financial.year.op</field>
|
||||
<field name="inherit_id" ref="account.setup_financial_year_opening_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//sheet/group" position="inside">
|
||||
<span class="o_form_label" invisible="company_vat_disabled"><field name="account_return_periodicity_label" class="oe_inline"/></span>
|
||||
<field name="account_return_periodicity" string="Tax Periodicity" class="o_stat_value" nolabel="1" invisible="company_vat_disabled"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
55
account_reports/wizard/mail_compose_message.py
Normal file
55
account_reports/wizard/mail_compose_message.py
Normal file
@@ -0,0 +1,55 @@
|
||||
from ast import literal_eval
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class MailComposeMessage(models.TransientModel):
|
||||
_inherit = 'mail.compose.message'
|
||||
|
||||
# Field to annotate the date for account reports.
|
||||
# This is set by passing a default in the context when opening the wizard from a message.
|
||||
account_reports_annotation_date = fields.Date("Annotated For")
|
||||
|
||||
def _prepare_schedule_message_post_values(self, post_values):
|
||||
return {
|
||||
**super()._prepare_schedule_message_post_values(post_values),
|
||||
'account_reports_annotation_date': self.account_reports_annotation_date,
|
||||
}
|
||||
|
||||
def _action_send_mail_comment(self, res_ids):
|
||||
# Getting the date before the super call as the orm cache is invalidated afterwards.
|
||||
account_reports_annotation_date = self.account_reports_annotation_date
|
||||
messages = super()._action_send_mail_comment(res_ids)
|
||||
if account_reports_annotation_date:
|
||||
self.env['account.report.annotation'].sudo().create([
|
||||
{'message_id': msg.id, 'date': account_reports_annotation_date}
|
||||
for msg in messages
|
||||
])
|
||||
return messages
|
||||
|
||||
def _action_send_mail(self, auto_commit=False):
|
||||
# Getting the date before the super call as the orm cache is invalidated afterwards.
|
||||
account_reports_annotation_date = self.account_reports_annotation_date
|
||||
mails, messages = super()._action_send_mail(auto_commit=auto_commit)
|
||||
if account_reports_annotation_date:
|
||||
self.env['account.report.annotation'].sudo().create([
|
||||
{'message_id': msg.id, 'date': account_reports_annotation_date}
|
||||
for msg in messages
|
||||
])
|
||||
return mails, messages
|
||||
|
||||
def action_send_mail(self):
|
||||
if self.model != 'account.return' or not self.env.context.get('account_return_finalize_payment'):
|
||||
return super().action_send_mail()
|
||||
|
||||
return_id = self.env['account.return'].browse(literal_eval(self.res_ids))
|
||||
return_id._action_finalize_payment()
|
||||
super().action_send_mail()
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'action_return_refresh',
|
||||
'params': {
|
||||
'next_action': {'type': 'ir.actions.act_window_close'},
|
||||
'return_ids': return_id.ids,
|
||||
},
|
||||
}
|
||||
193
account_reports/wizard/multicurrency_revaluation.py
Normal file
193
account_reports/wizard/multicurrency_revaluation.py
Normal file
@@ -0,0 +1,193 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import json
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from odoo import models, api, fields, _
|
||||
from odoo.fields import Command, Date
|
||||
from odoo.tools import format_date
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountMulticurrencyRevaluationWizard(models.TransientModel):
|
||||
_name = 'account.multicurrency.revaluation.wizard'
|
||||
_description = 'Multicurrency Revaluation Wizard'
|
||||
|
||||
company_id = fields.Many2one('res.company', default=lambda self: self.env.company)
|
||||
journal_id = fields.Many2one(
|
||||
comodel_name='account.journal',
|
||||
compute='_compute_accounting_values',
|
||||
inverse='_inverse_revaluation_journal',
|
||||
compute_sudo=True,
|
||||
domain=[('type', '=', 'general')],
|
||||
required=True,
|
||||
readonly=False,
|
||||
)
|
||||
date = fields.Date(default=lambda self: self.env.context['multicurrency_revaluation_report_options']['date']['date_to'], required=True)
|
||||
reversal_date = fields.Date(required=True)
|
||||
expense_provision_account_id = fields.Many2one(
|
||||
comodel_name='account.account',
|
||||
compute='_compute_accounting_values',
|
||||
inverse='_inverse_expense_provision_account',
|
||||
compute_sudo=True,
|
||||
string="Expense Account",
|
||||
required=True,
|
||||
readonly=False,
|
||||
)
|
||||
income_provision_account_id = fields.Many2one(
|
||||
comodel_name='account.account',
|
||||
compute='_compute_accounting_values',
|
||||
inverse='_inverse_income_provision_account',
|
||||
compute_sudo=True,
|
||||
string="Income Account",
|
||||
required=True,
|
||||
readonly=False,
|
||||
)
|
||||
preview_data = fields.Text(compute='_compute_preview_data')
|
||||
show_warning_move_id = fields.Many2one('account.move', compute='_compute_show_warning')
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields):
|
||||
rec = super().default_get(fields)
|
||||
if 'reversal_date' in fields:
|
||||
report_options = self.env.context['multicurrency_revaluation_report_options']
|
||||
rec['reversal_date'] = Date.to_date(report_options['date']['date_to']) + relativedelta(days=1)
|
||||
if not self.env.context.get('revaluation_no_loop') and not self.with_context(revaluation_no_loop=True)._get_move_vals()['line_ids']:
|
||||
raise UserError(_("No adjustment needed"))
|
||||
return rec
|
||||
|
||||
@api.depends('expense_provision_account_id', 'income_provision_account_id', 'reversal_date')
|
||||
def _compute_show_warning(self):
|
||||
for record in self:
|
||||
last_move = self.env['account.move.line'].search([
|
||||
('account_id', 'in', (record.expense_provision_account_id + record.income_provision_account_id).ids),
|
||||
('date', '<', record.reversal_date),
|
||||
], order='date desc', limit=1).move_id
|
||||
record.show_warning_move_id = False if last_move.reversed_entry_id else last_move
|
||||
|
||||
@api.depends('expense_provision_account_id', 'income_provision_account_id', 'date', 'journal_id')
|
||||
def _compute_preview_data(self):
|
||||
preview_columns = [
|
||||
{'field': 'account_id', 'label': _("Account")},
|
||||
{'field': 'name', 'label': _("Label")},
|
||||
{'field': 'debit', 'label': _("Debit"), 'class': 'text-end text-nowrap'},
|
||||
{'field': 'credit', 'label': _("Credit"), 'class': 'text-end text-nowrap'},
|
||||
]
|
||||
for record in self:
|
||||
preview_vals = [self.env['account.move']._move_dict_to_preview_vals(
|
||||
self._get_move_vals(),
|
||||
record.company_id.currency_id)
|
||||
]
|
||||
record.preview_data = json.dumps({
|
||||
'groups_vals': preview_vals,
|
||||
'options': {
|
||||
'columns': preview_columns,
|
||||
},
|
||||
})
|
||||
|
||||
@api.depends('company_id')
|
||||
def _compute_accounting_values(self):
|
||||
for record in self:
|
||||
record.journal_id = record.company_id.account_revaluation_journal_id
|
||||
record.expense_provision_account_id = record.company_id.account_revaluation_expense_provision_account_id
|
||||
record.income_provision_account_id = record.company_id.account_revaluation_income_provision_account_id
|
||||
|
||||
def _inverse_revaluation_journal(self):
|
||||
for record in self:
|
||||
record.company_id.sudo().account_revaluation_journal_id = record.journal_id
|
||||
|
||||
def _inverse_expense_provision_account(self):
|
||||
for record in self:
|
||||
record.company_id.sudo().account_revaluation_expense_provision_account_id = record.expense_provision_account_id
|
||||
|
||||
def _inverse_income_provision_account(self):
|
||||
for record in self:
|
||||
record.company_id.sudo().account_revaluation_income_provision_account_id = record.income_provision_account_id
|
||||
|
||||
@api.model
|
||||
def _get_move_vals(self):
|
||||
def _get_model_id(parsed_line, selected_model):
|
||||
for _dummy, parsed_res_model, parsed_res_id in parsed_line:
|
||||
if parsed_res_model == selected_model:
|
||||
return parsed_res_id
|
||||
|
||||
def _get_adjustment_balance(line):
|
||||
for column in line.columns:
|
||||
if column.expression_label == 'adjustment':
|
||||
return column.no_format
|
||||
|
||||
report = self.env.ref('account_reports.multicurrency_revaluation_report')
|
||||
included_line_id = report.line_ids.filtered(lambda l: l.code == 'multicurrency_included').id
|
||||
generic_included_line_id = report._get_generic_line_id('account.report.line', included_line_id)
|
||||
options = {**self.env.context['multicurrency_revaluation_report_options'], 'unfold_all': True}
|
||||
report_lines = report._get_lines(options)
|
||||
move_lines = []
|
||||
|
||||
for report_line in report._get_unfolded_lines(report_lines, generic_included_line_id):
|
||||
parsed_line_id = report._parse_line_id(report_line.id)
|
||||
balance = _get_adjustment_balance(report_line)
|
||||
# parsed_line_id[-1][-2] corresponds to res_model of the current line
|
||||
if (
|
||||
parsed_line_id[-1][-2] == 'account.account'
|
||||
and not self.env.company.currency_id.is_zero(balance)
|
||||
):
|
||||
account_id = _get_model_id(parsed_line_id, 'account.account')
|
||||
currency_id = _get_model_id(parsed_line_id, 'res.currency')
|
||||
move_lines.append(Command.create({
|
||||
'name': _(
|
||||
"Provision for %(for_cur)s (1 %(comp_cur)s = %(rate)s %(for_cur)s)",
|
||||
for_cur=self.env['res.currency'].browse(currency_id).display_name,
|
||||
comp_cur=self.env.company.currency_id.display_name,
|
||||
rate=options['currency_rates'][str(currency_id)]['rate']
|
||||
),
|
||||
'debit': balance if balance > 0 else 0,
|
||||
'credit': -balance if balance < 0 else 0,
|
||||
'amount_currency': 0,
|
||||
'currency_id': currency_id,
|
||||
'account_id': account_id,
|
||||
}))
|
||||
if balance < 0:
|
||||
move_line_name = _("Expense Provision for %s", self.env['res.currency'].browse(currency_id).display_name)
|
||||
else:
|
||||
move_line_name = _("Income Provision for %s", self.env['res.currency'].browse(currency_id).display_name)
|
||||
move_lines.append(Command.create({
|
||||
'name': move_line_name,
|
||||
'debit': -balance if balance < 0 else 0,
|
||||
'credit': balance if balance > 0 else 0,
|
||||
'amount_currency': 0,
|
||||
'currency_id': currency_id,
|
||||
'account_id': self.expense_provision_account_id.id if balance < 0 else self.income_provision_account_id.id,
|
||||
}))
|
||||
|
||||
return {
|
||||
'ref': _("Foreign currencies adjustment entry as of %s", format_date(self.env, self.date)),
|
||||
'journal_id': self.journal_id.id,
|
||||
'date': self.date,
|
||||
'line_ids': move_lines,
|
||||
}
|
||||
|
||||
def create_entries(self):
|
||||
self.ensure_one()
|
||||
move_vals = self._get_move_vals()
|
||||
if move_vals['line_ids']:
|
||||
move = self.env['account.move'].with_context(skip_invoice_sync=True).create(move_vals)
|
||||
move.action_post()
|
||||
reverse_move = move._reverse_moves(default_values_list=[{
|
||||
'ref': _("Reversal of: %s", move.ref),
|
||||
}])
|
||||
reverse_move.date = self.reversal_date
|
||||
reverse_move.action_post()
|
||||
|
||||
form = self.env.ref('account.view_move_form', False)
|
||||
ctx = self.env.context.copy()
|
||||
ctx.pop('id', '')
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': "account.move",
|
||||
'res_id': move.id,
|
||||
'view_mode': "form",
|
||||
'view_id': form.id,
|
||||
'views': [(form.id, 'form')],
|
||||
'context': ctx,
|
||||
}
|
||||
raise UserError(_("No provision needed was found."))
|
||||
31
account_reports/wizard/multicurrency_revaluation.xml
Normal file
31
account_reports/wizard/multicurrency_revaluation.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="view_account_multicurrency_revaluation_wizard" model="ir.ui.view">
|
||||
<field name="name">account.multicurrency.revaluation.wizard.view</field>
|
||||
<field name="model">account.multicurrency.revaluation.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Make Adjustment Entry">
|
||||
<field name="company_id" invisible="1"/>
|
||||
<div invisible="not show_warning_move_id" class="alert alert-warning" role="alert">Proceed with caution as there might be an existing adjustment for this period (<field name="show_warning_move_id"/>)</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="journal_id"/>
|
||||
<field name="expense_provision_account_id"/>
|
||||
<field name="income_provision_account_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="date"/>
|
||||
<field name="reversal_date"/>
|
||||
</group>
|
||||
</group>
|
||||
<field name="preview_data" widget="grouped_view_widget"/>
|
||||
<footer>
|
||||
<button string='Create Entry' name="create_entries" type="object" class="btn-primary" data-hotkey="q"/>
|
||||
<button class="btn-secondary" special="cancel" data-hotkey="x"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
60
account_reports/wizard/qr_code_payment_wizard.py
Normal file
60
account_reports/wizard/qr_code_payment_wizard.py
Normal file
@@ -0,0 +1,60 @@
|
||||
from markupsafe import Markup
|
||||
from lxml import html
|
||||
|
||||
from odoo import api, models, fields, _
|
||||
|
||||
|
||||
class QRCodePaymentWizard(models.TransientModel):
|
||||
_name = "qr.code.payment.wizard"
|
||||
_inherit = ["account.return.payment.wizard"]
|
||||
_description = "Generic Payment Wizard with QR Code"
|
||||
|
||||
qr_code = fields.Html(compute='_compute_qr_code')
|
||||
show_warning_missing_vat_number = fields.Boolean(compute='_compute_show_warning_missing_vat_number')
|
||||
|
||||
@api.depends('company_id.vat')
|
||||
def _compute_show_warning_missing_vat_number(self):
|
||||
for wizard in self:
|
||||
wizard.show_warning_missing_vat_number = not bool(wizard.company_id.vat)
|
||||
|
||||
@api.depends('partner_bank_id', 'communication', 'amount_to_pay')
|
||||
def _compute_qr_code(self):
|
||||
for wizard in self:
|
||||
qr_html = False
|
||||
if wizard.partner_bank_id and not wizard.is_recoverable and wizard.communication:
|
||||
b64_qr = wizard.partner_bank_id.build_qr_code_base64(
|
||||
amount=wizard.amount_to_pay,
|
||||
free_communication=wizard.communication,
|
||||
structured_communication=wizard.communication,
|
||||
currency=wizard.currency_id,
|
||||
debtor_partner=wizard.partner_id,
|
||||
)
|
||||
if b64_qr:
|
||||
txt = _('Scan me with your banking app.')
|
||||
qr_html = Markup("""
|
||||
<div class="text-center">
|
||||
<img src="{b64_qr}"/>
|
||||
<p><strong>{txt}</strong></p>
|
||||
</div>
|
||||
""").format(b64_qr=b64_qr, txt=txt)
|
||||
wizard.qr_code = qr_html
|
||||
|
||||
def _get_b64_qr_data(self):
|
||||
self.ensure_one()
|
||||
b64_qr = False
|
||||
if self.qr_code:
|
||||
tree = html.fromstring(self.qr_code)
|
||||
if src_list := tree.xpath('//img/@src'):
|
||||
b64_qr = src_list[0]
|
||||
return b64_qr
|
||||
|
||||
def action_open_company_configuration_wizard(self):
|
||||
self.ensure_one()
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': self.env._('Set your company data'),
|
||||
'res_model': 'res.company',
|
||||
'res_id': self.company_id.id,
|
||||
'views': [(self.env.ref('account.res_company_form_view_onboarding').id, "form")],
|
||||
'target': 'new',
|
||||
}
|
||||
126
account_reports/wizard/report_export_wizard.py
Normal file
126
account_reports/wizard/report_export_wizard.py
Normal file
@@ -0,0 +1,126 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import base64
|
||||
import json
|
||||
import types
|
||||
from urllib.parse import parse_qs, urlparse
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class Account_ReportsExportWizard(models.TransientModel):
|
||||
""" Wizard allowing to export an accounting report in several different formats
|
||||
at once, saving them as attachments.
|
||||
"""
|
||||
_name = 'account_reports.export.wizard'
|
||||
_description = "Export wizard for accounting's reports"
|
||||
|
||||
export_format_ids = fields.Many2many(string="Export to", comodel_name='account_reports.export.wizard.format', relation="dms_acc_rep_export_wizard_format_rel")
|
||||
report_id = fields.Many2one(string="Parent Report Id", comodel_name='account.report', required=True)
|
||||
doc_name = fields.Char(string="Documents Name", help="Name to give to the generated documents.")
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
wizards = super().create(vals_list)
|
||||
for wizard in wizards:
|
||||
wizard.doc_name = wizard.report_id.name
|
||||
|
||||
# We create one export format object per available export type of the report,
|
||||
# with the right generation function associated to it.
|
||||
# This is done so to allow selecting them as Many2many tags in the wizard.
|
||||
for button_dict in self.env.context.get('account_report_generation_options', {}).get('buttons', []):
|
||||
if button_dict.get('file_export_type'):
|
||||
self.env['account_reports.export.wizard.format'].create({
|
||||
'name': button_dict['file_export_type'],
|
||||
'fun_to_call': button_dict['action'],
|
||||
'fun_param': button_dict.get('action_param'),
|
||||
'export_wizard_id': wizard.id,
|
||||
})
|
||||
return wizards
|
||||
|
||||
def export_report(self):
|
||||
self.ensure_one()
|
||||
created_attachments = self.env['ir.attachment']
|
||||
for vals in self._get_attachments_to_save():
|
||||
created_attachments |= self.env['ir.attachment'].create(vals)
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': _('Generated Documents'),
|
||||
'view_mode': 'kanban,form',
|
||||
'res_model': 'ir.attachment',
|
||||
'domain': [('id', 'in', created_attachments.ids)],
|
||||
}
|
||||
|
||||
def _get_attachments_to_save(self):
|
||||
self.ensure_one()
|
||||
to_create_attachments = []
|
||||
report_options = self.env.context['account_report_generation_options']
|
||||
for format in self.export_format_ids:
|
||||
# format.fun_to_call is a button function, so it has to be public
|
||||
report_action = self.report_id.dispatch_report_action(
|
||||
options={**report_options, 'report_id': self.report_id.id},
|
||||
action=format.fun_to_call,
|
||||
action_param=format.fun_param or None,
|
||||
)
|
||||
to_create_attachments.append(format.apply_export(report_action))
|
||||
|
||||
return to_create_attachments
|
||||
|
||||
|
||||
class Account_ReportsExportWizardFormat(models.TransientModel):
|
||||
_name = 'account_reports.export.wizard.format'
|
||||
_description = "Export format for accounting's reports"
|
||||
|
||||
name = fields.Char(string="Name", required=True)
|
||||
fun_to_call = fields.Char(string="Function to Call", required=True)
|
||||
fun_param = fields.Char(string="Function Parameter")
|
||||
export_wizard_id = fields.Many2one(string="Parent Wizard", comodel_name='account_reports.export.wizard', required=True, ondelete='cascade')
|
||||
|
||||
def apply_export(self, report_action):
|
||||
self.ensure_one()
|
||||
|
||||
if report_action['type'] == 'ir_actions_account_report_download':
|
||||
# file_generator functions are always public for ir_actions_account_report_download
|
||||
report_options = json.loads(report_action['data']['options'])
|
||||
file_generator = report_action['data']['file_generator']
|
||||
report = self.export_wizard_id.report_id
|
||||
report_options['report_id'] = report.id
|
||||
export_result = report.dispatch_report_action(report_options, file_generator)
|
||||
|
||||
# We use the options from the action, as the action may have added or modified
|
||||
# stuff into them (see l10n_es_reports, with BOE wizard)
|
||||
file_content = export_result['file_content']
|
||||
if isinstance(file_content, str):
|
||||
file_content = file_content.encode()
|
||||
elif isinstance(file_content, types.GeneratorType):
|
||||
file_content = b''.join(file_content)
|
||||
else:
|
||||
# just to validate that we have bytes
|
||||
file_content = bytes(file_content)
|
||||
file_name = f"{self.export_wizard_id.doc_name or self.export_wizard_id.report_id.name}.{export_result['file_type']}"
|
||||
mimetype = self.export_wizard_id.report_id.get_export_mime_type(export_result['file_type'])
|
||||
|
||||
elif report_action['type'] == 'ir.actions.act_url':
|
||||
query_params = parse_qs(urlparse(report_action['url']).query)
|
||||
model = query_params['model'][0]
|
||||
model_id = int(query_params['id'][0])
|
||||
wizard = self.env[model].browse(model_id)
|
||||
file_name = wizard[query_params['filename_field'][0]]
|
||||
file_content = base64.b64decode(wizard[query_params['field'][0]])
|
||||
mimetype = self.env['account.report'].get_export_mime_type(file_name.split('.')[-1])
|
||||
|
||||
else:
|
||||
raise UserError(_("One of the formats chosen can not be exported in the DMS"))
|
||||
|
||||
return self.get_attachment_vals(file_name, file_content, mimetype, report_options)
|
||||
|
||||
def get_attachment_vals(self, file_name, file_content, mimetype, log_options_dict):
|
||||
self.ensure_one()
|
||||
return {
|
||||
'name': file_name,
|
||||
'company_id': self.env.company.id,
|
||||
'raw': file_content,
|
||||
'mimetype': mimetype,
|
||||
'description': json.dumps(log_options_dict)
|
||||
}
|
||||
27
account_reports/wizard/report_export_wizard.xml
Normal file
27
account_reports/wizard/report_export_wizard.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<record id="view_report_export_wizard" model="ir.ui.view">
|
||||
<field name="name">account_reports.export.wizard.form</field>
|
||||
<field name="model">account_reports.export.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Export">
|
||||
<group>
|
||||
<field name="export_format_ids" widget="many2many_tags" options="{'no_create': True}" domain="[('export_wizard_id', '=', id)]" required="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<group>
|
||||
<field name="doc_name" required="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Export" class="btn-primary" type="object" name="export_report" data-hotkey="q"/>
|
||||
<button class="btn-secondary" special="cancel" data-hotkey="x"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
205
account_reports/wizard/return_creation_wizard.py
Normal file
205
account_reports/wizard/return_creation_wizard.py
Normal file
@@ -0,0 +1,205 @@
|
||||
from collections import defaultdict
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from odoo import api, models, fields
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountReturnCreationWizard(models.TransientModel):
|
||||
_name = "account.return.creation.wizard"
|
||||
_description = "Return creation wizard"
|
||||
|
||||
company_id = fields.Many2one(
|
||||
comodel_name='res.company',
|
||||
required=True,
|
||||
readonly=True,
|
||||
default=lambda self: self.env.company,
|
||||
)
|
||||
category = fields.Selection(
|
||||
selection=[
|
||||
('account_return', "Tax Return"),
|
||||
('audit', "Audit"),
|
||||
],
|
||||
default='account_return',
|
||||
)
|
||||
available_return_type_ids = fields.Many2many(
|
||||
string="Available Return Type",
|
||||
comodel_name='account.return.type',
|
||||
compute='_compute_available_return_type',
|
||||
)
|
||||
return_type_id = fields.Many2one(
|
||||
string="Return Type",
|
||||
comodel_name='account.return.type',
|
||||
required=True,
|
||||
compute="_compute_return_type_id",
|
||||
readonly=False,
|
||||
store=True,
|
||||
domain="[('id', 'in', available_return_type_ids)]",
|
||||
)
|
||||
date_from = fields.Date(string="Date From", required=True)
|
||||
date_to = fields.Date(string="Date To", required=True)
|
||||
show_warning_wrong_dates = fields.Boolean(compute='_compute_warnings')
|
||||
show_warning_existing_return = fields.Boolean(compute='_compute_warnings')
|
||||
show_warning_overlap = fields.Boolean(compute='_compute_warnings')
|
||||
is_create_disabled = fields.Boolean(compute='_compute_is_create_disabled')
|
||||
cycle_ids = fields.Many2many(
|
||||
comodel_name='account.return.audit.cycle',
|
||||
string="Cycles",
|
||||
compute='_compute_cycle_ids',
|
||||
store=True,
|
||||
readonly=False,
|
||||
)
|
||||
|
||||
@api.depends('category')
|
||||
def _compute_cycle_ids(self):
|
||||
for wizard in self:
|
||||
if wizard.category == 'audit':
|
||||
wizard.cycle_ids = self.env['account.return.audit.cycle'].search([])
|
||||
else:
|
||||
wizard.cycle_ids = False
|
||||
|
||||
@api.depends('available_return_type_ids')
|
||||
def _compute_return_type_id(self):
|
||||
for wizard in self:
|
||||
if self.available_return_type_ids and not self.return_type_id:
|
||||
wizard.return_type_id = wizard.available_return_type_ids[0]
|
||||
else:
|
||||
wizard.return_type_id = False
|
||||
|
||||
@api.depends('show_warning_existing_return', 'show_warning_overlap', 'date_from', 'return_type_id', 'date_to')
|
||||
def _compute_is_create_disabled(self):
|
||||
for wizard in self:
|
||||
wizard.is_create_disabled = not wizard.return_type_id or not wizard.date_from or not wizard.date_to or wizard.show_warning_existing_return or wizard.show_warning_overlap
|
||||
|
||||
@api.onchange('return_type_id')
|
||||
def _onchange_return_type_id(self):
|
||||
today = fields.Date.context_today(self)
|
||||
if self.return_type_id:
|
||||
period_months = self.return_type_id._get_periodicity_months_delay(self.company_id, date=self.date_from)
|
||||
shifted_date = today - relativedelta(months=period_months)
|
||||
self.date_from, self.date_to = self.return_type_id._get_period_boundaries(self.company_id, shifted_date)
|
||||
else:
|
||||
self.date_from = self.date_to = False
|
||||
|
||||
@api.depends('category')
|
||||
def _compute_available_return_type(self):
|
||||
return_type_by_country_and_category = self.env['account.return.type']._read_group(
|
||||
domain=[],
|
||||
groupby=['country_id', 'category'],
|
||||
aggregates=['id:recordset'],
|
||||
)
|
||||
country_return_type_map = defaultdict(
|
||||
lambda: defaultdict(lambda: self.env['account.return.type']))
|
||||
|
||||
for country, category, returns in return_type_by_country_and_category:
|
||||
country_return_type_map[country][category] |= returns
|
||||
|
||||
generic_tax_report = self.env.ref('account.generic_tax_report')
|
||||
|
||||
for wizard in self:
|
||||
# For the company country, takes all the return types
|
||||
wizard_country_return_types = country_return_type_map[wizard.company_id.account_fiscal_country_id][wizard.category]
|
||||
|
||||
# For the foreign fiscal positions, takes only the VAT return types
|
||||
foreign_vat_fpos_countries = self.env['account.fiscal.position'].search([
|
||||
*self.env['account.fiscal.position']._check_company_domain(wizard.company_id),
|
||||
('foreign_vat', '!=', False),
|
||||
]).mapped('country_id')
|
||||
|
||||
foreign_return_types = self.env['account.return.type']
|
||||
for foreign_country in foreign_vat_fpos_countries:
|
||||
foreign_return_types |= country_return_type_map[foreign_country][wizard.category].filtered(lambda rt: rt.report_id.root_report_id == generic_tax_report)
|
||||
|
||||
# Finally, includes the return types not linked to any country
|
||||
return_types_without_country = country_return_type_map[self.env['res.country']][wizard.category]
|
||||
|
||||
# remove the generic tax report return type if company country tax return type available
|
||||
has_current_country_tax_return_type = wizard_country_return_types.filtered(lambda rt: rt.report_id.root_report_id == generic_tax_report)
|
||||
if has_current_country_tax_return_type:
|
||||
return_types_without_country = return_types_without_country.filtered(lambda rt: rt.report_id != generic_tax_report)
|
||||
|
||||
wizard.available_return_type_ids = wizard_country_return_types + foreign_return_types + return_types_without_country
|
||||
|
||||
@api.depends('date_from', 'date_to', 'return_type_id')
|
||||
def _compute_warnings(self):
|
||||
for wizard in self:
|
||||
returns_companies_map = {
|
||||
(date_from, date_to, tuple(type_ids.ids)): returns.mapped('company_ids')
|
||||
for date_from, date_to, type_ids, returns in self.env['account.return']._read_group(
|
||||
domain=[('company_ids', 'in', wizard.company_id.id)],
|
||||
groupby=['date_from:day', 'date_to:day', 'type_id'],
|
||||
aggregates=['id:recordset'],
|
||||
)
|
||||
}
|
||||
|
||||
wizard.show_warning_wrong_dates = False
|
||||
wizard.show_warning_existing_return = False
|
||||
wizard.show_warning_overlap = False
|
||||
|
||||
if not wizard.date_from or not wizard.date_to or not wizard.return_type_id or wizard.category == 'audit':
|
||||
continue
|
||||
|
||||
# ensures date_from and date_to are correctly set regarding return type boundaries
|
||||
date_pointer = wizard.date_from
|
||||
first_period = True
|
||||
|
||||
while date_pointer <= wizard.date_to:
|
||||
period_start, period_end = wizard.return_type_id._get_period_boundaries(wizard.company_id, date_pointer)
|
||||
|
||||
if first_period and wizard.date_from != period_start:
|
||||
wizard.show_warning_wrong_dates = True
|
||||
|
||||
# Find returns that are overlapping this date
|
||||
for return_start, return_end, _type_ids in filter(lambda key: wizard.return_type_id.ids[0] in key[2], returns_companies_map.keys()): # wizard.return_type_id.ids[0] because id can be NewId
|
||||
if wizard.date_from == return_start and wizard.date_to == return_end:
|
||||
wizard.show_warning_existing_return = True
|
||||
elif (return_start <= wizard.date_from <= return_end) or (return_start <= wizard.date_to <= return_end):
|
||||
wizard.show_warning_overlap = True
|
||||
|
||||
date_pointer = period_end + relativedelta(days=1)
|
||||
first_period = False
|
||||
|
||||
# Validate the last period ends exactly at date_to
|
||||
if date_pointer - relativedelta(days=1) != wizard.date_to:
|
||||
wizard.show_warning_wrong_dates = True
|
||||
|
||||
if wizard.show_warning_existing_return:
|
||||
wizard.show_warning_overlap = False
|
||||
|
||||
def action_create_manual_account_returns(self):
|
||||
self.ensure_one()
|
||||
|
||||
if self.show_warning_wrong_dates and not self.env.context.get('force_periodicity_violation'):
|
||||
raise UserError(self.env._("The selected range doesn't match any fiscal period."))
|
||||
|
||||
if self.show_warning_existing_return:
|
||||
raise UserError(self.env._("A return already exists for the selected period."))
|
||||
|
||||
all_branch_companies_with_same_vat = self.company_id._get_branches_with_same_vat()
|
||||
root_company = sorted(all_branch_companies_with_same_vat, key=lambda comp: len(comp.parent_path.split('/')))[0]
|
||||
tax_unit = self.env['account.tax.unit'].sudo().search([('company_ids', 'in', root_company.ids)], limit=1)
|
||||
apply_tax_unit = tax_unit and self.return_type_id.report_id.filter_multi_company == 'tax_units'
|
||||
company = tax_unit.main_company_id if apply_tax_unit else root_company
|
||||
if not company.has_access('read'):
|
||||
raise UserError(self.env._("You are trying to create returns for a company you don't have access to, please select it in the company selector"))
|
||||
|
||||
returns_created = self.return_type_id.with_context(
|
||||
forced_date_from=fields.Date.to_string(self.date_from),
|
||||
forced_date_to=fields.Date.to_string(self.date_to),
|
||||
manually_created=True,
|
||||
force_periodicity_violation=self.env.context.get('force_periodicity_violation', self.category == 'audit'),
|
||||
)._try_create_returns_for_fiscal_year(company, tax_unit, allow_duplicates=not self.show_warning_existing_return, bypass_period_check=True)
|
||||
returns_created.cycle_ids = self.cycle_ids
|
||||
returns_created.refresh_checks()
|
||||
if len(returns_created) == 1:
|
||||
action = returns_created[0].action_open_account_return() if self.category == 'account_return' else returns_created[0].action_open_audit_return()
|
||||
|
||||
return {
|
||||
'type': 'ir.actions.client',
|
||||
'tag': 'action_return_close_wizard',
|
||||
'params': {
|
||||
'next_action': action
|
||||
}
|
||||
}
|
||||
|
||||
return True
|
||||
48
account_reports/wizard/return_creation_wizard.xml
Normal file
48
account_reports/wizard/return_creation_wizard.xml
Normal file
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="return_creation_wizard_form" model="ir.ui.view">
|
||||
<field name="name">account.return.creation.wizard.form</field>
|
||||
<field name="model">account.return.creation.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Generate Return">
|
||||
<div class="alert alert-info" role="alert" invisible="not show_warning_wrong_dates">
|
||||
The selected range doesn't match any fiscal period.
|
||||
</div>
|
||||
<group>
|
||||
<field name="available_return_type_ids" invisible="1"/>
|
||||
<field name="return_type_id" required="1" widget="badges_many2one" class="w-100"/>
|
||||
<label for="date_from" string="Dates"/>
|
||||
<div class="d-flex align-items-center col-10 col-lg-6">
|
||||
<field name="date_to" invisible="1"/>
|
||||
<field name="date_from" nolabel="1"
|
||||
widget="daterange" options="{'end_date_field': 'date_to'}"/>
|
||||
<span
|
||||
invisible="not show_warning_existing_return"
|
||||
class="oi text-danger pb-2"
|
||||
data-icon="warning"
|
||||
title="A return already exists for the selected period."
|
||||
/>
|
||||
<span
|
||||
invisible="not show_warning_overlap"
|
||||
class="oi text-danger pb-2"
|
||||
data-icon="warning"
|
||||
title="Another return already covers part of this period."
|
||||
/>
|
||||
</div>
|
||||
</group>
|
||||
<group invisible="category != 'audit'">
|
||||
<field name="cycle_ids" widget="many2many_tags" options="{'no_open': True, 'no_create': True}"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Generate Return" name="action_create_manual_account_returns" type="object" class="btn-primary" data-hotkey="q" disabled="1"
|
||||
invisible="not is_create_disabled"/>
|
||||
<button string="Generate Return" name="action_create_manual_account_returns" type="object" class="btn-primary" data-hotkey="q"
|
||||
invisible="is_create_disabled or show_warning_wrong_dates"/>
|
||||
<button string="Generate Return Anyway" name="action_create_manual_account_returns" type="object" class="btn-primary" data-hotkey="q"
|
||||
invisible="is_create_disabled or not show_warning_wrong_dates" context="{'force_periodicity_violation': 1}"/>
|
||||
<button class="btn-secondary" special="cancel" data-hotkey="x"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
98
account_reports/wizard/return_generic_payment_wizard.py
Normal file
98
account_reports/wizard/return_generic_payment_wizard.py
Normal file
@@ -0,0 +1,98 @@
|
||||
from odoo import api, models, fields
|
||||
|
||||
|
||||
class AccountReturnGenericPaymentWizard(models.TransientModel):
|
||||
_name = "account.return.payment.wizard"
|
||||
_description = "Returns Generic Payment Wizard"
|
||||
|
||||
company_id = fields.Many2one(comodel_name='res.company', string="Company")
|
||||
partner_id = fields.Many2one(comodel_name='res.partner', related='partner_bank_id.partner_id')
|
||||
account_number = fields.Char(string="IBAN", related='partner_bank_id.account_number')
|
||||
partner_bank_id = fields.Many2one(comodel_name='res.partner.bank')
|
||||
communication = fields.Char(compute='_compute_communication')
|
||||
|
||||
show_vat_balance = fields.Boolean(compute="_compute_show_vat_balance")
|
||||
amount_to_pay = fields.Monetary(compute='_compute_amount_to_pay', store=True)
|
||||
vat_balance = fields.Monetary(compute='_compute_vat_balance')
|
||||
is_recovered = fields.Boolean(string="Does this payment recover previous recoverable amounts")
|
||||
is_recoverable = fields.Boolean(compute='_compute_is_recoverable', readonly=False)
|
||||
currency_id = fields.Many2one(comodel_name='res.currency', related='return_id.amount_to_pay_currency_id')
|
||||
return_id = fields.Many2one(comodel_name='account.return', required=True)
|
||||
|
||||
def _generate_communication(self):
|
||||
return False
|
||||
|
||||
@api.depends('vat_balance', 'amount_to_pay', 'currency_id')
|
||||
def _compute_show_vat_balance(self):
|
||||
for wizard in self:
|
||||
wizard.show_vat_balance = wizard.currency_id.compare_amounts(wizard.amount_to_pay, wizard.vat_balance) != 0
|
||||
|
||||
@api.depends('return_id')
|
||||
def _compute_amount_to_pay(self):
|
||||
for wizard in self:
|
||||
wizard.amount_to_pay = wizard.return_id.period_amount_to_pay
|
||||
|
||||
@api.depends('return_id')
|
||||
def _compute_vat_balance(self):
|
||||
for wizard in self:
|
||||
receivable_account = wizard.return_id._get_tax_closing_payable_and_receivable_accounts()[1]
|
||||
wizard.vat_balance = wizard.return_id._evaluate_total_amount_to_pay_from_tax_closing_accounts(receivable_account)
|
||||
|
||||
@api.depends('amount_to_pay')
|
||||
def _compute_is_recoverable(self):
|
||||
for wizard in self:
|
||||
result = wizard.currency_id.compare_amounts(wizard.amount_to_pay, 0)
|
||||
wizard.is_recoverable = result == -1 or result == 0
|
||||
|
||||
@api.depends('company_id')
|
||||
def _compute_communication(self):
|
||||
for wizard in self:
|
||||
wizard.communication = wizard._generate_communication()
|
||||
|
||||
def action_mark_as_paid(self):
|
||||
self.ensure_one()
|
||||
if self.is_recovered:
|
||||
payable_accounts, receivable_accounts = self.return_id._get_tax_closing_payable_and_receivable_accounts()
|
||||
|
||||
receivable_lines_by_company = dict(
|
||||
self.env['account.move.line']._read_group(
|
||||
[
|
||||
('date', '<=', self.return_id.date_to),
|
||||
('account_id', 'in', receivable_accounts.ids),
|
||||
('company_id', 'in', self.return_id.company_ids.ids),
|
||||
('move_id.state', '=', 'posted'),
|
||||
('reconciled', '=', False),
|
||||
],
|
||||
groupby=['company_id'],
|
||||
aggregates=['id:recordset'],
|
||||
)
|
||||
)
|
||||
|
||||
for closing_entry in self.return_id.closing_move_ids:
|
||||
company = closing_entry.company_id
|
||||
if company in receivable_lines_by_company:
|
||||
receivable_lines_to_reconcile = receivable_lines_by_company[company]
|
||||
payable_lines = closing_entry.line_ids.filtered(lambda line: line.account_id.id in payable_accounts.ids)
|
||||
wizard = self.env['account.reconcile.wizard'].with_context(
|
||||
active_model='account.move.line',
|
||||
active_ids=[*receivable_lines_to_reconcile.ids, *payable_lines.ids],
|
||||
).new({})
|
||||
wizard.allow_partials = True
|
||||
wizard.reconcile()
|
||||
|
||||
# Re assign the most recent computes value to ensure it stays coherent
|
||||
self.return_id.total_amount_to_pay = self.vat_balance
|
||||
|
||||
return self.return_id._action_finalize_payment()
|
||||
|
||||
def action_send_email_instructions(self):
|
||||
self.ensure_one()
|
||||
template = self.env.ref('account_reports.email_template_generic_tax_instructions', raise_if_not_found=False)
|
||||
return self.return_id.action_send_email_instructions(self, template)
|
||||
|
||||
def action_deduct_receivable_amount(self):
|
||||
self.ensure_one()
|
||||
if not self.show_vat_balance:
|
||||
return
|
||||
self.is_recovered = True
|
||||
self.amount_to_pay = max(self.vat_balance, 0)
|
||||
26
account_reports/wizard/return_generic_payment_wizard.xml
Normal file
26
account_reports/wizard/return_generic_payment_wizard.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="return_generic_payment_wizard_form" model="ir.ui.view">
|
||||
<field name="name">account.return.payment.wizard.form</field>
|
||||
<field name="model">account.return.payment.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Pay">
|
||||
<div class="alert alert-info p-1 ps-3 d-flex align-items-center" invisible="not show_vat_balance" role="alert">
|
||||
The VAT balance is <field class="oe_inline fw-bold mx-1" name="vat_balance"/> due to prior VAT credit.
|
||||
<widget name="account_return_wizard_button" call="action_deduct_receivable_amount" class="d-inline mx-1" btn_class="btn btn-link btn-group p-0" string="Click here"/> to pay this amount.
|
||||
</div>
|
||||
<h2>
|
||||
<group>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
<field name="amount_to_pay" readonly="1"/>
|
||||
</group>
|
||||
</h2>
|
||||
<footer>
|
||||
<button name="action_mark_as_paid" string="Mark Paid" type="object" class="btn-primary" data-hotkey="q"/>
|
||||
<button name="action_send_email_instructions" string="Send" type="object" class="btn-secondary" data-hotkey="s"/>
|
||||
<button class="btn-secondary" special="cancel" data-hotkey="x"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
41
account_reports/wizard/return_submission_wizard.py
Normal file
41
account_reports/wizard/return_submission_wizard.py
Normal file
@@ -0,0 +1,41 @@
|
||||
import json
|
||||
|
||||
from odoo import _, api, models, fields
|
||||
|
||||
|
||||
class AccountReturnSubmissionWizard(models.TransientModel):
|
||||
_name = "account.return.submission.wizard"
|
||||
_description = "Return submission wizard"
|
||||
|
||||
instructions = fields.Html(string="Instructions")
|
||||
return_id = fields.Many2one(comodel_name='account.return', required=True)
|
||||
|
||||
def action_proceed_with_submission(self):
|
||||
self.ensure_one()
|
||||
return self.return_id._proceed_with_submission()
|
||||
|
||||
@api.model
|
||||
def _open_submission_wizard(self, account_return, instructions=None):
|
||||
record_action = self.create({
|
||||
'instructions': instructions,
|
||||
'return_id': account_return.id if account_return else None,
|
||||
})._get_records_action(target='new')
|
||||
|
||||
record_action['name'] = _("Submit")
|
||||
record_action.setdefault('context', {})
|
||||
record_action['context'] |= {
|
||||
'dialog_size': 'large',
|
||||
}
|
||||
return record_action
|
||||
|
||||
def print_pdf(self):
|
||||
options = self.return_id._get_closing_report_options()
|
||||
return {
|
||||
'type': 'ir_actions_account_report_download',
|
||||
'data': {
|
||||
'model': self.env.context.get('model'),
|
||||
'options': json.dumps(options),
|
||||
'file_generator': 'export_to_pdf',
|
||||
'no_closing_after_download': True,
|
||||
},
|
||||
}
|
||||
18
account_reports/wizard/return_submission_wizard.xml
Normal file
18
account_reports/wizard/return_submission_wizard.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="return_submission_wizard_form" model="ir.ui.view">
|
||||
<field name="name">account.return.submission.wizard.form</field>
|
||||
<field name="model">account.return.submission.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Submit">
|
||||
<sheet>
|
||||
<field name="instructions" nolabel="1" readonly="1"/>
|
||||
</sheet>
|
||||
<footer>
|
||||
<button string='Mark as Submitted' name="action_proceed_with_submission" type="object" class="btn-primary" data-hotkey="q"/>
|
||||
<button class="btn-secondary" special="cancel" data-hotkey="x"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user