Hello Odoo:ers! I am having a problem with odoo14:s wizard behavior.
I have a wizard model in wich i define a selection field and a boolean
field. And a function "print_price" that gets called when a button is
pressed on the wizard. But when the button is pressed, both the
selection and boolean fields log out "False", they seem to have lost
their values when the button was pressed.
Does anyone know what causes this, or how to fix it?
Python code:
class product_price_print_wizard(models.TransientModel):
_name = 'product.price.print.wizard'
glabels_template = fields.Selection([("1" , "potato"),("2" ,
"tomato")], 'Glabel Template', required=True, default = "1")
wtf = fields.Boolean(string="test", default = True)
@api.model
def print_price(self, context):
_logger.warning(f"wtf: {self.wtf}")
_logger.warning(f"glabels_template: {self.glabels_template} ")
xml:
<record id="product_price_print_form" model="ir.ui.view">
<field name="name">product.price.print.wizard.form</field>
<field name="model">product.price.print.wizard</field>
<field name="arch" type="xml">
<form string="Price Print">
<group>
<field name="glabels_template"/>
</group>
<footer>
<div>
<button name="print_price" string="Print"
type="object" class="oe_highlight"/> or
<button special="cancel" string="Cancel"
class="oe_link"/>
</div>
</footer>
</form>
</field>
</record>
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
1
Odpowiedz
2913
Widoki
Hi,
Wizard in Odoo is a TransientModel, data won't get stored unless you use store=True.
So, try like below.
glabels_template = fields.Selection([("1", "potato"), ("2", "tomato")], 'Glabel Template', required=True,
default="1", store=True)
Regards
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
2
wrz 23
|
6154 | ||
|
2
maj 24
|
1663 | ||
|
3
sie 24
|
6398 | ||
|
1
wrz 22
|
2009 | ||
|
2
gru 17
|
17059 |