[IMP] report_label: black, isort, prettier

This commit is contained in:
Stefan Rijnhart
2021-04-20 15:20:22 +02:00
parent 7605b7c15e
commit c6c0ef3fd4
17 changed files with 167 additions and 131 deletions

View File

@@ -1,4 +1,4 @@
from odoo import api, models, fields
from odoo import api, fields, models
class ReportLabelWizard(models.TransientModel):
@@ -7,16 +7,20 @@ class ReportLabelWizard(models.TransientModel):
@api.model
def _default_line_ids(self):
""" Compute line_ids based on context """
"""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,
})
(
0,
0,
{
"res_id": res_id,
"quantity": 1,
},
)
for res_id in active_ids
]

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="report_label_wizard_view_form" model="ir.ui.view">
@@ -10,24 +10,30 @@
</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"/>
<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"/>
<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"/>
<button
name="print_report"
string="Print"
type="object"
icon="fa-print"
class="oe_highlight"
/>
<button special="cancel" string="Cancel" />
</footer>
</form>
</field>