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

[FIX]purchase_stock_ux: user_id in PO #231

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)