Odoo 9.0C: How can i access the value of a many2one field (that has been created in sale.order.line module on the invoice qweb report?

末鹿安然 提交于 2019-12-08 12:52:31

问题


I have installed module Sale Sourced by Line by Camptocamp, Eficent, SerpentCS, Odoo Community Association (OCA) for Odoo 9.0. The module creates a new many2one field as the code bellow:

class SaleOrderLine(models.Model):
    _inherit = 'sale.order.line'

    warehouse_id = fields.Many2one(
        'stock.warehouse',
        'Source Warehouse',
        readonly=True,
        states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
        help="If a source warehouse is selected, "
             "it will be used to define the route. "
             "Otherwise, it will get the warehouse of "
             "the sale order")

Now i would like to access the value warehouse_id on account_invoice_report qweb. Please tell me what are posible solutions for my purpose? Thank for your time,


回答1:


In account.invoice.line one field available sale_line_ids, based on that you can search warehouse_id from sale.order.line.

invoice.invoice_line_ids.mapped('sale_line_ids').mapped('warehouse_id')

This may help you.



来源:https://stackoverflow.com/questions/43050684/odoo-9-0c-how-can-i-access-the-value-of-a-many2one-field-that-has-been-created

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!