在odoo网站上点击时存储字段中的数据

时间:2019-08-29 17:07:00

标签: odoo

我在odoo 10中遇到问题 我在/ shop / address页面上创建了一个额外的字段,字段名称为(customtext) 我想将该字段的信息存储在sale.order中 我如何在控制器中做到这一点

控制器:

class WebsiteSaleFormExtenchen(WebsiteSale): 
def _checkout_form_save(self, mode, checkout, all_values):
res = super(WebsiteSaleFormExtenchen, self)._checkout_form_save(
            mode, checkout, all_values)

xml:

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <data>
        <record id="view_sale_order_inherited" model="ir.ui.view">
            <field name="name">view.sale.order.inherited</field>
            <field name="model">sale.order</field>
            <field name="inherit_id" ref="sale.view_order_form"/>
            <field name="arch" type="xml">
                <field name="payment_term_id" position="after">
                    <field name="customtext"/>
                </field>
            </field>
        </record>
    </data>
</odoo>

XML网站页面:

<odoo>
<data>
 <template id="website_insert_customtext" inherit_id="website_sale.address">
        <xpath expr="//div[@id='div_phone']" position="after">

                    <div t-attf-class="form-group #{error.get('customtext') and 'has-error' or ''} col-md-6"
                         id="div_custom_text">
                        <label class="control-label" for="customtext">Custom Text</label>
                        <input name="customtext" class="form-control"
                               t-att-value="'customtext' in checkout and checkout['customtext']"/>
         </div>
        </xpath>
    </template>
</data>

0 个答案:

没有答案