Web Section and Notes Widget in x2Many
(0)
0
Do Incredible

Web Section and Notes Widget in x2Many

20.00 €

Available versions
Required apps
Sales Management (sale_management)
Technical name
web_section_note_widget
License
OPL-1
Secure dependencies
N/A

Web Section and Note Widget in x2Many

Web Section and Note Widget in x2Many.

Web Section and Note Widget in Sale Order

Web Section and Note Widget in x2Many. Sale order like below code


XML Side Code


        <field name="order_line"widget="section_and_note_one2many">
            <tree string="Sales Order Lines"editable="bottom">
            <control>
                <create string="Add a product"/>
                <create string="Add a section" context="{'default_display_type': 'line_section'}"/>
                <create string="Add a note" context="{'default_display_type': 'line_note'}"/>

             </control>
            </tree>
        </field>
      

Python Side Code

    display_type = fields.Selection([
      ('line_section', "Section"),
      ('line_note', "Note")], default=False, help="Technical field for UX purpose.")

    @api.model
    def create(self, values):
        if values.get('display_type', self.default_get(['display_type'])['display_type']):
            values.update(product_id=False, price_unit=0, product_uom_qty=0, product_uom=False, customer_lead=0)
        line = super(SaleOrderLine, self).create(values)
        return line

    @api.multi
    def write(self, values):
        if 'display_type' in values and self.filtered(lambda line: line.display_type != values.get('display_type')):
            raise UserError("You cannot change the type of a sale order line. Instead you should delete the current line and create a new line of the proper type.")
        result = super(SaleOrderLine, self).write(values)
        return result

      

Help & Support

Any type of issue related to this module, any doubt, any queries contact us. You will get free support and assistance in case of any issues

0.0 / 5.0
based on 0 ratings

Python dependencies

Package Version Secured
lxml 4.6.1
This app is not translated in any languages, it is only available in English.