Skip to Content
Menu
This question has been flagged
1 Reply
126 Views

I'm new to Studio.

I need to log Purchase and Sales activities on Lot/Serial numbers so the original data can't be changed anymore.

So essentially I need the data which is already available in existing Odoo models duplicated and prevent to be edited. So like the original suppliers/customers and product details can't be changed anymore.

How to do this?

Thanks for any help.st

Avatar
Discard
Best Answer

Hi,


You can achieve this entirely in Odoo Studio by creating fields on the Lot/Serial Number record and using an automated action to fill them when each lot is created. Start by going to Inventory → Products → Lots/Serial Numbers, open any record, and click the Studio icon. Add new Char fields such as “Product Name ”, “Supplier Name”, and “Customer Name ”—these will hold frozen copies of data from the related product or partner. After adding them, go to Settings → Technical → Automation → Automated Actions (enable Developer Mode if needed), create a new automated action on the model Lot/Serial Number (stock.production.lot), and set the trigger to On Creation. In the “Fields to Update” section, assign each field to the source values you want to capture, for example, x_product_name = product_id.name, x_supplier_name = picking_id.partner_id.name, and x_customer_name = picking_id.partner_id.name. Save the action. Then, return to Studio, open the Lot/Serial Number form again, select each  field, and mark them as Read Only to prevent edits. From that point on, whenever a new serial or lot number is created through a purchase receipt or delivery, those fields will automatically record the product, supplier, and customer names as they existed at that time and remain locked, even if the original product or partner details later change.


Hope it helps.

Avatar
Discard
Related Posts Replies Views Activity
1
Jul 25
1956
2
Mar 25
2134
0
Feb 25
1719
0
Feb 25
2109
0
Feb 25
1832