[PATCH] Upstream patch - 21092022

This commit is contained in:
Parthiv Patel committed 2022-09-21 08:41:37 +00:00
1 parent f57890359c
commit 7f855ca007
7 files changed
+38 -5

No files matched your search

+1 -1
View File
@@ -1653,7 +1653,7 @@ class SaleOrderLine(models.Model):
'discount': self.discount,
'price_unit': self.price_unit,
'tax_ids': [(6, 0, self.tax_id.ids)],
'analytic_account_id': self.order_id.analytic_account_id.id,
'analytic_account_id': self.order_id.analytic_account_id.id if not self.display_type else False,
'analytic_tag_ids': [(6, 0, self.analytic_tag_ids.ids)],
'sale_line_ids': [(4, self.id)],
}
@@ -97,7 +97,7 @@ class SaleAdvancePaymentInv(models.TransientModel):
'tax_ids': [(6, 0, so_line.tax_id.ids)],
'sale_line_ids': [(6, 0, [so_line.id])],
'analytic_tag_ids': [(6, 0, so_line.analytic_tag_ids.ids)],
'analytic_account_id': order.analytic_account_id.id or False,
'analytic_account_id': order.analytic_account_id.id if not so_line.display_type and order.analytic_account_id.id else False,
})],
}
+2
View File
@@ -311,6 +311,8 @@ class StockMoveLine(models.Model):
new_product_uom_qty = ml.product_id.uom_id._compute_quantity(reserved_qty, ml.product_uom_id, rounding_method='HALF-UP')
moves_to_recompute_state |= ml.move_id
ml.with_context(bypass_reservation_update=True).product_uom_qty = new_product_uom_qty
# we don't want to override the new reserved quantity
vals.pop('product_uom_qty', None)
# When editing a done move line, the reserved availability of a potential chained move is impacted. Take care of running again `_action_assign` on the concerned moves.
if updates or 'qty_done' in vals:
+26
View File
@@ -2844,6 +2844,32 @@ class StockMove(SavepointCase):
self.assertEqual(len(self.gather_relevant(self.product_lot, self.stock_location, lot_id=lot1, strict=True)), 0.0)
self.assertEqual(len(self.gather_relevant(self.product_lot, self.stock_location, lot_id=lot2, strict=True)), 0.0)
def test_edit_reserved_move_line_9(self):
"""
When writing on the reserved quantity on the SML, a process tries to
reserve the quants with that new quantity. If it fails (for instance
because the written quantity is more than actually available), this
quantity should be reset to 0.
"""
self.env['stock.quant']._update_available_quantity(self.product, self.stock_location, 1.0)
out_move = self.env['stock.move'].create({
'name': self.product.name,
'location_id': self.stock_location.id,
'location_dest_id': self.customer_location.id,
'product_id': self.product.id,
'product_uom_qty': 1,
'product_uom': self.product.uom_id.id,
})
out_move._action_confirm()
out_move._action_assign()
# try to manually assign more than available
out_move.move_line_ids.product_uom_qty = 2
self.assertTrue(out_move.move_line_ids)
self.assertEqual(out_move.move_line_ids.product_uom_qty, 0, "The reserved quantity should be cancelled")
def test_edit_done_move_line_1(self):
""" Test that editing a done stock move line linked to an untracked product correctly and
directly adapts the transfer. In this case, we edit the sublocation where we take the
+1 -1
View File
@@ -314,7 +314,7 @@ class Web_Editor(http.Controller):
dict: views, scss, js
"""
# Related views must be fetched if the user wants the views and/or the style
views = request.env["ir.ui.view"].get_related_views(key, bundles=bundles)
views = request.env["ir.ui.view"].with_context(no_primary_children=True, __views_get_original_hierarchy=[]).get_related_views(key, bundles=bundles)
views = views.read(['name', 'id', 'key', 'xml_id', 'arch', 'active', 'inherit_id'])
scss_files_data_by_bundle = []
+6 -1
View File
@@ -241,6 +241,9 @@ class IrUiView(models.Model):
@api.model
def _view_get_inherited_children(self, view):
if self._context.get('no_primary_children', False):
original_hierarchy = self._context.get('__views_get_original_hierarchy', [])
return view.inherit_children_ids.filtered(lambda extension: extension.mode != 'primary' or extension.id in original_hierarchy)
return view.inherit_children_ids
@api.model
@@ -259,7 +262,7 @@ class IrUiView(models.Model):
@api.model
def _views_get(self, view_id, get_children=True, bundles=False, root=True, visited=None):
""" For a given view ``view_id``, should return:
* the view itself
* the view itself (starting from its top most parent)
* all views inheriting from it, enabled or not
- but not the optional children of a non-enabled child
* all views called from it (via t-call)
@@ -273,7 +276,9 @@ class IrUiView(models.Model):
if visited is None:
visited = []
original_hierarchy = self._context.get('__views_get_original_hierarchy', [])
while root and view.inherit_id:
original_hierarchy.append(view.id)
view = view.inherit_id
views_to_return = view
+1 -1
View File
@@ -1426,7 +1426,7 @@
<div t-attf-class="o_wforum_author_box d-inline-flex #{display_info and 'o_show_info'} #{compact and 'o_compact align-items-center'} #{bio_popover_data and 'o_wforum_bio_popover'}"
t-att-data-content="bio_popover_data">
<t t-set="user_profile_url" value="#"/>
<t t-set="user_profile_url" t-valuef="#"/>
<t t-if="object.create_uid.id == request.session.uid or object.create_uid.sudo().website_published">
<t t-set="user_profile_url" t-value="'/forum/%s/user/%s' % (slug(forum), object.create_uid.id) + '?forum_origin=' + request.httprequest.path"/>
</t>