Skip to Content
Menu
This question has been flagged

I need to add product section wise in my module same as Sale order line in addons. But I think something is missing in my coding because when I want to add section and after that I add product at that time section field can't save and removed from order line and replaced by product field. 


.py File :-

class BookingLines(models.Model):

    _name = 'booking.lines'

    _description = "Order Lines For Movie Ticket"


    booking_id = fields.Many2one('theater.booking')

    show_id = fields.Many2one('theater.show', required=True)

    name = fields.Text(string='Description', index=True, required=True)

    sequence = fields.Integer(string='Sequence', default=1)

    display_type = fields.Selection([

        ('line_section', "Section"),

        ('line_note', "Note")], default=False, help="Technical field for UX purpose.")

    date = fields.Many2one('daily.shows', string="Date", required=True, domain="[('show_id','=',show_id)]")

    venue = fields.Many2one(related="date.shift", string="Screen", required=True)

    qty = fields.Integer(string="Quantity", default=1)

    price = fields.Float(related='date.shift.lst_price', string="Price", default=0.00)

    subtotal = fields.Float(string="Subtotal", compute='compute_subtotal')


.xml File :-

                        <page string="Order Lines" name="order_summary">

                            <field name="booking_lines" widget="section_and_note_one2many">

                                <tree editable="bottom">

                                    <control>

                                        <create name="add_product_control" string="Add a Product"/>

                                        <create name="add_section_control" string="Add a section" context="{'default_display_type': 'line_section'}"/>

                                    </control>

                                    <field name="sequence" widget="handle"/>

                                    <field name="display_type" invisible="1"/>

                                    <field name="name" widget="section_and_note_text" optional="show"/>

                                    <field name="booking_id" invisible='1'/>

                                    <field name="show_id" attrs="{

                                            'required': [('display_type', '=', False)],

                                        }"  options="{'no_open': True}" force_save="1" widget="product_configurator"/>

                                    <field name="date"/>

                                    <field name="venue"/>

                                    <field name="qty"/>

                                    <field name="price"/>

                                    <field name="subtotal"/>

                                </tree>

                            </field>

                        </page>

Avatar
Discard

Yeah I'm having the same issue. According to the videos and pictures I've seen the box should popup, you add and hit confrim. I have no confirm button at all. Haven't changed anything, so dunno...

Related Posts Replies Views Activity
0
Apr 21
800
1
Nov 23
1367
1
Mar 22
1893
4
Sep 21
10735
1
Nov 24
1487