Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
3 Ответы
5375 Представления

Hi,

I am trying to customize Odoo 14 community edition for our needs. After making the SO, we need to select production lots in stock for the delivery. When clicking on the right side "menu" button on a delivery line, the production lot selection dialog is shown. Currently, in the "Lot/Serial Number" drop down menu, it only show the Lot Number. I want it to show "Lot Number (qty)" so that the user can see immediately how many item of a production lot is still available for picking, e.g. Lot#123 (100 pcs).

I need to inherit and change the above view but I cannot find it. The view has "Detailed Operations" as the window title. Thanks.

Thanks.

Simon

Аватар
Отменить
Лучший ответ

Hi Simon,

To display the extra value in a dropdown m2o field, you need to override a name_get method to display the qty.

def name_get(self):
res = []
for lot in self:
res.append((lot.id, lot.name + '(' + str(lot.product_qty) + lot.product_uom_id.name + ')' ))
Аватар
Отменить
Автор Лучший ответ

That works. Thanks. 

I still need to add one custom field to the tree view. Can you let me know where I can find the view of the “Detailed operations” dialog? Thanks.

Simon 

Аватар
Отменить

Hi, you can do as above

Thanks

Лучший ответ

Hi,

     Just for your information,

1. The above solution works perfectly said by @Mr.Sudhir and wherever you select the lot/Serial number field in your Odoo , the lot/Serial number will be shown along with UOM and quantity .

2. Detailed operations in front end will be available if you enable the show detailed operations

Inventory > configuration > Warehouse Management > Operation Types.

For your enabled Operation Types, the detailed operation tab will be shown.

3. For inheriting the tab, the base view is in stock module, stock > views > stock_view.xml , you can inherit as below

<record id="view_picking_form_inherit" model="ir.ui.view">

        <field name="name">stock.picking.form</field>

        <field name="model">stock.picking</field>

        <field name="inherit_id" ref=" stock.view_picking_form"/>

        <field name="arch" type="xml">

             <xpath expr="/form/sheet/notebook/page/field[@name='move_line_ids_without_package']/tree/field[@name='product_uom_id']" position="before">
                            <field name="your_field" />
              </xpath>

         </field>

  </record>            

Make sure you add stock module in your custom module depends in manifest file,

Hope it helps,

Thanks


Аватар
Отменить