Skip to content
Snippets Groups Projects
Commit bbb1c7b3 authored by ebuzeyTra's avatar ebuzeyTra
Browse files

button class and set_draft function added

parent dc5c62b0
No related branches found
No related tags found
2 merge requests!187Release 14.0.1.1.13,!172General flow of states applied
Pipeline #38799 passed
......@@ -73,10 +73,14 @@ class Selfconsumption(models.Model):
if not record.power or record.power <= 0:
raise ValidationError(_("Project must have a valid Generation Power."))
record.write({"state": "active"})
self.distribution_table_state("process", "active")
self.distribution_table_state("process", "draft")
def set_inscription(self, selfconsumption_state):
for record in self:
record.write({"state": "inscription"})
if selfconsumption_state == 'activation':
self.distribution_table_state("process", "validated")
def set_draft(self):
for record in self:
record.write({"state": "draft"})
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="distribution_table_form_view" model="ir.ui.view">
<field name="name">energy_selfconsumption.distribution_table_form_view.form</field>
<field name="model">energy_selfconsumption.distribution_table</field>
......@@ -13,6 +12,7 @@
string="Validate"
name="button_validate"
states="draft"
class="btn btn-primary"
/>
<button
type="object"
......
......@@ -14,28 +14,37 @@
name="set_inscription"
args="['draft']"
attrs="{'invisible':[('state','not in',['draft'])]}"
class="btn btn-primary"
/>
<button
type="object"
string="Set in activation"
name="set_in_activation_state"
attrs="{'invisible':[('state','not in',['inscription'])]}"
class="btn btn-primary"
/>
<button
type="object"
string="Activate"
name="activate"
attrs="{'invisible':[('state','not in',['activation'])]}"
class="btn btn-primary"
/>
<button
type="object"
string="Change to registration status"
string="Change to inscription status"
name="set_inscription"
args="['activation']"
attrs="{'invisible':[('state','not in',['activation'])]}"
confirm="Are you sure you want to change the project status to the previous step?
If so, the distribution table will return to the 'validated' state."
/>
<button
type="object"
string="Set to Draft"
name="set_draft"
attrs="{'invisible':[('state','not in',['inscription'])]}"
/>
<field
name="state"
widget="statusbar"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment