They would help me to take only the values of a column that is in a table of one model to another table that is in another model, but I only need the values, without needing to call the entire table, just the columns.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
They would help me to take only the values of a column that is in a table of one model to another table that is in another model, but I only need the values, without needing to call the entire table, just the columns.
HELLO,
Trying this
transfer only the values of a specific column from one model's table to another model's table in Odoo, you can follow these steps.
For Example :
Below is an example that assumes:
from odoo import models, api
class TransferValues(models.TransientModel):
_name = 'transfer.values.wizard'
@api.model
def transfer_column_values(self):
# Step 1: Query the values from the source model
source_records = self.env['source.model'].search_read([], ['source_field'])
column_values = [rec['source_field'] for rec in source_records if rec['source_field']]
# Step 2: Insert values into the target model
for value in column_values:
self.env['target.model'].create({'target_field': value})
return True
Create an account today to enjoy exclusive features and engage with our awesome community!
Registracija