تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
2368 أدوات العرض

This is the Repair app. Odoo V14, but I think it happens also in subsequent versions.

When creating a repair order.

There is a tab that is called "Parts". It's a list. If I click to "Add a line", the second column is the product, which I enter. There is a column called "source location", and I have a default location "Warehouse A". The parts for repairs are always taken from another location called "Repair Parts Location".

There is also a "Dest. location". It has "Production" as location. I also want to change this default location.

How can I change these two default locations?

I have tried Studio but it's not clear how to change these locations.

Thanks

الصورة الرمزية
إهمال
أفضل إجابة

Create an automated action to update field

The destiation location is 'Production' as the part is being consumed during the repair. You might want to ensure that your destination location Type is set as 'Production'

When parts are removed during repair source location is production and destination location is scrap (Inventory loss)

الصورة الرمزية
إهمال
أفضل إجابة

Hi,

There is an onchange function (onchange_operation_type) in Addons, which change the Source location and Destination Location when changing the field type. You can override this function to set the default values.@api.onchange('type')
    def onchange_operation_type(self):
        """ On change of operation type it sets source location, destination location
        and to invoice field.
        @param product: Changed operation type.
        @param guarantee_limit: Guarantee limit of current record.
        @return: Dictionary of values.
        """
        if not self.type:
            self.location_id = False
            self.location_dest_id = False
        elif self.type == 'add':
            self.onchange_product_id()
            args = self.repair_id.company_id and [('company_id', '=', self.repair_id.company_id.id)] or []
            warehouse = self.env['stock.warehouse'].search(args, limit=1)
            self.location_id = < Desired location you prefer>
            self.location_dest_id = < Desired location you prefer>
        else:
            self.price_unit = 0.0
            self.tax_id = False
            self.location_id = < Desired location you prefer>
            self.location_dest_id = < Desired location you prefer>
By overriding this Onchange function, you can simply set the desired location according to you

Hope it helps

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
نوفمبر 19
9981
1
نوفمبر 24
4919
1
سبتمبر 24
1786
1
سبتمبر 24
1560
2
سبتمبر 24
2113