pip install setuptools==57
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ModelA(models.Model): | |
_name = "model.a" | |
alias_contact = fields.Selection([ | |
('everyone', 'Everyone'), | |
('partners', 'Authenticated Partners'), | |
('followers', 'Followers only')], default='everyone', | |
string='Alias Contact Security', required=True, | |
help="Policy to post a message on the document using the mailgateway.\n" | |
"- everyone: everyone can post\n" |
Run from Terminal:
python3 odoo-bin shell -d mydb --addons-path=/your/addons/path
Run from python console:
self.env['ir.module.module'].search([('name', '=', 'crm')]).button_immediate_uninstall()
(0, 0, { values }) link to a new record that needs to be created with the given values dictionary
(1, ID, { values }) update the linked record with id = ID (write *values* on it)
(2, ID) remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object completely, and the link to it as well)
(3, ID) cut the link to the linked record with id = ID (delete the relationship between the two objects but does not delete the target object itself)
(4, ID) link to existing record with id = ID (adds a relationship)
(4, [ID]) link to existing record with id = ID (adds a relationship)
(5) unlink all (like using (3,ID) for all linked records)
(6, 0, [IDs]) replace the list of linked IDs (like using (5) then (4,ID) for each ID in the list of IDs)
(5, 0, 0) unlink all
<field name="journal_ids" context="{'tree_view_ref':'module_name.my_joural_tree_view'}" />
[('x_partners','=',parent.partner_id)]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT table_name | |
FROM information_schema.tables | |
WHERE table_schema = 'database_name' | |
ORDER BY table_name ASC; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
date_tz = fields.Selection('_tz_get', string='Timezone', required=True, | |
default=lambda self: self.env.user.tz or 'UTC') | |
@api.model | |
def _tz_get(self): | |
return [(x, x) for x in pytz.all_timezones] | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dict(self._fields['your_field'].selection).get(self.your_field) |
use attribute force_save="1" in view to save value of readonly field.
<field name="payment_type" readonly="1" force_save="1"/>
it will save value of payment_type field when onchange trigger.
OlderNewer