تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
3026 أدوات العرض

Greetings.


Im trying to add a Field in "pos.order" but i can't see the added field.


Could you please les me know my mistake.


ODOO V15


file.js


odoo.define('my_module.models', function (require) {
'use strict';
var models = require('point_of_sale.models')
models.load_fields('pos.order', ['order_new_field'])


Python class


class PosOrder(models.Model):
_name = 'pos.order'
_inherit = 'pos.order'

 order_new_field = fields.Selection(
[('1', 'Bla'), ('2', 'Ble')], 'Desc.', default='1')

When i try to read or set the field it is not stored or showed 


const PosUsoCFDIInvoice = PaymentScreen => class extends PaymentScreen {
setField(e) {
this.currentOrder.order_new_field = e.target.value
}
}


All Code is executed but no saved in the model.

Thank you 

الصورة الرمزية
إهمال
أفضل إجابة

Hi,

The field will be visible only if you define it on the template.So please inherit the template add the field on it.

<templates id="template" xml:space="preserve">


    <t t-inherit="point_of_sale.Orderline" t-inherit-mode="extension" owl="1">


        <xpath expr="//li[@class='info']" position="before">


            <t t-if="props.line.product_brand_id">


                <li>


                <span>Brand : </span>


                <t t-esc="props.line.product_brand_id[1]"/>


                </li>


            </t>


        </xpath>


    </t>


    </templates>


Regards

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

Hello, thanks for the answer.

I try

Link to Gist because odoo forum was giving error 


I should see the default value set in the model.

But when odoo renders the template i only see "order new field" but not the value of t-raw.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
1
أغسطس 25
678
1
يوليو 25
933
3
يوليو 25
3184
3
مايو 25
1696
1
يوليو 25
1146