Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
2369 Vizualizări

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

Imagine profil
Abandonează
Cel mai bun răspuns

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)

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
nov. 19
9981
1
nov. 24
4919
1
sept. 24
1786
1
sept. 24
1560
2
sept. 24
2113