Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
8098 Zobrazení

In our Company the FIRST step we complete is the creation of the SERIAL NUMBER or LOT NUMBER and create a Label that we can print and affix to the frame of our finished product.

The Manufacturing App works by not asking for the number until the END of the order.

How can we address this?

Avatar
Zrušit
Nejlepší odpověď

1.  Add a new custom field to the Manufacturing Order.

2.  Add a new button that auto populates the next available number and then generates the same PDF you would get if you printed from the LOT record.

3. Pass the new LOT number to the Production Wizard so the user doesn't have to create and/or select it there.


Steps:

1.  Add a new custom field to the Manufacturing Order.  

Add to the Database:

Add to the User Interface:

<xpath expr="//field[@name='bom_id']" position="before">
<field name="x_new_lot" string="Lot Label"
attrs="{'invisible': [('x_new_lot','=',False)]}"/>
</xpath>


2.  Add a new button that auto populates the next available number and then generates the same PDF you would get if you printed from the LOT record.  

Create the Button:


Code for the button:

if not record.x_new_lot:
record['x_new_lot'] = env['stock.production.lot'].create({'company_id': 1,'product_id': record.product_id.id})
action = env.ref('stock.action_report_lot_label').report_action(record.x_new_lot)

Add the Button to the User Interface:

<button name="button_unplan" position="after">
<button name="535" type="action" string="LOT LABEL" class="oe_highlight"
attrs="{'invisible': ['|','|',('state','=','cancel'),
                                              ('x_new_lot','!=',False),
                                              ('product_id','=',False)]}"/>
</button>



3. Pass the new LOT number to the Production Wizard so the user doesn't have to create and/or select it there.  

You have to do this TWICE, since the PRODUCE button is in the View twice:

<xpath expr="//form/header/button[@name='open_produce_product'][1]" position="attributes">
<attribute name="context">{'default_finished_lot_id': x_new_lot}</attribute>
</xpath>

<xpath expr="//form/header/button[@name='open_produce_product'][2]" position="attributes">
<attribute name="context">{'default_finished_lot_id': x_new_lot}</attribute>
</xpath>



Now you get this:

A. Before clicking the BUTTON:


B. After clicking the BUTTON:


C. When clicking PRODUCE:

(LOT automatically copied over to the PRODUCE Wizard):



Avatar
Zrušit

Dear ray,

I tried this solution on online version it worked like a charm. However, in odoo v12 its not working. I see lot label button on the bottom of the page when I click it the buttons get disabled. Where am I going wrong? Kindly assist

Related Posts Odpovědi Zobrazení Aktivita
1
srp 22
3936
1
čvn 20
3094
2
kvě 25
2671
0
srp 23
1847
1
úno 22
8527