从值调用产品的onchange方法

时间:2018-08-09 17:44:39

标签: odoo odoo-8 odoo-9

我已经创建了发票,现在我想创建发票行。但首先,我要在要添加到account_inv_line的产品上调用_onchange_product_id()方法,以接收该产品的所有值。我怎样才能做到这一点? onchange_inv_line_fields始终返回None

 for key, value in csv_info.iteritems():
            account_invoice = {
                'partner_id': value['partner_id'],
                'number': value['number'],
                'date_invoice': value['date_invoice'],
            }
            invocie = acc_inv_obj.with_context(type='in_invoice').create(account_invoice)
        for value_line in csv_info[key]['invoice_line']:
            account_inv_line = {
                'product_id': value_line['product_id'],
                'price_unit': value_line['price_unit'],
                'quantity': value_line['quantity'],


            }
                inv_line = self.env['account.invoice.line'].create(account_inv_line)
                onchange_inv_line_fields = inv_line._onchange_product_id()

1 个答案:

答案 0 :(得分:0)

要调用onchange方法,我们需要创建如下的temp_lines:

<html>
<body>
    <table align="center" class="comic_list">
        <tr>
            <td><a href="{{url_for('alpha')}}"><button type="submit" value="A">A</button></a></td>
            <td><a href="{{ url_for('mastercomics', anchor= 'Action Label') }}"><button type="submit" value="Action Label">Action Label</button></a></td>
        </tr>
    </table>
    <div>
        {% if data %}
            {{ data | safe }}
        {% endif  %}   
    </div>    
</body>
</html>