mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
125
report_label/README.rst
Normal file
125
report_label/README.rst
Normal file
@@ -0,0 +1,125 @@
|
||||
=============
|
||||
Report Labels
|
||||
=============
|
||||
|
||||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||
:target: https://odoo-community.org/page/development-status
|
||||
:alt: Beta
|
||||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
|
||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github
|
||||
:target: https://github.com/OCA/reporting-engine/tree/14.0/report_label
|
||||
:alt: OCA/reporting-engine
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/reporting-engine-14-0/reporting-engine-14-0-report_label
|
||||
:alt: Translate me on Weblate
|
||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||
:target: https://runbot.odoo-community.org/runbot/143/14.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
This module allows you to create self-adhesive label printing actions on any model.
|
||||
|
||||
**Table of contents**
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Go to **Settings > Technical > Analysis > Label Paper Format** and create
|
||||
your self-adhesive label paper formats.
|
||||
|
||||
.. image:: https://raw.githubusercontent.com/OCA/reporting-engine/14.0/report_label/static/description/configure_paperformat.png
|
||||
|
||||
Go to **Settings > Technical > Analysis > Label Report** and create your label
|
||||
report, and its context action. You'll also need to create or reuse a
|
||||
QWeb template for you label.
|
||||
|
||||
.. image:: https://raw.githubusercontent.com/OCA/reporting-engine/14.0/report_label/static/description/configure_report_label.png
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
1. In the target model's tree view, select the records to print.
|
||||
2. Click *Action* and your label report action name.
|
||||
3. Select the number of labels per record to print, and click Print.
|
||||
|
||||
.. image:: https://raw.githubusercontent.com/OCA/reporting-engine/14.0/report_label/static/description/label_wizard.png
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
Known issues:
|
||||
|
||||
* `wkhtmltopdf` doesn't always respect dpi, and mm measures don't match. For
|
||||
this matter, it's recommended to use this module along with
|
||||
`report_wkhtmltopdf_param` and enable `--disable-smart-shrinking`.
|
||||
|
||||
* This module depends on `base_automation` only because this module extends
|
||||
`ir.actions.server` with a new kind of action, and `base.automation` inherits
|
||||
from `ir.actions.server` by delegation in such a way that the modules cannot
|
||||
be loaded in another order.
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/reporting-engine/issues>`_.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||
`feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_label%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
Do not contact contributors directly about support or help with technical issues.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Authors
|
||||
~~~~~~~
|
||||
|
||||
* Iván Todorovich
|
||||
* Moka Tourisme
|
||||
|
||||
Contributors
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* Iván Todorovich <ivan.todorovich@gmail.com>
|
||||
* `Moka Tourisme <https://www.mokatourisme.fr>`_:
|
||||
|
||||
* Grégory Schreiner
|
||||
|
||||
* Sylvain LE GAL <https://twitter.com/legalsylvain>
|
||||
* Stefan Rijnhart <stefan@opener.amsterdam>
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
|
||||
This module is maintained by the OCA.
|
||||
|
||||
.. image:: https://odoo-community.org/logo.png
|
||||
:alt: Odoo Community Association
|
||||
:target: https://odoo-community.org
|
||||
|
||||
OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.
|
||||
|
||||
.. |maintainer-ivantodorovich| image:: https://github.com/ivantodorovich.png?size=40px
|
||||
:target: https://github.com/ivantodorovich
|
||||
:alt: ivantodorovich
|
||||
|
||||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
||||
|
||||
|maintainer-ivantodorovich|
|
||||
|
||||
This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/14.0/report_label>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
2
report_label/__init__.py
Normal file
2
report_label/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import models
|
||||
from . import wizards
|
||||
25
report_label/__manifest__.py
Normal file
25
report_label/__manifest__.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
{
|
||||
"name": "Report Labels",
|
||||
"version": "14.0.1.0.0",
|
||||
"summary": "Print configurable self-adhesive labels reports",
|
||||
"author": "Iván Todorovich, Moka Tourisme, Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/reporting-engine",
|
||||
"license": "AGPL-3",
|
||||
"category": "Reporting",
|
||||
"maintainers": ["ivantodorovich"],
|
||||
"depends": [
|
||||
"base_automation",
|
||||
],
|
||||
"data": [
|
||||
"security/ir.model.access.csv",
|
||||
"data/paperformat_label.xml",
|
||||
"views/ir_actions_server.xml",
|
||||
"views/report_paperformat_label.xml",
|
||||
"reports/report_label.xml",
|
||||
"wizards/report_label_wizard.xml",
|
||||
],
|
||||
"demo": [
|
||||
"demo/demo.xml",
|
||||
],
|
||||
}
|
||||
27
report_label/data/paperformat_label.xml
Normal file
27
report_label/data/paperformat_label.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
|
||||
<record id="agipa_114016" model="report.paperformat.label">
|
||||
<field name="name">Label: Agipa 114016</field>
|
||||
<field name="format">A5</field>
|
||||
<field name="orientation">Portrait</field>
|
||||
<field name="margin_top" eval="5" />
|
||||
<field name="margin_right" eval="13" />
|
||||
<field name="margin_bottom" eval="0" />
|
||||
<field name="margin_left" eval="13" />
|
||||
<field name="dpi" eval="82" />
|
||||
<field name="label_width" eval="38" />
|
||||
<field name="label_height" eval="19" />
|
||||
<field name="label_padding_top" eval="1" />
|
||||
<field name="label_padding_right" eval="1" />
|
||||
<field name="label_padding_bottom" eval="1" />
|
||||
<field name="label_padding_left" eval="1" />
|
||||
<field name="label_margin_top" eval="1" />
|
||||
<field name="label_margin_right" eval="1" />
|
||||
<field name="label_margin_bottom" eval="1" />
|
||||
<field name="label_margin_left" eval="1" />
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
43
report_label/demo/demo.xml
Normal file
43
report_label/demo/demo.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
|
||||
<template id="label_template_partner_address" name="Partner Label: Address">
|
||||
<address
|
||||
t-field="record.self"
|
||||
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'
|
||||
/>
|
||||
</template>
|
||||
|
||||
<record
|
||||
id="report_paperformat_label_partner_address"
|
||||
model="report.paperformat.label"
|
||||
>
|
||||
<field name="name">Partner Label</field>
|
||||
<field name="format">A4</field>
|
||||
<field name="label_height" eval="42.3" />
|
||||
<field name="label_width" eval="60" />
|
||||
<field name="label_padding_top" eval="5" />
|
||||
<field name="label_padding_right" eval="5" />
|
||||
<field name="label_padding_bottom" eval="5" />
|
||||
<field name="label_padding_left" eval="5" />
|
||||
</record>
|
||||
|
||||
<record id="actions_server_label_partner_address" model="ir.actions.server">
|
||||
<field name="name">Print Address Labels</field>
|
||||
<field name="state">report_label</field>
|
||||
<field name="model_id" ref="base.model_res_partner" />
|
||||
<field
|
||||
name="label_paperformat_id"
|
||||
ref="report_paperformat_label_partner_address"
|
||||
/>
|
||||
<field name="label_template">report_label.label_template_partner_address</field>
|
||||
</record>
|
||||
|
||||
<!-- Create context action -->
|
||||
<function
|
||||
model="ir.actions.server"
|
||||
eval="[ref('actions_server_label_partner_address')]"
|
||||
name="create_action"
|
||||
/>
|
||||
|
||||
</odoo>
|
||||
521
report_label/i18n/report_label.pot
Normal file
521
report_label/i18n/report_label.pot
Normal file
@@ -0,0 +1,521 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * report_label
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 12.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_ir_actions_server__state
|
||||
#: model:ir.model.fields,field_description:report_label.field_ir_cron__state
|
||||
msgid "Action To Do"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: selection:ir.actions.server,state:0
|
||||
msgid "Add Followers"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__report_ids
|
||||
msgid "Associated reports"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.paperformat_label_view_form
|
||||
msgid "Bottom (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__margin_bottom
|
||||
msgid "Bottom Margin (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.report_label_wizard_view_form
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: selection:ir.actions.server,state:0
|
||||
msgid "Create Next Activity"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: selection:ir.actions.server,state:0
|
||||
msgid "Create a new Record"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard__create_uid
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard_line__create_uid
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__create_uid
|
||||
msgid "Created by"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard__create_date
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard_line__create_date
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__create_date
|
||||
msgid "Created on"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__default
|
||||
msgid "Default paper format ?"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard__display_name
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard_line__display_name
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__display_name
|
||||
msgid "Display Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.view_server_action_form
|
||||
msgid "Display a button in the sidebar of related model to open a wizard"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__header_line
|
||||
msgid "Display a header line"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: selection:ir.actions.server,state:0
|
||||
msgid "Execute Python Code"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: selection:ir.actions.server,state:0
|
||||
msgid "Execute several actions"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,help:report_label.field_report_paperformat_label__report_ids
|
||||
msgid "Explicitly associated reports"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__header_spacing
|
||||
msgid "Header spacing"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard__id
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard_line__id
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__label_height
|
||||
msgid "Label Height (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.paperformat_label_view_form
|
||||
msgid "Label Margin"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__label_margin_bottom
|
||||
msgid "Label Margin Bottom (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__label_margin_left
|
||||
msgid "Label Margin Left (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__label_margin_right
|
||||
msgid "Label Margin Right (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__label_margin_top
|
||||
msgid "Label Margin Top (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.paperformat_label_view_form
|
||||
msgid "Label Padding"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__label_padding_bottom
|
||||
msgid "Label Padding Bottom (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__label_padding_left
|
||||
msgid "Label Padding Left (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__label_padding_right
|
||||
msgid "Label Padding Right (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__label_padding_top
|
||||
msgid "Label Padding Top (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model,name:report_label.model_report_paperformat_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_ir_actions_server__label_paperformat_id
|
||||
#: model:ir.model.fields,field_description:report_label.field_ir_cron__label_paperformat_id
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard__label_paperformat_id
|
||||
msgid "Label Paper Format"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.ui.menu,name:report_label.paperformat_label_menu
|
||||
msgid "Label Paper Formats"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_ir_actions_server__label_template
|
||||
#: model:ir.model.fields,field_description:report_label.field_ir_cron__label_template
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard__label_template
|
||||
msgid "Label QWeb Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.actions.report,name:report_label.report_label
|
||||
msgid "Label Report"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.actions.act_window,name:report_label.report_label_action
|
||||
#: model:ir.ui.menu,name:report_label.report_label_menu
|
||||
msgid "Label Reports"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.paperformat_label_view_form
|
||||
msgid "Label Size"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__label_width
|
||||
msgid "Label Width (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.actions.act_window,name:report_label.paperformat_label_action
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.paperformat_label_view_tree
|
||||
msgid "Label paper format configuration"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard____last_update
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard_line____last_update
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard__write_uid
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard_line__write_uid
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__write_uid
|
||||
msgid "Last Updated by"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard__write_date
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard_line__write_date
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__write_date
|
||||
msgid "Last Updated on"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.paperformat_label_view_form
|
||||
msgid "Left (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__margin_left
|
||||
msgid "Left Margin (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard__line_ids
|
||||
msgid "Lines"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard__model_id
|
||||
msgid "Model"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__name
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,help:report_label.field_report_label_wizard__offset
|
||||
msgid "Number of labels to skip when printing"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard__offset
|
||||
msgid "Offset"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__orientation
|
||||
msgid "Orientation"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__dpi
|
||||
msgid "Output DPI"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__page_height
|
||||
msgid "Page height (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__page_width
|
||||
msgid "Page width (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__paperformat_id
|
||||
msgid "Paper Format"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__format
|
||||
msgid "Paper size"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.report_label_wizard_view_form
|
||||
msgid "Print"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.actions.server,name:report_label.actions_server_label_partner_address
|
||||
msgid "Print Address Labels"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.report_label_wizard_view_form
|
||||
msgid "Print Labels"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__print_page_height
|
||||
msgid "Print page height (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__print_page_width
|
||||
msgid "Print page width (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: selection:ir.actions.server,state:0
|
||||
msgid "Print self-adhesive labels"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard_line__quantity
|
||||
msgid "Quantity"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.report_label_wizard_view_form
|
||||
msgid "Record"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model,name:report_label.model_ir_actions_report
|
||||
msgid "Report Action"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model,name:report_label.model_report_label_wizard
|
||||
msgid "Report Label Wizard"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model,name:report_label.model_report_label_wizard_line
|
||||
msgid "Report Label Wizard Line"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard_line__res_name
|
||||
msgid "Res Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard_line__res_id
|
||||
msgid "Resource ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.paperformat_label_view_form
|
||||
msgid "Right (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__margin_right
|
||||
msgid "Right Margin (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,help:report_label.field_report_paperformat_label__format
|
||||
msgid "Select Proper Paper size"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: selection:ir.actions.server,state:0
|
||||
msgid "Send Email"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard_line__sequence
|
||||
msgid "Sequence"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model,name:report_label.model_ir_actions_server
|
||||
msgid "Server Action"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.report_label_wizard_view_form
|
||||
msgid "Settings"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,help:report_label.field_ir_actions_server__label_template
|
||||
#: model:ir.model.fields,help:report_label.field_ir_cron__label_template
|
||||
msgid "The QWeb template key to render the labels"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.paperformat_label_view_form
|
||||
msgid "Top (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_paperformat_label__margin_top
|
||||
msgid "Top Margin (mm)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,help:report_label.field_ir_actions_server__state
|
||||
#: model:ir.model.fields,help:report_label.field_ir_cron__state
|
||||
msgid "Type of server action. The following values are available:\n"
|
||||
"- 'Execute Python Code': a block of python code that will be executed\n"
|
||||
"- 'Create': create a new record with new values\n"
|
||||
"- 'Update a Record': update the values of a record\n"
|
||||
"- 'Execute several actions': define an action that triggers several other server actions\n"
|
||||
"- 'Send Email': automatically send an email (Discuss)\n"
|
||||
"- 'Add Followers': add followers to a record (Discuss)\n"
|
||||
"- 'Create Next Activity': create an activity (Discuss)"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: selection:ir.actions.server,state:0
|
||||
msgid "Update the Record"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.view_server_action_form
|
||||
msgid "View QWeb templates"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model:ir.model.fields,field_description:report_label.field_report_label_wizard_line__wizard_id
|
||||
msgid "Wizard"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.report_label_template
|
||||
msgid "height:"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.report_label_template
|
||||
msgid "mm;\n"
|
||||
" display: inline-block;\n"
|
||||
" overflow: hidden;\n"
|
||||
" float: left;\n"
|
||||
" position: relative;\n"
|
||||
" page-break-inside: avoid;\n"
|
||||
" box-sizing: border-box;"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.report_label_template
|
||||
msgid "mm;\n"
|
||||
" margin-bottom:"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.report_label_template
|
||||
msgid "mm;\n"
|
||||
" margin-left:"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.report_label_template
|
||||
msgid "mm;\n"
|
||||
" margin-right:"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.report_label_template
|
||||
msgid "mm;\n"
|
||||
" margin-top:"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.report_label_template
|
||||
msgid "mm;\n"
|
||||
" padding-bottom:"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.report_label_template
|
||||
msgid "mm;\n"
|
||||
" padding-left:"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.report_label_template
|
||||
msgid "mm;\n"
|
||||
" padding-right:"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.report_label_template
|
||||
msgid "mm;\n"
|
||||
" padding-top:"
|
||||
msgstr ""
|
||||
|
||||
#. module: report_label
|
||||
#: model_terms:ir.ui.view,arch_db:report_label.report_label_template
|
||||
msgid "mm;\n"
|
||||
" width:"
|
||||
msgstr ""
|
||||
|
||||
3
report_label/models/__init__.py
Normal file
3
report_label/models/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from . import report_paperformat_label
|
||||
from . import ir_actions_server
|
||||
from . import ir_actions_report
|
||||
15
report_label/models/ir_actions_report.py
Normal file
15
report_label/models/ir_actions_report.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class IrActionsReport(models.Model):
|
||||
_inherit = "ir.actions.report"
|
||||
|
||||
@api.model
|
||||
def get_paperformat(self):
|
||||
# Allow to define paperformat via context
|
||||
res = super().get_paperformat()
|
||||
if self.env.context.get("paperformat_id"):
|
||||
res = self.env["report.paperformat"].browse(
|
||||
self.env.context.get("paperformat_id")
|
||||
)
|
||||
return res
|
||||
55
report_label/models/ir_actions_server.py
Normal file
55
report_label/models/ir_actions_server.py
Normal file
@@ -0,0 +1,55 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class IrActionsServer(models.Model):
|
||||
_inherit = "ir.actions.server"
|
||||
|
||||
state = fields.Selection(
|
||||
selection_add=[("report_label", "Print self-adhesive labels")],
|
||||
ondelete={"report_label": "cascade"},
|
||||
)
|
||||
label_template = fields.Char(
|
||||
"Label QWeb Template",
|
||||
help="The QWeb template key to render the labels",
|
||||
states={"report_label": [("required", True)]},
|
||||
)
|
||||
label_paperformat_id = fields.Many2one(
|
||||
"report.paperformat.label",
|
||||
"Label Paper Format",
|
||||
states={"report_label": [("required", True)]},
|
||||
)
|
||||
|
||||
def report_label_associated_view(self):
|
||||
"""View the associated qweb templates"""
|
||||
self.ensure_one()
|
||||
action = self.env.ref("base.action_ui_view", raise_if_not_found=False)
|
||||
if not action or len(self.label_template.split(".")) < 2:
|
||||
return False
|
||||
res = action.read()[0]
|
||||
res["domain"] = [
|
||||
("type", "=", "qweb"),
|
||||
"|",
|
||||
("name", "ilike", self.label_template.split(".")[1]),
|
||||
("key", "=", self.label_template),
|
||||
]
|
||||
return res
|
||||
|
||||
def _run_action_report_label_multi(self, eval_context=None):
|
||||
"""Show report label wizard"""
|
||||
context = dict(self.env.context)
|
||||
context.update(
|
||||
{
|
||||
"label_template": self.label_template,
|
||||
"label_paperformat_id": self.label_paperformat_id.id,
|
||||
"res_model_id": self.model_id.id,
|
||||
}
|
||||
)
|
||||
return {
|
||||
"name": self.name,
|
||||
"type": "ir.actions.act_window",
|
||||
"res_model": "report.label.wizard",
|
||||
"context": context,
|
||||
"view_mode": "form",
|
||||
"target": "new",
|
||||
}
|
||||
38
report_label/models/report_paperformat_label.py
Normal file
38
report_label/models/report_paperformat_label.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ReportPaperformatLabel(models.Model):
|
||||
_name = "report.paperformat.label"
|
||||
_inherits = {"report.paperformat": "paperformat_id"}
|
||||
_description = "Label Paper Format"
|
||||
|
||||
paperformat_id = fields.Many2one(
|
||||
"report.paperformat",
|
||||
string="Paper Format",
|
||||
required=True,
|
||||
ondelete="cascade",
|
||||
)
|
||||
label_width = fields.Float(
|
||||
"Label Width (mm)",
|
||||
default=60,
|
||||
required=True,
|
||||
)
|
||||
label_height = fields.Float(
|
||||
"Label Height (mm)",
|
||||
default=42.3,
|
||||
required=True,
|
||||
)
|
||||
label_padding_top = fields.Float("Label Padding Top (mm)", default=2)
|
||||
label_padding_right = fields.Float("Label Padding Right (mm)", default=2)
|
||||
label_padding_bottom = fields.Float("Label Padding Bottom (mm)", default=2)
|
||||
label_padding_left = fields.Float("Label Padding Left (mm)", default=2)
|
||||
label_margin_top = fields.Float("Label Margin Top (mm)", default=2)
|
||||
label_margin_right = fields.Float("Label Margin Right (mm)", default=2)
|
||||
label_margin_bottom = fields.Float("Label Margin Bottom (mm)", default=2)
|
||||
label_margin_left = fields.Float("Label Margin Left (mm)", default=2)
|
||||
|
||||
# Overload inherits defaults
|
||||
orientation = fields.Selection(inherited=True, default="Portrait")
|
||||
header_spacing = fields.Integer(inherited=True, default=0)
|
||||
margin_top = fields.Float(inherited=True, default=7)
|
||||
margin_bottom = fields.Float(inherited=True, default=7)
|
||||
10
report_label/readme/CONFIGURE.rst
Normal file
10
report_label/readme/CONFIGURE.rst
Normal file
@@ -0,0 +1,10 @@
|
||||
Go to **Settings > Technical > Analysis > Label Paper Format** and create
|
||||
your self-adhesive label paper formats.
|
||||
|
||||
.. image:: ../static/description/configure_paperformat.png
|
||||
|
||||
Go to **Settings > Technical > Analysis > Label Report** and create your label
|
||||
report, and its context action. You'll also need to create or reuse a
|
||||
QWeb template for you label.
|
||||
|
||||
.. image:: ../static/description/configure_report_label.png
|
||||
7
report_label/readme/CONTRIBUTORS.rst
Normal file
7
report_label/readme/CONTRIBUTORS.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
* Iván Todorovich <ivan.todorovich@gmail.com>
|
||||
* `Moka Tourisme <https://www.mokatourisme.fr>`_:
|
||||
|
||||
* Grégory Schreiner
|
||||
|
||||
* Sylvain LE GAL <https://twitter.com/legalsylvain>
|
||||
* Stefan Rijnhart <stefan@opener.amsterdam>
|
||||
1
report_label/readme/DESCRIPTION.rst
Normal file
1
report_label/readme/DESCRIPTION.rst
Normal file
@@ -0,0 +1 @@
|
||||
This module allows you to create self-adhesive label printing actions on any model.
|
||||
10
report_label/readme/ROADMAP.rst
Normal file
10
report_label/readme/ROADMAP.rst
Normal file
@@ -0,0 +1,10 @@
|
||||
Known issues:
|
||||
|
||||
* `wkhtmltopdf` doesn't always respect dpi, and mm measures don't match. For
|
||||
this matter, it's recommended to use this module along with
|
||||
`report_wkhtmltopdf_param` and enable `--disable-smart-shrinking`.
|
||||
|
||||
* This module depends on `base_automation` only because this module extends
|
||||
`ir.actions.server` with a new kind of action, and `base.automation` inherits
|
||||
from `ir.actions.server` by delegation in such a way that the modules cannot
|
||||
be loaded in another order.
|
||||
5
report_label/readme/USAGE.rst
Normal file
5
report_label/readme/USAGE.rst
Normal file
@@ -0,0 +1,5 @@
|
||||
1. In the target model's tree view, select the records to print.
|
||||
2. Click *Action* and your label report action name.
|
||||
3. Select the number of labels per record to print, and click Print.
|
||||
|
||||
.. image:: ../static/description/label_wizard.png
|
||||
52
report_label/reports/report_label.xml
Normal file
52
report_label/reports/report_label.xml
Normal file
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
|
||||
<template id="report_label_template">
|
||||
<t t-call="web.basic_layout">
|
||||
<t t-set="full_width" t-value="True" />
|
||||
<t t-set="label_style">
|
||||
height: <t t-esc="label_format['label_height']" />mm;
|
||||
width: <t t-esc="label_format['label_width']" />mm;
|
||||
padding-top: <t t-esc="label_format['label_padding_top']" />mm;
|
||||
padding-right: <t t-esc="label_format['label_padding_right']" />mm;
|
||||
padding-bottom: <t t-esc="label_format['label_padding_bottom']" />mm;
|
||||
padding-left: <t t-esc="label_format['label_padding_left']" />mm;
|
||||
margin-top: <t t-esc="label_format['label_margin_top']" />mm;
|
||||
margin-right: <t t-esc="label_format['label_margin_right']" />mm;
|
||||
margin-bottom: <t t-esc="label_format['label_margin_bottom']" />mm;
|
||||
margin-left: <t t-esc="label_format['label_margin_left']" />mm;
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
float: left;
|
||||
position: relative;
|
||||
page-break-inside: avoid;
|
||||
box-sizing: border-box;
|
||||
</t>
|
||||
<!-- Offset: Skip the first [offset] labels -->
|
||||
<t t-foreach="range(0, offset)" t-as="i">
|
||||
<div t-att-style="label_style" />
|
||||
</t>
|
||||
<t t-foreach="lines" t-as="line">
|
||||
<t t-foreach="range(0, line['quantity'])" t-as="i">
|
||||
<div t-att-style="label_style">
|
||||
<t t-call="{{label_template}}">
|
||||
<t
|
||||
t-set="record"
|
||||
t-value="docs.env[res_model].browse(line['res_id'])"
|
||||
/>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
<record id="report_label" model="ir.actions.report">
|
||||
<field name="name">Label Report</field>
|
||||
<field name="model">report.label.wizard</field>
|
||||
<field name="report_type">qweb-pdf</field>
|
||||
<field name="report_name">report_label.report_label_template</field>
|
||||
<field name="report_file">report_label.report_label_template</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
5
report_label/security/ir.model.access.csv
Normal file
5
report_label/security/ir.model.access.csv
Normal file
@@ -0,0 +1,5 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_report_paperformat_label_all,report.paperformat.label all,model_report_paperformat_label,base.group_user,1,0,0,0
|
||||
access_report_label_layout_admin,report.paperformat.label admin,model_report_paperformat_label,base.group_system,1,1,1,1
|
||||
access_report_label_wizard,report.label.wizard,model_report_label_wizard,base.group_user,1,1,1,1
|
||||
access_report_label_wizard_line,report.label.wizard.line,model_report_label_wizard_line,base.group_user,1,1,1,1
|
||||
|
BIN
report_label/static/description/configure_paperformat.png
Normal file
BIN
report_label/static/description/configure_paperformat.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 54 KiB |
BIN
report_label/static/description/configure_report_label.png
Normal file
BIN
report_label/static/description/configure_report_label.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
BIN
report_label/static/description/icon.png
Normal file
BIN
report_label/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
469
report_label/static/description/index.html
Normal file
469
report_label/static/description/index.html
Normal file
@@ -0,0 +1,469 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
|
||||
<title>Report Labels</title>
|
||||
<style type="text/css">
|
||||
|
||||
/*
|
||||
:Author: David Goodger (goodger@python.org)
|
||||
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
|
||||
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
|
||||
/* used to remove borders from tables and images */
|
||||
.borderless, table.borderless td, table.borderless th {
|
||||
border: 0 }
|
||||
|
||||
table.borderless td, table.borderless th {
|
||||
/* Override padding for "table.docutils td" with "! important".
|
||||
The right padding separates the table cells. */
|
||||
padding: 0 0.5em 0 0 ! important }
|
||||
|
||||
.first {
|
||||
/* Override more specific margin styles with "! important". */
|
||||
margin-top: 0 ! important }
|
||||
|
||||
.last, .with-subtitle {
|
||||
margin-bottom: 0 ! important }
|
||||
|
||||
.hidden {
|
||||
display: none }
|
||||
|
||||
.subscript {
|
||||
vertical-align: sub;
|
||||
font-size: smaller }
|
||||
|
||||
.superscript {
|
||||
vertical-align: super;
|
||||
font-size: smaller }
|
||||
|
||||
a.toc-backref {
|
||||
text-decoration: none ;
|
||||
color: black }
|
||||
|
||||
blockquote.epigraph {
|
||||
margin: 2em 5em ; }
|
||||
|
||||
dl.docutils dd {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Uncomment (and remove this text!) to get bold-faced definition list terms
|
||||
dl.docutils dt {
|
||||
font-weight: bold }
|
||||
*/
|
||||
|
||||
div.abstract {
|
||||
margin: 2em 5em }
|
||||
|
||||
div.abstract p.topic-title {
|
||||
font-weight: bold ;
|
||||
text-align: center }
|
||||
|
||||
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||
div.hint, div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ;
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||
div.important p.admonition-title, div.note p.admonition-title,
|
||||
div.tip p.admonition-title {
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title, .code .error {
|
||||
color: red ;
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||
compound paragraphs.
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
*/
|
||||
|
||||
div.dedication {
|
||||
margin: 2em 5em ;
|
||||
text-align: center ;
|
||||
font-style: italic }
|
||||
|
||||
div.dedication p.topic-title {
|
||||
font-weight: bold ;
|
||||
font-style: normal }
|
||||
|
||||
div.figure {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
div.footer, div.header {
|
||||
clear: both;
|
||||
font-size: smaller }
|
||||
|
||||
div.line-block {
|
||||
display: block ;
|
||||
margin-top: 1em ;
|
||||
margin-bottom: 1em }
|
||||
|
||||
div.line-block div.line-block {
|
||||
margin-top: 0 ;
|
||||
margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
|
||||
div.sidebar {
|
||||
margin: 0 0 0.5em 1em ;
|
||||
border: medium outset ;
|
||||
padding: 1em ;
|
||||
background-color: #ffffee ;
|
||||
width: 40% ;
|
||||
float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric {
|
||||
font-family: sans-serif ;
|
||||
font-size: medium }
|
||||
|
||||
div.system-messages {
|
||||
margin: 5em }
|
||||
|
||||
div.system-messages h1 {
|
||||
color: red }
|
||||
|
||||
div.system-message {
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.system-message p.system-message-title {
|
||||
color: red ;
|
||||
font-weight: bold }
|
||||
|
||||
div.topic {
|
||||
margin: 2em }
|
||||
|
||||
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||
margin-top: 0.4em }
|
||||
|
||||
h1.title {
|
||||
text-align: center }
|
||||
|
||||
h2.subtitle {
|
||||
text-align: center }
|
||||
|
||||
hr.docutils {
|
||||
width: 75% }
|
||||
|
||||
img.align-left, .figure.align-left, object.align-left, table.align-left {
|
||||
clear: left ;
|
||||
float: left ;
|
||||
margin-right: 1em }
|
||||
|
||||
img.align-right, .figure.align-right, object.align-right, table.align-right {
|
||||
clear: right ;
|
||||
float: right ;
|
||||
margin-left: 1em }
|
||||
|
||||
img.align-center, .figure.align-center, object.align-center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
table.align-center {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.align-left {
|
||||
text-align: left }
|
||||
|
||||
.align-center {
|
||||
clear: both ;
|
||||
text-align: center }
|
||||
|
||||
.align-right {
|
||||
text-align: right }
|
||||
|
||||
/* reset inner alignment in figures */
|
||||
div.align-right {
|
||||
text-align: inherit }
|
||||
|
||||
/* div.align-center * { */
|
||||
/* text-align: left } */
|
||||
|
||||
.align-top {
|
||||
vertical-align: top }
|
||||
|
||||
.align-middle {
|
||||
vertical-align: middle }
|
||||
|
||||
.align-bottom {
|
||||
vertical-align: bottom }
|
||||
|
||||
ol.simple, ul.simple {
|
||||
margin-bottom: 1em }
|
||||
|
||||
ol.arabic {
|
||||
list-style: decimal }
|
||||
|
||||
ol.loweralpha {
|
||||
list-style: lower-alpha }
|
||||
|
||||
ol.upperalpha {
|
||||
list-style: upper-alpha }
|
||||
|
||||
ol.lowerroman {
|
||||
list-style: lower-roman }
|
||||
|
||||
ol.upperroman {
|
||||
list-style: upper-roman }
|
||||
|
||||
p.attribution {
|
||||
text-align: right ;
|
||||
margin-left: 50% }
|
||||
|
||||
p.caption {
|
||||
font-style: italic }
|
||||
|
||||
p.credits {
|
||||
font-style: italic ;
|
||||
font-size: smaller }
|
||||
|
||||
p.label {
|
||||
white-space: nowrap }
|
||||
|
||||
p.rubric {
|
||||
font-weight: bold ;
|
||||
font-size: larger ;
|
||||
color: maroon ;
|
||||
text-align: center }
|
||||
|
||||
p.sidebar-title {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold ;
|
||||
font-size: larger }
|
||||
|
||||
p.sidebar-subtitle {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
p.topic-title {
|
||||
font-weight: bold }
|
||||
|
||||
pre.address {
|
||||
margin-bottom: 0 ;
|
||||
margin-top: 0 ;
|
||||
font: inherit }
|
||||
|
||||
pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
pre.code .ln { color: grey; } /* line numbers */
|
||||
pre.code, code { background-color: #eeeeee }
|
||||
pre.code .comment, code .comment { color: #5C6576 }
|
||||
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
||||
pre.code .literal.string, code .literal.string { color: #0C5404 }
|
||||
pre.code .name.builtin, code .name.builtin { color: #352B84 }
|
||||
pre.code .deleted, code .deleted { background-color: #DEB0A1}
|
||||
pre.code .inserted, code .inserted { background-color: #A3D289}
|
||||
|
||||
span.classifier {
|
||||
font-family: sans-serif ;
|
||||
font-style: oblique }
|
||||
|
||||
span.classifier-delimiter {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
span.interpreted {
|
||||
font-family: sans-serif }
|
||||
|
||||
span.option {
|
||||
white-space: nowrap }
|
||||
|
||||
span.pre {
|
||||
white-space: pre }
|
||||
|
||||
span.problematic {
|
||||
color: red }
|
||||
|
||||
span.section-subtitle {
|
||||
/* font-size relative to parent (h1..h6 element) */
|
||||
font-size: 80% }
|
||||
|
||||
table.citation {
|
||||
border-left: solid 1px gray;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docinfo {
|
||||
margin: 2em 4em }
|
||||
|
||||
table.docutils {
|
||||
margin-top: 0.5em ;
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
table.footnote {
|
||||
border-left: solid 1px black;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docutils td, table.docutils th,
|
||||
table.docinfo td, table.docinfo th {
|
||||
padding-left: 0.5em ;
|
||||
padding-right: 0.5em ;
|
||||
vertical-align: top }
|
||||
|
||||
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||
font-weight: bold ;
|
||||
text-align: left ;
|
||||
white-space: nowrap ;
|
||||
padding-left: 0 }
|
||||
|
||||
/* "booktabs" style (no vertical lines) */
|
||||
table.docutils.booktabs {
|
||||
border: 0px;
|
||||
border-top: 2px solid;
|
||||
border-bottom: 2px solid;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.docutils.booktabs * {
|
||||
border: 0px;
|
||||
}
|
||||
table.docutils.booktabs th {
|
||||
border-bottom: thin solid;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
||||
font-size: 100% }
|
||||
|
||||
ul.auto-toc {
|
||||
list-style-type: none }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="report-labels">
|
||||
<h1 class="title">Report Labels</h1>
|
||||
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/14.0/report_label"><img alt="OCA/reporting-engine" src="https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/reporting-engine-14-0/reporting-engine-14-0-report_label"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/143/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module allows you to create self-adhesive label printing actions on any model.</p>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#configuration" id="id1">Configuration</a></li>
|
||||
<li><a class="reference internal" href="#usage" id="id2">Usage</a></li>
|
||||
<li><a class="reference internal" href="#known-issues-roadmap" id="id3">Known issues / Roadmap</a></li>
|
||||
<li><a class="reference internal" href="#bug-tracker" id="id4">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="id5">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="id6">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="id7">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="id8">Maintainers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="configuration">
|
||||
<h1><a class="toc-backref" href="#id1">Configuration</a></h1>
|
||||
<p>Go to <strong>Settings > Technical > Analysis > Label Paper Format</strong> and create
|
||||
your self-adhesive label paper formats.</p>
|
||||
<img alt="https://raw.githubusercontent.com/OCA/reporting-engine/14.0/report_label/static/description/configure_paperformat.png" src="https://raw.githubusercontent.com/OCA/reporting-engine/14.0/report_label/static/description/configure_paperformat.png" />
|
||||
<p>Go to <strong>Settings > Technical > Analysis > Label Report</strong> and create your label
|
||||
report, and its context action. You’ll also need to create or reuse a
|
||||
QWeb template for you label.</p>
|
||||
<img alt="https://raw.githubusercontent.com/OCA/reporting-engine/14.0/report_label/static/description/configure_report_label.png" src="https://raw.githubusercontent.com/OCA/reporting-engine/14.0/report_label/static/description/configure_report_label.png" />
|
||||
</div>
|
||||
<div class="section" id="usage">
|
||||
<h1><a class="toc-backref" href="#id2">Usage</a></h1>
|
||||
<ol class="arabic simple">
|
||||
<li>In the target model’s tree view, select the records to print.</li>
|
||||
<li>Click <em>Action</em> and your label report action name.</li>
|
||||
<li>Select the number of labels per record to print, and click Print.</li>
|
||||
</ol>
|
||||
<img alt="https://raw.githubusercontent.com/OCA/reporting-engine/14.0/report_label/static/description/label_wizard.png" src="https://raw.githubusercontent.com/OCA/reporting-engine/14.0/report_label/static/description/label_wizard.png" />
|
||||
</div>
|
||||
<div class="section" id="known-issues-roadmap">
|
||||
<h1><a class="toc-backref" href="#id3">Known issues / Roadmap</a></h1>
|
||||
<p>Known issues:</p>
|
||||
<ul class="simple">
|
||||
<li><cite>wkhtmltopdf</cite> doesn’t always respect dpi, and mm measures don’t match. For
|
||||
this matter, it’s recommended to use this module along with
|
||||
<cite>report_wkhtmltopdf_param</cite> and enable <cite>–disable-smart-shrinking</cite>.</li>
|
||||
<li>This module depends on <cite>base_automation</cite> only because this module extends
|
||||
<cite>ir.actions.server</cite> with a new kind of action, and <cite>base.automation</cite> inherits
|
||||
from <cite>ir.actions.server</cite> by delegation in such a way that the modules cannot
|
||||
be loaded in another order.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
<h1><a class="toc-backref" href="#id4">Bug Tracker</a></h1>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/reporting-engine/issues">GitHub Issues</a>.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||
<a class="reference external" href="https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_label%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
<h1><a class="toc-backref" href="#id5">Credits</a></h1>
|
||||
<div class="section" id="authors">
|
||||
<h2><a class="toc-backref" href="#id6">Authors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Iván Todorovich</li>
|
||||
<li>Moka Tourisme</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="contributors">
|
||||
<h2><a class="toc-backref" href="#id7">Contributors</a></h2>
|
||||
<ul>
|
||||
<li><p class="first">Iván Todorovich <<a class="reference external" href="mailto:ivan.todorovich@gmail.com">ivan.todorovich@gmail.com</a>></p>
|
||||
</li>
|
||||
<li><p class="first"><a class="reference external" href="https://www.mokatourisme.fr">Moka Tourisme</a>:</p>
|
||||
<blockquote>
|
||||
<ul class="simple">
|
||||
<li>Grégory Schreiner</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
</li>
|
||||
<li><p class="first">Sylvain LE GAL <<a class="reference external" href="https://twitter.com/legalsylvain">https://twitter.com/legalsylvain</a>></p>
|
||||
</li>
|
||||
<li><p class="first">Stefan Rijnhart <<a class="reference external" href="mailto:stefan@opener.amsterdam">stefan@opener.amsterdam</a>></p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h2><a class="toc-backref" href="#id8">Maintainers</a></h2>
|
||||
<p>This module is maintained by the OCA.</p>
|
||||
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
||||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.</p>
|
||||
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
|
||||
<p><a class="reference external" href="https://github.com/ivantodorovich"><img alt="ivantodorovich" src="https://github.com/ivantodorovich.png?size=40px" /></a></p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/reporting-engine/tree/14.0/report_label">OCA/reporting-engine</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
BIN
report_label/static/description/label_wizard.png
Normal file
BIN
report_label/static/description/label_wizard.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
1
report_label/tests/__init__.py
Normal file
1
report_label/tests/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import test_report_label
|
||||
27
report_label/tests/test_report_label.py
Normal file
27
report_label/tests/test_report_label.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo.tests import common
|
||||
|
||||
|
||||
class TestReportLabel(common.TransactionCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.partner_label = self.env.ref(
|
||||
"report_label.actions_server_label_partner_address"
|
||||
)
|
||||
|
||||
def test_01_print_partner_label(self):
|
||||
self.partner_label.create_action()
|
||||
action = self.partner_label.run()
|
||||
model = action["res_model"]
|
||||
context = action["context"]
|
||||
context.update(
|
||||
{
|
||||
"active_model": "res.partner",
|
||||
"active_ids": self.env["res.partner"].search([]).ids,
|
||||
"discard_logo_check": True,
|
||||
}
|
||||
)
|
||||
wizard = self.env[model].with_context(context).create({})
|
||||
report_action = wizard.print_report()
|
||||
self.assertEquals(report_action["type"], "ir.actions.report")
|
||||
46
report_label/views/ir_actions_server.xml
Normal file
46
report_label/views/ir_actions_server.xml
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
|
||||
<record id="view_server_action_form" model="ir.ui.view">
|
||||
<field name="model">ir.actions.server</field>
|
||||
<field name="inherit_id" ref="base.view_server_action_form" />
|
||||
<field name="arch" type="xml">
|
||||
<header position="inside">
|
||||
<button
|
||||
name="report_label_associated_view"
|
||||
type="object"
|
||||
string="View QWeb templates"
|
||||
attrs="{'invisible':['|', ('state', '!=', 'report_label'), ('label_template', '=', False)]}"
|
||||
help="Display a button in the sidebar of related model to open a wizard"
|
||||
/>
|
||||
</header>
|
||||
<field name="type" position="after">
|
||||
<field
|
||||
name="label_paperformat_id"
|
||||
attrs="{'invisible': [('state', '!=', 'report_label')]}"
|
||||
/>
|
||||
<field
|
||||
name="label_template"
|
||||
attrs="{'invisible': [('state', '!=', 'report_label')]}"
|
||||
/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="report_label_action" model="ir.actions.act_window">
|
||||
<field name="name">Label Reports</field>
|
||||
<field name="res_model">ir.actions.server</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[("state", "=", "report_label")]</field>
|
||||
<field name="context">{"default_state": "report_label"}</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
id="report_label_menu"
|
||||
name="Label Reports"
|
||||
action="report_label_action"
|
||||
parent="base.reporting_menuitem"
|
||||
sequence="3"
|
||||
/>
|
||||
|
||||
</odoo>
|
||||
70
report_label/views/report_paperformat_label.xml
Normal file
70
report_label/views/report_paperformat_label.xml
Normal file
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
|
||||
<record id="paperformat_label_view_form" model="ir.ui.view">
|
||||
<field name="model">report.paperformat.label</field>
|
||||
<field name="inherit_id" ref="base.paperformat_view_form" />
|
||||
<field name="mode">primary</field>
|
||||
<field name="arch" type="xml">
|
||||
<!-- Hide irrelevant fields -->
|
||||
<field name="header_line" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</field>
|
||||
<field name="header_spacing" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</field>
|
||||
<field name="report_ids" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</field>
|
||||
<!-- Add label paper format fields -->
|
||||
<sheet position="inside">
|
||||
<group name="label">
|
||||
<group name="label_size" string="Label Size" colspan="2">
|
||||
<field name="label_height" />
|
||||
<field name="label_width" />
|
||||
</group>
|
||||
<group name="label_padding" string="Label Padding">
|
||||
<field string="Top (mm)" name="label_padding_top" />
|
||||
<field string="Right (mm)" name="label_padding_right" />
|
||||
<field string="Bottom (mm)" name="label_padding_bottom" />
|
||||
<field string="Left (mm)" name="label_padding_left" />
|
||||
</group>
|
||||
<group name="label_margin" string="Label Margin">
|
||||
<field string="Top (mm)" name="label_margin_top" />
|
||||
<field string="Right (mm)" name="label_margin_right" />
|
||||
<field string="Bottom (mm)" name="label_margin_bottom" />
|
||||
<field string="Left (mm)" name="label_margin_left" />
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="paperformat_label_view_tree" model="ir.ui.view">
|
||||
<field name="model">report.paperformat.label</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Label paper format configuration">
|
||||
<field name="name" />
|
||||
<field name="label_height" />
|
||||
<field name="label_width" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="paperformat_label_action" model="ir.actions.act_window">
|
||||
<field name="name">Label paper format configuration</field>
|
||||
<field name="res_model">report.paperformat.label</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[]</field>
|
||||
<field name="context">{}</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
id="paperformat_label_menu"
|
||||
name="Label Paper Formats"
|
||||
action="paperformat_label_action"
|
||||
parent="base.reporting_menuitem"
|
||||
sequence="2"
|
||||
/>
|
||||
|
||||
</odoo>
|
||||
1
report_label/wizards/__init__.py
Normal file
1
report_label/wizards/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import report_label_wizard
|
||||
108
report_label/wizards/report_label_wizard.py
Normal file
108
report_label/wizards/report_label_wizard.py
Normal file
@@ -0,0 +1,108 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ReportLabelWizard(models.TransientModel):
|
||||
_name = "report.label.wizard"
|
||||
_description = "Report Label Wizard"
|
||||
|
||||
@api.model
|
||||
def _default_line_ids(self):
|
||||
"""Compute line_ids based on context"""
|
||||
active_model = self.env.context.get("active_model")
|
||||
active_ids = self.env.context.get("active_ids", [])
|
||||
if not active_model or not active_ids:
|
||||
return False
|
||||
return [
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"res_id": res_id,
|
||||
"quantity": 1,
|
||||
},
|
||||
)
|
||||
for res_id in active_ids
|
||||
]
|
||||
|
||||
model_id = fields.Many2one(
|
||||
"ir.model",
|
||||
"Model",
|
||||
required=True,
|
||||
default=lambda self: self.env.context.get("res_model_id"),
|
||||
)
|
||||
label_paperformat_id = fields.Many2one(
|
||||
"report.paperformat.label",
|
||||
"Label Paper Format",
|
||||
readonly=True,
|
||||
required=True,
|
||||
default=lambda self: self.env.context.get("label_paperformat_id"),
|
||||
)
|
||||
label_template = fields.Char(
|
||||
"Label QWeb Template",
|
||||
readonly=True,
|
||||
required=True,
|
||||
default=lambda self: self.env.context.get("label_template"),
|
||||
)
|
||||
offset = fields.Integer(
|
||||
help="Number of labels to skip when printing",
|
||||
)
|
||||
line_ids = fields.One2many(
|
||||
"report.label.wizard.line",
|
||||
"wizard_id",
|
||||
"Lines",
|
||||
default=_default_line_ids,
|
||||
required=True,
|
||||
)
|
||||
|
||||
def _prepare_report_data(self):
|
||||
self.ensure_one()
|
||||
return {
|
||||
"label_format": self.label_paperformat_id.read()[0],
|
||||
"label_template": self.label_template,
|
||||
"offset": self.offset,
|
||||
"res_model": self.model_id.model,
|
||||
"lines": [
|
||||
{
|
||||
"res_id": line.res_id,
|
||||
"quantity": line.quantity,
|
||||
}
|
||||
for line in self.line_ids
|
||||
],
|
||||
}
|
||||
|
||||
def print_report(self):
|
||||
self.ensure_one()
|
||||
report = self.env.ref("report_label.report_label")
|
||||
action = report.report_action(self, data=self._prepare_report_data())
|
||||
action["context"] = {
|
||||
"paperformat_id": self.label_paperformat_id.paperformat_id.id,
|
||||
}
|
||||
return action
|
||||
|
||||
|
||||
class ReportLabelWizardLine(models.TransientModel):
|
||||
_name = "report.label.wizard.line"
|
||||
_description = "Report Label Wizard Line"
|
||||
_order = "sequence"
|
||||
|
||||
wizard_id = fields.Many2one(
|
||||
"report.label.wizard",
|
||||
"Wizard",
|
||||
required=True,
|
||||
ondelete="cascade",
|
||||
)
|
||||
sequence = fields.Integer(default=10)
|
||||
res_id = fields.Integer("Resource ID", required=True)
|
||||
res_name = fields.Char(compute="_compute_res_name")
|
||||
quantity = fields.Integer(default=1, required=True)
|
||||
|
||||
@api.depends("wizard_id.model_id", "res_id")
|
||||
def _compute_res_name(self):
|
||||
wizard = self.mapped("wizard_id")
|
||||
wizard.ensure_one()
|
||||
res_model = wizard.model_id.model
|
||||
res_ids = self.mapped("res_id")
|
||||
names_map = dict(self.env[res_model].browse(res_ids).name_get())
|
||||
for rec in self:
|
||||
rec.res_name = names_map.get(rec.res_id)
|
||||
42
report_label/wizards/report_label_wizard.xml
Normal file
42
report_label/wizards/report_label_wizard.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
|
||||
<record id="report_label_wizard_view_form" model="ir.ui.view">
|
||||
<field name="model">report.label.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Print Labels">
|
||||
<sheet>
|
||||
<group>
|
||||
</group>
|
||||
<field name="line_ids">
|
||||
<tree editable="bottom" create="false">
|
||||
<field name="sequence" widget="handle" />
|
||||
<field name="res_id" invisible="1" />
|
||||
<field name="res_name" string="Record" />
|
||||
<field name="quantity" />
|
||||
</tree>
|
||||
</field>
|
||||
<group name="settings" string="Settings">
|
||||
<group>
|
||||
<field name="offset" />
|
||||
<field name="model_id" invisible="1" />
|
||||
<field name="label_paperformat_id" />
|
||||
<field name="label_template" invisible="1" />
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
<footer>
|
||||
<button
|
||||
name="print_report"
|
||||
string="Print"
|
||||
type="object"
|
||||
icon="fa-print"
|
||||
class="oe_highlight"
|
||||
/>
|
||||
<button special="cancel" string="Cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -57,7 +57,7 @@ class ReportController(main.ReportController):
|
||||
return request.make_response(res, headers=http_headers)
|
||||
|
||||
@route()
|
||||
def report_download(self, data, token):
|
||||
def report_download(self, data, token, context=None):
|
||||
"""This function is used by 'qwebactionmanager.js' in order to trigger
|
||||
the download of a py3o/controller report.
|
||||
|
||||
@@ -68,7 +68,9 @@ class ReportController(main.ReportController):
|
||||
requestcontent = json.loads(data)
|
||||
url, report_type = requestcontent[0], requestcontent[1]
|
||||
if "py3o" not in report_type:
|
||||
return super(ReportController, self).report_download(data, token)
|
||||
return super(ReportController, self).report_download(
|
||||
data, token, context=context
|
||||
)
|
||||
try:
|
||||
reportname = url.split("/report/py3o/")[1].split("?")[0]
|
||||
docids = None
|
||||
|
||||
@@ -12,8 +12,8 @@ from odoo.addons.web.controllers import main as report
|
||||
|
||||
class ReportController(report.ReportController):
|
||||
@route()
|
||||
def report_download(self, data, token):
|
||||
result = super().report_download(data, token)
|
||||
def report_download(self, data, token, context=None):
|
||||
result = super().report_download(data, token, context=context)
|
||||
# When report is downloaded from print action, this function is called,
|
||||
# but this function cannot pass context (manually entered password) to
|
||||
# report.render_qweb_pdf(), encrypton for manual password is done here.
|
||||
|
||||
@@ -34,10 +34,11 @@ class IrActionsReport(models.Model):
|
||||
document, ttype = super(IrActionsReport, self)._render_qweb_pdf(
|
||||
res_ids=res_ids, data=data
|
||||
)
|
||||
if isinstance(res_ids, int):
|
||||
res_ids = [res_ids]
|
||||
password = self._get_pdf_password(res_ids[:1])
|
||||
document = self._encrypt_pdf(document, password)
|
||||
if res_ids:
|
||||
if isinstance(res_ids, int):
|
||||
res_ids = [res_ids]
|
||||
password = self._get_pdf_password(res_ids[:1])
|
||||
document = self._encrypt_pdf(document, password)
|
||||
return document, ttype
|
||||
|
||||
def _get_pdf_password(self, res_id):
|
||||
|
||||
1
setup/report_label/odoo/addons/report_label
Symbolic link
1
setup/report_label/odoo/addons/report_label
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../report_label
|
||||
6
setup/report_label/setup.py
Normal file
6
setup/report_label/setup.py
Normal file
@@ -0,0 +1,6 @@
|
||||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['setuptools-odoo'],
|
||||
odoo_addon=True,
|
||||
)
|
||||
Reference in New Issue
Block a user