Hi friends,
Can anyone help me with this error as I don't find any mistake in this code line (if soline.adv_issue_ids and not soline.issue_product_ids:)?
What I'm trying to do is the following
In the IF condition, I'm trying to get the value of the many2many (adv_issue_ids) and one2many (issue_product_ids) fields from the object sale.order.line.
Details of variable used in the code line
soline is a sale order line recordset (ex: sale.order.line(129))
adv_issue_ids is a many2many field in sale.order.line
issue_product_ids is a one2many field in sale.order.line
Please find the error log below
File "/workspace/parts/my_module/wizard/sale_line.py", line 76, in function_name **if soline.adv_issue_ids and not soline.issue_product_ids:** File "/workspace/parts/odoo/odoo/fields.py", line 931, in __get__ self.determine_value(record) File "/workspace/parts/odoo/odoo/fields.py", line 1035, in determine_value record._prefetch_field(self) File "/workspace/parts/odoo/odoo/models.py", line 3087, in _prefetch_field result = records.read([f.name for f in fs], load='_classic_write') File "/workspace/parts/odoo/odoo/models.py", line 3027, in read self._read_from_database(stored, inherited) File "/workspace/parts/odoo/odoo/models.py", line 3117, in _read_from_database self._apply_ir_rules(query, 'read') File "/workspace/parts/odoo/odoo/models.py", line 4131, in _apply_ir_rules where_clause, where_params, tables = Rule.domain_get(self._name, mode) **TypeError: 'Query' object is not iterable**
Thanks in advance!!!
Hi Praveen, can you paste whole method here?
Hi Krutarth, yes, please find the full method bellow, sorry for late reply and thanks.
@api.multi
def function_name(self, orderlines=[]):
sol_obj = self.env['sale.order.line']
olines = sol_obj.browse(orderlines)
lines = []
for soline in olines:
if soline.adv_issue_ids and not soline.issue_product_ids:
raise UserError(_
('The Order Line is in error. Please correct!'))
Awaiting your reply! thanks!
Any help is greatly appreciated.