-
Notifications
You must be signed in to change notification settings - Fork 23.1k
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
[IMP] stock: inventory back2basics #162998
Conversation
@@ -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" > |
There was a problem hiding this comment.
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
4ad4fd7
to
5740f1d
Compare
@@ -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) |
There was a problem hiding this comment.
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'), |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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)
90709cf
to
8f812f0
Compare
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
8f812f0
to
62f565a
Compare
@@ -72,7 +72,6 @@ def _compute_show_picking_type(self): | |||
if record.code == "dropship": | |||
record.show_picking_type = True | |||
|
|||
|
There was a problem hiding this comment.
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
62f565a
to
d674419
Compare
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
d674419
to
e781ffe
Compare
robodoo r+ |
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>
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>
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>
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>
In this commit:
task-3837207