Skip to content

Commit 623659a

Browse files
committed
fixup
1 parent dd013fb commit 623659a

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

label_wizard/views/product.xml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<odoo>
2-
32
<record id="action_label_from_record_wizard" model="ir.actions.act_window">
43
<field name="name">🏷 Imprimer étiquettes produits</field>
54
<field name="type">ir.actions.act_window</field>
65
<field name="res_model">label.from.record</field>
76
<field name="view_mode">form</field>
8-
<field name="view_id" ref="label_from_record_wizard_view"/>
7+
<field name="view_id" ref="label_from_record_wizard_view" />
98
<field name="target">new</field>
109
</record>
1110

@@ -14,9 +13,12 @@
1413
<field name="inherit_id" ref="product.product_normal_form_view" />
1514
<field name="arch" type="xml">
1615
<xpath expr="//header/button" position="before">
17-
<button string="🖨" name="%(action_label_from_record_wizard)d" type="action"/>
16+
<button
17+
string="🖨"
18+
name="%(action_label_from_record_wizard)d"
19+
type="action"
20+
/>
1821
</xpath>
1922
</field>
2023
</record>
21-
2224
</odoo>

label_wizard/wizard/label2print.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,18 @@ def generate_label(self):
8989
if data4print:
9090
model = data4print[0][0].browse(False)
9191
content_params = {"with_price": rec.with_price}
92-
return model._get_zebra_labels(data4print, content_params)
92+
method = model._get_zebra_labels
93+
if method:
94+
return method(data4print, content_params)
95+
else:
96+
raise UserError(
97+
_(
98+
f"Model {model._name} has no attribute"
99+
"_get_zebra_labels.\nConsider to install "
100+
"'label_helper' module or implements your own "
101+
"behavior in your custom module"
102+
)
103+
)
93104
return {"type": "ir.actions.act_window_close"}
94105

95106
@api.model

0 commit comments

Comments
 (0)