Initially, I immediately wrote the data to the database, but I need to record everything only after the user clicks the save button, now I try to return the data in the view edit form, but I don’t know how to do it correctly. I have a button when this button is clicked, this function starts and I need to return the user’s data from it (so that he can check \ add) and then just save it to the database.
@api.multi
def get_form_fields(self):
html = requests.get(self.form_url)
soup = BeautifulSoup(html.text, 'html.parser')
form_inputs = soup.find_all('input')
form_selects = soup.find_all('select')
fields_lines = []
#Find all inputs on page
for i in form_inputs:
vals_inputs = {}
vals_inputs['form_field_name'] = i.get('name')
vals_inputs['form_bot'] = self.id
try:
type_field = i.get('type')
if type_field == 'hidden':
vals_inputs['hidden_field'] = True
except:
pass
fields_lines.append((0, 0, vals_inputs))
# self.env['model.forms_bot_fileds'].create(vals_inputs)
#find all select fields on page
for i in form_selects:
vals_slects = {}
vals_slects['form_field_name'] = i.get('name')
vals_slects['form_bot'] = self.id
fields_lines.append((0, 0, vals_slects))
# self.env['model.forms_bot_fileds'].create(vals_slects)