[15.0][FIX] excel_import_export, excel_import_export_demo:
fix from PR #2283 together with @luc-demeyer suggestion https://github.com/OCA/server-tools/pull/2283#pullrequestreview-881026019pull/2505/head
parent
2661e58c9c
commit
7c29aceed0
|
@ -334,7 +334,7 @@ def _add_id_column(file_txt):
|
|||
if line and i == 0:
|
||||
line = '"id",' + line
|
||||
elif line:
|
||||
line = "{}.{}".format("xls", uuid.uuid4()) + "," + line
|
||||
line = f"__excel_import_export__.{uuid.uuid4()},{line}"
|
||||
txt_lines.append(line)
|
||||
i += 1
|
||||
file_txt = "\n".join(txt_lines)
|
||||
|
|
|
@ -38,5 +38,4 @@ class ReportAction(models.Model):
|
|||
("report_type", "in", qwebtypes),
|
||||
("report_name", "=", report_name),
|
||||
]
|
||||
context = self.env["res.users"].context_get()
|
||||
return report_obj.with_context(context=context).search(conditions, limit=1)
|
||||
return report_obj.search(conditions, limit=1)
|
||||
|
|
|
@ -50,7 +50,7 @@ class XLSXImport(models.AbstractModel):
|
|||
ModelData.create(
|
||||
{
|
||||
"name": "{}_{}".format(record._table, record.id),
|
||||
"module": "excel_import_export",
|
||||
"module": "__excel_import_export__",
|
||||
"model": record._name,
|
||||
"res_id": record.id,
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ class XLSXImport(models.AbstractModel):
|
|||
xml_id = (
|
||||
record
|
||||
and self.get_external_id(record)
|
||||
or "{}.{}".format("xls", uuid.uuid4())
|
||||
or "{}.{}".format("__excel_import_export__", uuid.uuid4())
|
||||
)
|
||||
out_st.write(0, 0, "id") # id and xml_id on first column
|
||||
out_st.write(1, 0, xml_id)
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
# Copyright 2019 Ecosoft Co., Ltd (http://ecosoft.co.th/)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
|
||||
|
||||
import logging
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
from odoo.exceptions import RedirectWarning, ValidationError
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ImportXLSXWizard(models.TransientModel):
|
||||
"""This wizard is used with the template (xlsx.template) to import
|
||||
|
@ -102,8 +98,11 @@ class ImportXLSXWizard(models.TransientModel):
|
|||
if not template.datas:
|
||||
act = self.env.ref("excel_import_export.action_xlsx_template")
|
||||
raise RedirectWarning(
|
||||
_('File "%(fname)s" not found in template, %(name)s.')
|
||||
% {"fname": template.fname, "name": template.name},
|
||||
_(
|
||||
'File "%(fname)s" not found in template, %(name)s.',
|
||||
fname=template.fname,
|
||||
name=template.name,
|
||||
),
|
||||
act.id,
|
||||
_("Set Templates"),
|
||||
)
|
||||
|
|
|
@ -7,9 +7,10 @@
|
|||
<field name="report_type">excel</field>
|
||||
<field name="report_name">sale_order_form.xlsx</field>
|
||||
<field name="report_file">sale_order</field>
|
||||
<field name="binding_model_id" ref="sale.model_sale_order" />
|
||||
<field name="binding_type">report</field>
|
||||
<field
|
||||
name="print_report_name"
|
||||
>(object.state in ('draft', 'sent') and 'Quotation - %s' % (object.name)) or 'Order - %s' % (object.name)</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
|
|
@ -4,8 +4,8 @@ dataclasses
|
|||
mako
|
||||
odoorpc
|
||||
openpyxl
|
||||
xlrd
|
||||
xlwt
|
||||
openupgradelib
|
||||
pysftp
|
||||
sentry_sdk
|
||||
xlrd
|
||||
xlwt
|
||||
|
|
Loading…
Reference in New Issue