mirror of
https://github.com/bringout/oca-ocb-accounting.git
synced 2026-04-22 00:42:01 +02:00
19.0 vanilla
This commit is contained in:
parent
ba20ce7443
commit
768b70e05e
2357 changed files with 1057103 additions and 712486 deletions
|
|
@ -1,6 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import onboarding
|
||||
from . import portal
|
||||
from . import terms
|
||||
from . import download_docs
|
||||
from . import tests_shared_js_python
|
||||
from . import catalog
|
||||
|
|
|
|||
67
odoo-bringout-oca-ocb-account/account/controllers/catalog.py
Normal file
67
odoo-bringout-oca-ocb-account/account/controllers/catalog.py
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo.http import request, route
|
||||
|
||||
from odoo.addons.product.controllers.catalog import ProductCatalogController
|
||||
|
||||
|
||||
class ProductCatalogAccountController(ProductCatalogController):
|
||||
|
||||
@route('/product/catalog/get_sections', auth='user', type='jsonrpc', readonly=True)
|
||||
def product_catalog_get_sections(self, res_model, order_id, child_field, **kwargs):
|
||||
"""Return the sections which are in given order to be shown in the product catalog.
|
||||
|
||||
:param string res_model: The order model.
|
||||
:param int order_id: The order id.
|
||||
:param string child_field: The field name of the lines in the order model.
|
||||
:rtype: list
|
||||
:return: A list of dictionaries containing section information with following structure:
|
||||
[
|
||||
{
|
||||
'id': int,
|
||||
'name': string,
|
||||
'sequence': int,
|
||||
'line_count': int,
|
||||
},
|
||||
]
|
||||
"""
|
||||
order = request.env[res_model].browse(order_id)
|
||||
return order.with_company(order.company_id)._get_sections(child_field, **kwargs)
|
||||
|
||||
@route('/product/catalog/create_section', auth='user', type='jsonrpc')
|
||||
def product_catalog_create_section(
|
||||
self, res_model, order_id, child_field, name, position, **kwargs,
|
||||
):
|
||||
"""Create a new section on the given order.
|
||||
|
||||
:param string res_model: The order model.
|
||||
:param int order_id: The order id.
|
||||
:param string child_field: The field name of the lines in the order model.
|
||||
:param string name: The name of the section to create.
|
||||
:param str position: The position of the section where it should be created, either 'top'
|
||||
or 'bottom'.
|
||||
:return: A dictionary with newly created section's 'id' and 'sequence'.
|
||||
:rtype: dict
|
||||
"""
|
||||
order = request.env[res_model].browse(order_id)
|
||||
return order.with_company(order.company_id)._create_section(
|
||||
child_field, name, position, **kwargs,
|
||||
)
|
||||
|
||||
@route('/product/catalog/resequence_sections', auth='user', type='jsonrpc')
|
||||
def product_catalog_resequence_sections(
|
||||
self, res_model, order_id, sections, child_field, **kwargs,
|
||||
):
|
||||
"""Reorder the sections of a given order.
|
||||
|
||||
param string res_model: The order model.
|
||||
:param int order_id: The order id.
|
||||
:param list sections: A list of section dictionaries with their sequence.
|
||||
:param string child_field: The field name of the lines in the order model.
|
||||
:return: A dictionary with new sequences of the sections.
|
||||
:rtype: dict
|
||||
"""
|
||||
order = request.env[res_model].browse(order_id)
|
||||
return order.with_company(order.company_id)._resequence_sections(
|
||||
sections, child_field, **kwargs,
|
||||
)
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
import io
|
||||
import zipfile
|
||||
|
||||
from itertools import chain
|
||||
|
||||
from odoo import http, _
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.http import request, content_disposition
|
||||
|
||||
|
||||
def _get_headers(filename, filetype, content):
|
||||
return [
|
||||
('Content-Type', filetype),
|
||||
('Content-Length', len(content)),
|
||||
('Content-Disposition', content_disposition(filename)),
|
||||
('X-Content-Type-Options', 'nosniff'),
|
||||
]
|
||||
|
||||
|
||||
def _build_zip_from_data(docs_data):
|
||||
buffer = io.BytesIO()
|
||||
with zipfile.ZipFile(buffer, 'w', compression=zipfile.ZIP_DEFLATED) as zipfile_obj:
|
||||
for doc_data in docs_data:
|
||||
zipfile_obj.writestr(doc_data['filename'], doc_data['content'])
|
||||
return buffer.getvalue()
|
||||
|
||||
|
||||
class AccountDocumentDownloadController(http.Controller):
|
||||
|
||||
@http.route('/account/download_invoice_attachments/<models("ir.attachment"):attachments>', type='http', auth='user')
|
||||
def download_invoice_attachments(self, attachments):
|
||||
attachments.check_access('read')
|
||||
assert all(attachment.res_id and attachment.res_model == 'account.move' for attachment in attachments)
|
||||
if len(attachments) == 1:
|
||||
headers = _get_headers(attachments.name, attachments.mimetype, attachments.raw)
|
||||
return request.make_response(attachments.raw, headers)
|
||||
else:
|
||||
inv_ids = attachments.mapped('res_id')
|
||||
if len(set(inv_ids)) == 1:
|
||||
invoice = request.env['account.move'].browse(inv_ids[0])
|
||||
filename = invoice._get_invoice_report_filename(extension='zip')
|
||||
else:
|
||||
filename = _('invoices') + '.zip'
|
||||
content = attachments._build_zip_from_attachments()
|
||||
headers = _get_headers(filename, 'zip', content)
|
||||
return request.make_response(content, headers)
|
||||
|
||||
@http.route('/account/download_invoice_documents/<models("account.move"):invoices>/<string:filetype>', type='http', auth='user')
|
||||
def download_invoice_documents_filetype(self, invoices, filetype, allow_fallback=True):
|
||||
invoices.check_access('read')
|
||||
invoices.line_ids.check_access('read')
|
||||
docs_data = []
|
||||
for invoice in invoices:
|
||||
if filetype == 'all' and (doc_data := invoice._get_invoice_legal_documents_all(allow_fallback=allow_fallback)):
|
||||
docs_data += doc_data
|
||||
elif doc_data := invoice._get_invoice_legal_documents(filetype, allow_fallback=allow_fallback):
|
||||
if (errors := doc_data.get('errors')) and len(invoices) == 1:
|
||||
raise UserError(_("Error while creating XML:\n- %s", '\n- '.join(errors)))
|
||||
docs_data.append(doc_data)
|
||||
if len(docs_data) == 1:
|
||||
doc_data = docs_data[0]
|
||||
headers = _get_headers(doc_data['filename'], doc_data['filetype'], doc_data['content'])
|
||||
return request.make_response(doc_data['content'], headers)
|
||||
if len(docs_data) > 1:
|
||||
zip_content = _build_zip_from_data(docs_data)
|
||||
headers = _get_headers(_('invoices') + '.zip', 'zip', zip_content)
|
||||
return request.make_response(zip_content, headers)
|
||||
|
||||
@http.route('/account/download_move_attachments/<models("account.move"):moves>', type='http', auth='user')
|
||||
def download_move_attachments(self, moves):
|
||||
|
||||
def rename_duplicates(docs):
|
||||
seen = {}
|
||||
for doc in docs:
|
||||
name = doc["filename"]
|
||||
if name not in seen:
|
||||
seen[name] = 0
|
||||
else:
|
||||
seen[name] += 1
|
||||
base, *ext = name.rsplit('.', 1)
|
||||
new_name = f"{base} ({seen[name]})" + (f".{ext[0]}" if ext else "")
|
||||
doc["filename"] = new_name
|
||||
seen[new_name] = 0
|
||||
return docs
|
||||
|
||||
if docs_data := list(chain.from_iterable(move._get_move_zip_export_docs() for move in moves)):
|
||||
docs_data = rename_duplicates(docs_data)
|
||||
zip_content = _build_zip_from_data(docs_data)
|
||||
headers = _get_headers(request.env._("Invoices") + '.zip', 'zip', zip_content)
|
||||
return request.make_response(zip_content, headers)
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
from odoo import http
|
||||
from odoo.http import request
|
||||
|
||||
|
||||
class OnboardingController(http.Controller):
|
||||
|
||||
@http.route('/account/account_invoice_onboarding', auth='user', type='json')
|
||||
def account_invoice_onboarding(self):
|
||||
""" Returns the `banner` for the account invoice onboarding panel.
|
||||
It can be empty if the user has closed it or if he doesn't have
|
||||
the permission to see it. """
|
||||
|
||||
company = request.env.company
|
||||
if not request.env.is_admin() or \
|
||||
company.account_invoice_onboarding_state == 'closed':
|
||||
return {}
|
||||
|
||||
return {
|
||||
'html': request.env['ir.qweb']._render('account.account_invoice_onboarding_panel', {
|
||||
'company': company,
|
||||
'state': company.get_and_update_account_invoice_onboarding_state()
|
||||
})
|
||||
}
|
||||
|
||||
@http.route('/account/account_dashboard_onboarding', auth='user', type='json')
|
||||
def account_dashboard_onboarding(self):
|
||||
""" Returns the `banner` for the account dashboard onboarding panel.
|
||||
It can be empty if the user has closed it or if he doesn't have
|
||||
the permission to see it. """
|
||||
company = request.env.company
|
||||
|
||||
if not request.env.is_admin() or \
|
||||
company.account_dashboard_onboarding_state == 'closed':
|
||||
return {}
|
||||
|
||||
return {
|
||||
'html': request.env['ir.qweb']._render('account.account_dashboard_onboarding_panel', {
|
||||
'company': company,
|
||||
'state': company.get_and_update_account_dashboard_onboarding_state()
|
||||
})
|
||||
}
|
||||
|
|
@ -1,37 +1,69 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import http, _
|
||||
from odoo.osv import expression
|
||||
from odoo.addons.portal.controllers.portal import CustomerPortal, pager as portal_pager
|
||||
from odoo.exceptions import AccessError, MissingError
|
||||
from collections import OrderedDict
|
||||
|
||||
from odoo import _, fields, http
|
||||
from odoo.exceptions import AccessError, MissingError
|
||||
from odoo.fields import Domain
|
||||
from odoo.http import request
|
||||
from odoo.tools import email_normalize, email_normalize_all
|
||||
from odoo.tools.misc import verify_hash_signed
|
||||
|
||||
from odoo.addons.account.controllers.download_docs import _build_zip_from_data, _get_headers
|
||||
from odoo.addons.portal.controllers.portal import CustomerPortal
|
||||
from odoo.addons.portal.controllers.portal import pager as portal_pager
|
||||
|
||||
|
||||
class PortalAccount(CustomerPortal):
|
||||
|
||||
def _prepare_home_portal_values(self, counters):
|
||||
values = super()._prepare_home_portal_values(counters)
|
||||
if 'overdue_invoice_count' in counters:
|
||||
values['overdue_invoice_count'] = self._get_overdue_invoice_count()
|
||||
if 'invoice_count' in counters:
|
||||
invoice_count = request.env['account.move'].search_count(self._get_invoices_domain()) \
|
||||
if request.env['account.move'].check_access_rights('read', raise_exception=False) else 0
|
||||
invoice_count = request.env['account.move'].search_count(self._get_invoices_domain('out'), limit=1) \
|
||||
if request.env['account.move'].has_access('read') else 0
|
||||
values['invoice_count'] = invoice_count
|
||||
if 'bill_count' in counters:
|
||||
bill_count = request.env['account.move'].search_count(self._get_invoices_domain('in'), limit=1) \
|
||||
if request.env['account.move'].has_access('read') else 0
|
||||
values['bill_count'] = bill_count
|
||||
return values
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# My Invoices
|
||||
# ------------------------------------------------------------
|
||||
|
||||
def _get_overdue_invoice_count(self):
|
||||
overdue_invoice_count = request.env['account.move'].search_count(self._get_overdue_invoices_domain()) \
|
||||
if request.env['account.move'].has_access('read') else 0
|
||||
return overdue_invoice_count
|
||||
|
||||
def _invoice_get_page_view_values(self, invoice, access_token, **kwargs):
|
||||
custom_amount = None
|
||||
if kwargs.get('amount'):
|
||||
custom_amount = float(kwargs['amount'])
|
||||
values = {
|
||||
'page_name': 'invoice',
|
||||
'invoice': invoice,
|
||||
**invoice._get_invoice_portal_extra_values(custom_amount=custom_amount),
|
||||
}
|
||||
return self._get_page_view_values(invoice, access_token, values, 'my_invoices_history', False, **kwargs)
|
||||
|
||||
def _get_invoices_domain(self):
|
||||
return [('state', 'not in', ('cancel', 'draft')), ('move_type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]
|
||||
def _get_invoices_domain(self, m_type=None):
|
||||
if m_type in ['in', 'out']:
|
||||
move_type = [m_type+move for move in ('_invoice', '_refund', '_receipt')]
|
||||
else:
|
||||
move_type = ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')
|
||||
return Domain('state', 'not in', ('cancel', 'draft')) & Domain('move_type', 'in', move_type)
|
||||
|
||||
def _get_overdue_invoices_domain(self, partner_id=None):
|
||||
return [
|
||||
('state', 'not in', ('cancel', 'draft')),
|
||||
('move_type', 'in', ('out_invoice', 'out_receipt')),
|
||||
('payment_state', 'not in', ('in_payment', 'paid', 'reversed', 'blocked', 'invoicing_legacy')),
|
||||
('invoice_date_due', '<', fields.Date.today()),
|
||||
('partner_id', '=', partner_id or request.env.user.partner_id.id),
|
||||
]
|
||||
|
||||
def _get_account_searchbar_sortings(self):
|
||||
return {
|
||||
|
|
@ -44,8 +76,9 @@ class PortalAccount(CustomerPortal):
|
|||
def _get_account_searchbar_filters(self):
|
||||
return {
|
||||
'all': {'label': _('All'), 'domain': []},
|
||||
'invoices': {'label': _('Invoices'), 'domain': [('move_type', 'in', ('out_invoice', 'out_refund'))]},
|
||||
'bills': {'label': _('Bills'), 'domain': [('move_type', 'in', ('in_invoice', 'in_refund'))]},
|
||||
'overdue_invoices': {'label': _('Overdue invoices'), 'domain': self._get_overdue_invoices_domain()},
|
||||
'invoices': {'label': _('Invoices'), 'domain': [('move_type', 'in', ('out_invoice', 'out_refund', 'out_receipt'))]},
|
||||
'bills': {'label': _('Bills'), 'domain': [('move_type', 'in', ('in_invoice', 'in_refund', 'in_receipt'))]},
|
||||
}
|
||||
|
||||
@http.route(['/my/invoices', '/my/invoices/page/<int:page>'], type='http', auth="user", website=True)
|
||||
|
|
@ -57,7 +90,7 @@ class PortalAccount(CustomerPortal):
|
|||
|
||||
# content according to pager and archive selected
|
||||
invoices = values['invoices'](pager['offset'])
|
||||
request.session['my_invoices_history'] = invoices.ids[:100]
|
||||
request.session['my_invoices_history'] = [i['invoice'].id for i in invoices][:100]
|
||||
|
||||
values.update({
|
||||
'invoices': invoices,
|
||||
|
|
@ -69,10 +102,7 @@ class PortalAccount(CustomerPortal):
|
|||
values = self._prepare_portal_layout_values()
|
||||
AccountInvoice = request.env['account.move']
|
||||
|
||||
domain = expression.AND([
|
||||
domain or [],
|
||||
self._get_invoices_domain(),
|
||||
])
|
||||
domain = Domain(domain or Domain.TRUE) & self._get_invoices_domain()
|
||||
|
||||
searchbar_sortings = self._get_account_searchbar_sortings()
|
||||
# default sort by order
|
||||
|
|
@ -94,15 +124,20 @@ class PortalAccount(CustomerPortal):
|
|||
# content according to pager and archive selected
|
||||
# lambda function to get the invoices recordset when the pager will be defined in the main method of a route
|
||||
'invoices': lambda pager_offset: (
|
||||
AccountInvoice.search(domain, order=order, limit=self._items_per_page, offset=pager_offset)
|
||||
if AccountInvoice.check_access_rights('read', raise_exception=False) else
|
||||
[
|
||||
invoice._get_invoice_portal_extra_values()
|
||||
for invoice in AccountInvoice.search(
|
||||
domain, order=order, limit=self._items_per_page, offset=pager_offset
|
||||
)
|
||||
]
|
||||
if AccountInvoice.has_access('read') else
|
||||
AccountInvoice
|
||||
),
|
||||
'page_name': 'invoice',
|
||||
'pager': { # vals to define the pager.
|
||||
"url": url,
|
||||
"url_args": {'date_begin': date_begin, 'date_end': date_end, 'sortby': sortby},
|
||||
"total": AccountInvoice.search_count(domain) if AccountInvoice.check_access_rights('read', raise_exception=False) else 0,
|
||||
"url_args": {'date_begin': date_begin, 'date_end': date_end, 'sortby': sortby, 'filterby': filterby},
|
||||
"total": AccountInvoice.search_count(domain) if AccountInvoice.has_access('read') else 0,
|
||||
"page": page,
|
||||
"step": self._items_per_page,
|
||||
},
|
||||
|
|
@ -111,6 +146,7 @@ class PortalAccount(CustomerPortal):
|
|||
'sortby': sortby,
|
||||
'searchbar_filters': OrderedDict(sorted(searchbar_filters.items())),
|
||||
'filterby': filterby,
|
||||
'overdue_invoice_count': self._get_overdue_invoice_count(),
|
||||
})
|
||||
return values
|
||||
|
||||
|
|
@ -121,37 +157,81 @@ class PortalAccount(CustomerPortal):
|
|||
except (AccessError, MissingError):
|
||||
return request.redirect('/my')
|
||||
|
||||
if report_type in ('html', 'pdf', 'text'):
|
||||
return self._show_report(model=invoice_sudo, report_type=report_type, report_ref='account.account_invoices', download=download)
|
||||
if report_type == 'pdf' and download and invoice_sudo.state == 'posted':
|
||||
# Download the official attachment(s) or a Pro Forma invoice
|
||||
docs_data = invoice_sudo._get_invoice_legal_documents_all(allow_fallback=True)
|
||||
if len(docs_data) == 1:
|
||||
headers = self._get_http_headers(invoice_sudo, report_type, docs_data[0]['content'], download)
|
||||
return request.make_response(docs_data[0]['content'], list(headers.items()))
|
||||
else:
|
||||
filename = invoice_sudo._get_invoice_report_filename(extension='zip')
|
||||
zip_content = _build_zip_from_data(docs_data)
|
||||
headers = _get_headers(filename, 'zip', zip_content)
|
||||
return request.make_response(zip_content, headers)
|
||||
|
||||
elif report_type in ('html', 'pdf', 'text'):
|
||||
has_generated_invoice = bool(invoice_sudo.invoice_pdf_report_id)
|
||||
request.update_context(proforma_invoice=not has_generated_invoice)
|
||||
# Use the template set on the related partner if there is.
|
||||
# This is not perfect as the invoice can still have been computed with another template, but it's a slight fix/imp for stable.
|
||||
pdf_report_name = invoice_sudo.partner_id.invoice_template_pdf_report_id.report_name or 'account.account_invoices'
|
||||
return self._show_report(model=invoice_sudo, report_type=report_type, report_ref=pdf_report_name, download=download)
|
||||
|
||||
values = self._invoice_get_page_view_values(invoice_sudo, access_token, **kw)
|
||||
return request.render("account.portal_invoice_page", values)
|
||||
|
||||
@http.route(['/my/journal/<int:journal_id>/unsubscribe'], type='http', auth="public", methods=['GET', 'POST'], website=True)
|
||||
def portal_my_journal_unsubscribe(self, journal_id, **kw):
|
||||
def _render(ctx, status=200):
|
||||
return request.render('account.portal_my_journal_mail_notifications', ctx, status=status)
|
||||
|
||||
if access_token := kw.get('token'):
|
||||
try:
|
||||
token_data = verify_hash_signed(request.env(su=True), request.env['account.journal']._get_journal_notification_unsubscribe_scope(), access_token)
|
||||
except ValueError:
|
||||
return _render({'error': _('Invalid token')}, 403)
|
||||
if not token_data or token_data.get('journal_id') != journal_id:
|
||||
return _render({'error': _('Invalid token')}, 403)
|
||||
journal = request.env['account.journal'].sudo().browse(journal_id)
|
||||
else:
|
||||
# Legacy link for authenticated user trying to unsubscribe (needs access rights on journal)
|
||||
journal = request.env['account.journal'].browse(journal_id)
|
||||
|
||||
if access_token:
|
||||
email_to_unsubscribe = email_normalize(token_data.get('email_to_unsubscribe'), strict=False)
|
||||
else:
|
||||
emails = email_normalize_all(journal.incoming_einvoice_notification_email or '')
|
||||
if len(emails) != 1:
|
||||
return _render({'error': _('Deprecated link')}, 410)
|
||||
email_to_unsubscribe = emails[0]
|
||||
|
||||
if not journal.exists() or not email_to_unsubscribe:
|
||||
return _render({'error': _('Already unsubscribed')}, 404)
|
||||
|
||||
if not journal.has_access('write'):
|
||||
return _render({'error': _('Invalid token')}, 403)
|
||||
|
||||
journal = journal.with_company(journal.sudo().company_id.id)
|
||||
|
||||
all_recipients = email_normalize_all(journal.incoming_einvoice_notification_email or '')
|
||||
email_found = any(r == email_to_unsubscribe for r in all_recipients)
|
||||
|
||||
if not email_found:
|
||||
return _render({'error': _('Already unsubscribed')}, 404)
|
||||
|
||||
if request.httprequest.method == 'POST':
|
||||
journal._unsubscribe_invoice_notification_email(email_to_unsubscribe)
|
||||
return _render({'journal': journal, 'email': email_to_unsubscribe, 'completed': True})
|
||||
|
||||
return _render({'journal': journal, 'email': email_to_unsubscribe})
|
||||
# ------------------------------------------------------------
|
||||
# My Home
|
||||
# ------------------------------------------------------------
|
||||
|
||||
def details_form_validate(self, data, partner_creation=False):
|
||||
error, error_message = super(PortalAccount, self).details_form_validate(data)
|
||||
# prevent VAT/name change if invoices exist
|
||||
partner = request.env['res.users'].browse(request.uid).partner_id
|
||||
# Skip this test if we're creating a new partner as we won't ever block him from filling values.
|
||||
if not partner_creation and not partner.can_edit_vat():
|
||||
if 'vat' in data and (data['vat'] or False) != (partner.vat or False):
|
||||
error['vat'] = 'error'
|
||||
error_message.append(_('Changing VAT number is not allowed once invoices have been issued for your account. Please contact us directly for this operation.'))
|
||||
if 'name' in data and (data['name'] or False) != (partner.name or False):
|
||||
error['name'] = 'error'
|
||||
error_message.append(_('Changing your name is not allowed once invoices have been issued for your account. Please contact us directly for this operation.'))
|
||||
if 'company_name' in data and (data['company_name'] or False) != (partner.company_name or False):
|
||||
error['company_name'] = 'error'
|
||||
error_message.append(_('Changing your company name is not allowed once invoices have been issued for your account. Please contact us directly for this operation.'))
|
||||
return error, error_message
|
||||
|
||||
def extra_details_form_validate(self, data, additional_required_fields, error, error_message):
|
||||
""" Ensure that all additional required fields have a value in the data """
|
||||
for field in additional_required_fields:
|
||||
if field.name not in data or not data[field.name]:
|
||||
error[field.name] = 'error'
|
||||
error_message.append(_('The field %s must be filled.', field.field_description.lower()))
|
||||
return error, error_message
|
||||
def _prepare_my_account_rendering_values(self, *args, **kwargs):
|
||||
rendering_values = super()._prepare_my_account_rendering_values(*args, **kwargs)
|
||||
rendering_values.update({
|
||||
'invoice_sending_methods': {'email': _("by Email")},
|
||||
'invoice_edi_formats': dict(request.env['res.partner']._fields['invoice_edi_format'].selection),
|
||||
})
|
||||
return rendering_values
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
import json
|
||||
|
||||
from odoo import http
|
||||
from odoo.http import request
|
||||
|
||||
|
||||
class TestsSharedJsPython(http.Controller):
|
||||
|
||||
@http.route('/account/init_tests_shared_js_python', type='http', auth='user', website=True)
|
||||
def route_init_tests_shared_js_python(self):
|
||||
tests = json.loads(request.env['ir.config_parameter'].get_param('account.tests_shared_js_python', '[]'))
|
||||
return request.render('account.tests_shared_js_python', {'props': {'tests': tests}})
|
||||
|
||||
@http.route('/account/post_tests_shared_js_python', type='jsonrpc', auth='user')
|
||||
def route_post_tests_shared_js_python(self, results):
|
||||
request.env['ir.config_parameter'].set_param('account.tests_shared_js_python', json.dumps(results or []))
|
||||
Loading…
Add table
Add a link
Reference in a new issue