Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] stock: inventory back2basics #162998

Closed

Conversation

temo-odoo
Copy link
Contributor

In this commit:

  • Prevent updating to 'Inventory loss' or 'Scrap Location' of parent/child location when it has stock.
  • Resolve issues where warehouse (WH) sequence fails to update in certain scenarios, ensuring consistency across Reporting Stock and Replenishment.
  • Remove duplicate actions from Inventory menus to streamline user experience and improve functionality.
  • Implement default location assignments based on operation type: -For internal transfers, manufacturing, and repair, default source and destination to 'WH/Stock'. -For Dropship, the default source to 'partner/vendors' and the destination to 'partners/customers'.

task-3837207

@robodoo
Copy link
Contributor

robodoo commented Apr 23, 2024

@C3POdoo C3POdoo added the RD research & development, internal work label Apr 23, 2024
@@ -4,7 +4,7 @@
<field name="name">stock.move.line.tree</field>
<field name="model">stock.move.line</field>
<field name="arch" type="xml">
<tree string="Move Lines" create="0" default_order="id desc" action="action_open_reference" type="object">
<tree string="Move Lines" create="0" default_order="id desc" action="action_open_reference" type="object" duplicate="false" >
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

="0" to be coherent with the other values. Everywhere

@temo-odoo temo-odoo force-pushed the master-stock-inventory-b2b-imp-temo branch 2 times, most recently from 4ad4fd7 to 5740f1d Compare May 2, 2024 13:03
@@ -96,6 +96,7 @@ def default_get(self, fields):
incoming_move_line_ids = fields.One2many('stock.move.line', 'location_dest_id') # used to compute weight
net_weight = fields.Float('Net Weight', compute="_compute_weight")
forecast_weight = fields.Float('Forecasted Weight', compute="_compute_weight")
sequence = fields.Integer(string="Sequence", compute='_compute_location_sequence', store=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make it related instead. Locations without warehouse_id will have sequence = 0

('location_id', 'in', modified_locations.ids),
('state', 'not in', ['done', 'cancel']),
('quantity_product_uom', '>', 0),
('location_id.usage', '=', 'internal'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a condition on self.ids. Why adding a condition on usage ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mybad, yaa no need of that condition.

@@ -1070,4 +1070,4 @@ def action_view_all_routes(self):
}

def get_current_warehouses(self):
return self.env['stock.warehouse'].search_read(fields=['id', 'name', 'code'], order='name')
return self.env['stock.warehouse'].search_read(fields=['id', 'name', 'code'], order='sequence')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave order empty to use the model order (which is sequence,id so deterministic)

@temo-odoo temo-odoo force-pushed the master-stock-inventory-b2b-imp-temo branch 2 times, most recently from 90709cf to 8f812f0 Compare May 23, 2024 10:52
Comment on lines 75 to 83
def _compute_default_location_src_id(self):
super()._compute_default_location_src_id()
for picking_type in self.filtered(lambda pt: pt.code == 'dropship'):
picking_type.default_location_src_id = self.env.ref('stock.stock_location_suppliers').id

def _compute_default_location_dest_id(self):
super()._compute_default_location_dest_id()
for picking_type in self.filtered(lambda pt: pt.code == 'dropship'):
picking_type.default_location_dest_id = self.env.ref('stock.stock_location_customers').id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is already done from line 49

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @Whenrow
Yaa, you are right i have removed this two methods but this section of code was not present during my development phase this have merged recently.
source-destination location

Thanks.

for picking_type in repair_picking_type:
picking_type.default_location_dest_id = prod_locations.get(picking_type.company_id.id)
stock_location = picking_type.warehouse_id.lot_stock_id
picking_type.default_location_dest_id = stock_location.id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not good, the repair default location were correct already

Copy link
Contributor Author

@temo-odoo temo-odoo May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when creating an operation type before default destination was Virtual Locations/Production so with this fix i have changed to default WH/Stock as per the spec. in the task in point 5 For repair, the default source & destination to be “WH/Stock”.

cc- @thomasdeleval

Thanks.

@temo-odoo temo-odoo force-pushed the master-stock-inventory-b2b-imp-temo branch from 8f812f0 to 62f565a Compare May 24, 2024 05:33
@@ -72,7 +72,6 @@ def _compute_show_picking_type(self):
if record.code == "dropship":
record.show_picking_type = True


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep 2 blank lines before classes

@kir-odoo kir-odoo force-pushed the master-stock-inventory-b2b-imp-temo branch from 62f565a to d674419 Compare May 28, 2024 10:04
In this commit:
====================
- Prevent updating to 'Inventory loss' or 'Scrap Location' of parent/child
  location when it has stock.
- Resolve issues where warehouse (WH) sequence fails to update in certain
  scenarios, ensuring consistency across Reporting Stock and Replenishment.
- Remove duplicate actions from Inventory menus to streamline user experience
  and improve functionality.
- Implement default location assignments based on operation type:
    -For internal transfers, manufacturing, and repair, default source and
     destination to 'WH/Stock'.
    -For Dropship, the default source to 'partner/vendors' and the destination
      to 'partners/customers'.

task-3837207
@kir-odoo kir-odoo force-pushed the master-stock-inventory-b2b-imp-temo branch from d674419 to e781ffe Compare May 28, 2024 10:28
@kir-odoo kir-odoo marked this pull request as ready for review May 28, 2024 11:16
@Whenrow
Copy link
Contributor

Whenrow commented May 28, 2024

robodoo r+

@C3POdoo C3POdoo requested a review from a team May 28, 2024 11:17
robodoo pushed a commit that referenced this pull request May 29, 2024
In this commit:
====================
- Prevent updating to 'Inventory loss' or 'Scrap Location' of parent/child
  location when it has stock.
- Resolve issues where warehouse (WH) sequence fails to update in certain
  scenarios, ensuring consistency across Reporting Stock and Replenishment.
- Remove duplicate actions from Inventory menus to streamline user experience
  and improve functionality.
- Implement default location assignments based on operation type:
    -For internal transfers, manufacturing, and repair, default source and
     destination to 'WH/Stock'.
    -For Dropship, the default source to 'partner/vendors' and the destination
      to 'partners/customers'.

task-3837207

closes #162998

Related: odoo/enterprise#61323
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
@robodoo robodoo closed this May 29, 2024
@robodoo robodoo added the 17.3 label May 29, 2024
visp-odoo pushed a commit to odoo-dev/odoo that referenced this pull request May 30, 2024
In this commit:
====================
- Prevent updating to 'Inventory loss' or 'Scrap Location' of parent/child
  location when it has stock.
- Resolve issues where warehouse (WH) sequence fails to update in certain
  scenarios, ensuring consistency across Reporting Stock and Replenishment.
- Remove duplicate actions from Inventory menus to streamline user experience
  and improve functionality.
- Implement default location assignments based on operation type:
    -For internal transfers, manufacturing, and repair, default source and
     destination to 'WH/Stock'.
    -For Dropship, the default source to 'partner/vendors' and the destination
      to 'partners/customers'.

task-3837207

closes odoo#162998

Related: odoo/enterprise#61323
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
HANNICHE-Walid pushed a commit to odoo-dev/odoo that referenced this pull request May 31, 2024
In this commit:
====================
- Prevent updating to 'Inventory loss' or 'Scrap Location' of parent/child
  location when it has stock.
- Resolve issues where warehouse (WH) sequence fails to update in certain
  scenarios, ensuring consistency across Reporting Stock and Replenishment.
- Remove duplicate actions from Inventory menus to streamline user experience
  and improve functionality.
- Implement default location assignments based on operation type:
    -For internal transfers, manufacturing, and repair, default source and
     destination to 'WH/Stock'.
    -For Dropship, the default source to 'partner/vendors' and the destination
      to 'partners/customers'.

task-3837207

closes odoo#162998

Related: odoo/enterprise#61323
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
HANNICHE-Walid pushed a commit to odoo-dev/odoo that referenced this pull request May 31, 2024
In this commit:
====================
- Prevent updating to 'Inventory loss' or 'Scrap Location' of parent/child
  location when it has stock.
- Resolve issues where warehouse (WH) sequence fails to update in certain
  scenarios, ensuring consistency across Reporting Stock and Replenishment.
- Remove duplicate actions from Inventory menus to streamline user experience
  and improve functionality.
- Implement default location assignments based on operation type:
    -For internal transfers, manufacturing, and repair, default source and
     destination to 'WH/Stock'.
    -For Dropship, the default source to 'partner/vendors' and the destination
      to 'partners/customers'.

task-3837207

closes odoo#162998

Related: odoo/enterprise#61323
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
17.3 RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants