Skip to Content
Menu
This question has been flagged

Hello

I'm building a module for displaying company information from a website. The module will display the company information in a tree view. But recently I have encountered a problem when clicking on a select button for a record the odoo gives me the error "Please click on the "save" button first". The records that I'm trying to put in are onchange and there is no need for saving. The goal is for the first button to activate the action "action_select_preview_line". I already tried removing the other 2 buttons and it still doesn't work.


XML:
"group
field name ="search_input"/
field name="preview_line_ids"
tree editable="top" create="False" delete="False"
field name="company_name"/
button
name="action_select_preview_line"
icon="fa-arrow-right"
type="object"
class="btn btn-secondary"
title="Select"/
/tree
/field
/group "

Python:

class PartnerWizardline(models.TransientModel):
_name = 'partner.wizard.line'
_description = 'Partner Autocomplete Wizard Line'

partner_wizard_id = fields.Many2one(
string='Partner wizard',
readonly=True
)

company_name = fields.Char(
string='Company name',
readonly=True
)

street = fields.Char(
string='Street',
readonly=True
)

city = fields.Char(
string='City',
readonly=True
)

zip = fields.Char(
string='ZIP',
readonly=True
)

vat = fields.Char(
string='VAT',
readonly=True
)

registration_number = fields.Char(
string='Registration number',
readonly=True
)

banks = fields.Char(
string='Banks',
readonly=True
)

def action_select_preview_line(self):
_logger.info(f"--------------------------")

class PartnerWizard(models.TransientModel):
_name = 'partner.wizard'
_description = 'Partner Autocomplete Wizard'

search_input = fields.Char(
string='Search',
help='Enter title, VAT ID, registration number or bank number'
)

preview_line_ids = fields.One2many(
comodel_name='partner.wizard.line',
inverse_name='partner_wizard_id',
string='Preview lines',
readonly=True,
compute='_compute_preview_line_ids'
)

vat_id = fields.Char(
string='VAT ID'
)

registration_no1= fields.Char(
string=('Registrska številka: ')
)

update_check = fields.Boolean(
string='Update Check',
default=False
)

company_name = fields.Char(
string='Company Name'
)

Avatar
Discard
Related Posts Replies Views Activity
0
May 20
2969
3
Dec 19
5268
6
Dec 23
19909
1
Mar 15
4464
1
Jul 18
8153