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
Just update the record using write method.
Example,
def method_name(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state': 'state_name'}, context=context)
return True
thanks
thank you very much it did work
Hi,
In Odoo, you can change the state of a
record (e.g., a model) when a button is clicked by using Python methods
and XML views. Here's a step-by-step guide on how to achieve this:
Create a Button:
First,
create a button in your Odoo model's XML view file. This button will
trigger the action to change the state of the record. For example:
Then define a method that will change the state of record using write method
class YourModel(models.Model):
_name = 'your.model'
state = fields.Selection([
('draft', 'Draft'),
('approved', 'Approved'),
('rejected', 'Rejected'),
], default='draft', string='State')
def action_change_state(self):
# Update the state of the current record or a set of records
self.write({'state': 'approved'}) # Change the state to 'approved'
Hope it helps
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ść | |
---|---|---|---|---|
Opening new window with button in OpenERP
Rozwiązane
|
|
1
sty 24
|
14227 | |
|
2
mar 18
|
5055 | ||
|
0
sty 18
|
3163 | ||
|
2
lut 24
|
25619 | ||
|
3
lut 25
|
55518 |