Odoo Help

7

0
2 Answers
1
Avatar

Cybrosys Techno Solutions Pvt.Ltd India

--Cybrosys Techno Solutions Pvt.Ltd--
Cybrosys Techno Solutions Pvt.Ltd
https://www.cybrosys.com
19653
| 7 6 10
Calicut, India
--Cybrosys Techno Solutions Pvt.Ltd--

Cybrosys Technologies is a private limited ISO certified company in Technology and Software Engineering sector. We serve as one of the best and trusted Odoo official partner, providing ultimate Customization and Implementation services in Odoo ERP. A frequent contributor to Odoo Apps, our customized free apps are downloaded by more than one lakh users. Most of our apps augment the potentialities of Odoo and are trending in the Odoo app store.

Cybrosys keeps privilege to be one among the finest Odoo Official Partners with 200+ free apps contribution towards the Odoo community. Cybrosys also stands number one in Odoo-social Media Integration empowering every kind of business solutions.

We are also enriched with highly skilled UI/UX technical experts for Developing, Implementing and Designing, thereby providing ultimate benefit to our customer base.

Today Cybrosys has reached par excellent in Odoo Implementation and allied services, proving its credibility and reliability. Our proven services are used by customers sprawling across 160+ countries including Middle East, African continents, UK, Germany, Spain, Thailand, Hong Kong, New Zealand, Australia, Malaysia, Singapore, Egypt etc.

We are rapidly expanding our base with robust quality management and business process re-engineering to meet the ultimate customer desire.

To know more about Cybrosys Technologies and our Odoo Apps, Kindly visit:

Cybrosys Technologies 

Odoo Apps 

And inbox us your queries to odoo@cybrosys.com

Cybrosys Techno Solutions Pvt.Ltd India
1/29/19, 2:19 AM

Hi,

You can just add a boolean field in the form and update the boolean field value to True once the button is clicked. You can make the boolean field to True, once you clicked the button from the corresponding function that button calls.


Then Based on this Boolean field you can hide the button using attributes.


In the Python:

check = fields.Boolean("Check")

@api.multi
def set_button(self):
for rec in self:
rec.check = True
# rest of the code

XML

<button name="set_button" type="object" icon="fa-globe" 
attrs="{'invisible': [('check', '=', True)}"/>

Thanks



1
Avatar

Yenthe Van Ginneken Belgium

--Yenthe Van Ginneken--
25257
| 9 9 12
Turnhout, Belgium
--Yenthe Van Ginneken--


Yenthe Van Ginneken Belgium
1/29/19, 2:23 AM

Hi Tom,

You can create an extra field on your model (a boolean) to check if the button has been clicked before or not. Depending on the boolean field you can show or hide the button then. Example Python:

class YourModel(models.Model):
    _name = 'your.model'
button_clicked = fields.Boolean(string='Button clicked')
@api.multi def your_button_action(self):
# This goes off when clicking your button - do your logic here.
self.button_clicked = True

Your XML:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
        <record id='product_section_view_form' model='ir.ui.view'>
            <field name="name">product.section.form</field>
            <field name="model">product.section</field>
            <field name="arch" type="xml">
                <form string="Product section">
                <header>
                    <!-- You can for example hide the button once it is clicked like this:
                    attrs="{'invisible': [('button_clicked', '=', True)]}" 
-->
<button name="your_button_action" string="Click here" type="object"/> </header> <sheet> <field name="button_clicked" invisible="1"/> </sheet> </form> </field> </record> </data> </odoo>

You can then check on this boolean its state in any function to see if it has been clicked or not before.

Regards,
Yenthe

1 Comment
Mian Kamran Pakistan
1/30/19, 12:22 AM
Ask a Question
Writer
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now