we are using a rental module in odoo 11. While creating a sales order we have tenure information on the order/quotation and pro-forma. But when moving to the account.invoice I can not display the information and I can not reference it in the QWeb from the account.invoice.document as there seems to be no connection between invoices and sales orders.
the code I'm trying to copy from report_saleorder_document
<!-- Lines associated -->
<t t-foreach="layout_category['lines']" t-as="l">
<tr>
<td><span t-field="l.name"/>
<t t-if="l.rental_tenure != 0.0">
<span t-field="l.rental_tenure"/>
<span t-field="l.rental_uom_id"/>
<span> for </span>
<span t-field="l.price_unit" t-options="{'widget': 'monetary', 'display_currency': doc.pricelist_id.currency_id}"/>
<span><strong> for rental</strong></span>
</t>.......
in account.invoice_document i want to add the fields above with rental_tenure etc. under the following code as well:
<tr t-foreach="o.invoice_line_ids" t-as="l">
<td><span t-field="l.name"/></td>```
Any advice on how to achieve this just in Qwebs?
versarthur
On the Invoice Report
call the function
which will link to Sale Order
.
XML:
<t t-set="sale_order" t-value="o.get_sale_order_data()"/>
PY:
@api.multi
def get_sale_order_data(self):
for rec in self:
orders = self.env['sale.order'].search([(
'order_line.invoice_lines.invoice_id', '=', rec.id)], limit=1)
return orders
On the Report, you can take any of the fileds
from 'Sale.Order'
.
Example:
<span t-esc="sale_order.partner_id.name"/>