Hello.
I have some interesting issue. Basically I have extended the account.invoice module with a many2one field link to stock.warehouse. When I put some info from the warehouse to the invoice report, everything works fine. However, when I print multiple such invoices i get the following error:
ValueError: Expected singleton
My code for the extension is quite simple, I guess i am missing something here:
class InvoiceWarehouse(models.Model):
_inherit = 'account.invoice'
warehouse_id = fields.Many2one('stock.warehouse', string="Warehouse", compute='_get_warehouse')
def _get_warehouse(self):
for warehouse in self:
self.warehouse_id= self.env['sale.order'].search([('name', '=', self.origin)])[0].warehouse_id
Here is the Qweb element that is making problems
<div class="col-xs-6 col-xs-offset-0" style="white-space:nowrap; margin-top:25mm; font-size: 11px;" t-field="o.warehouse_id.company_id.report_header" name="moto"/>