Skip to content

Commit

Permalink
[FIX]purchase_stock_ux: user_id in PO
Browse files Browse the repository at this point in the history
  • Loading branch information
jcadhoc committed Dec 4, 2024
1 parent 20e1dae commit 8bdb485
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
6 changes: 5 additions & 1 deletion purchase_stock_ux/models/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,13 @@ def write(self, values):
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
self.check_force_delivered_status(vals)
self.check_force_delivered_status(vals)
if self.env.context.get('from_orderpoint', False):
for vals in vals_list:
vals['user_id'] = self.env.user.id
return super().create(vals_list)


@api.model
def check_force_delivered_status(self, vals):
if vals.get('force_delivered_status') and not self.user_has_groups('base.group_system'):
Expand Down
9 changes: 0 additions & 9 deletions purchase_stock_ux/models/purchase_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,6 @@ def fields_view_get(self, view_id=None, view_type='form',

return res

@api.model
def _prepare_purchase_order_line(self, product_id, product_qty, product_uom, company_id, supplier, po):
res = super()._prepare_purchase_order_line(
product_id, product_qty, product_uom, company_id, supplier, po)
#copiamos user_id desde el reabastecimiento a la orden de compra
if not po.user_id:
po.user_id = self.env.user
return res

@api.depends(
'qty_invoiced', 'qty_received', 'order_id.state', 'qty_returned')
def _compute_qty_invoiced(self):
Expand Down
1 change: 0 additions & 1 deletion purchase_stock_ux/models/stock_orderpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ def _get_orderpoint_values(self, product, location):
if product.seller_ids:
values['supplier_id'] = product.seller_ids[0].id
return values

1 change: 1 addition & 0 deletions purchase_stock_ux/models/stock_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ def _make_po_get_domain(self, company_id, values, partner):
else:
new_domain.append(condition)
return tuple(new_domain)

0 comments on commit 8bdb485

Please sign in to comment.