commit
3f8a62c134
|
|
@ -68,11 +68,11 @@ class PurchaseRequest(models.Model):
|
||||||
requisition_id = self.env['purchase.requisition'].sudo().create({
|
requisition_id = self.env['purchase.requisition'].sudo().create({
|
||||||
'category_ids': self.product_category_ids.ids,
|
'category_ids': self.product_category_ids.ids,
|
||||||
'type_id_test': self.type_id.id,
|
'type_id_test': self.type_id.id,
|
||||||
'department_id': self.employee_id.department_id.id,
|
'department_id': self.sudo().employee_id.department_id.id,
|
||||||
'type': self.type,
|
'type': self.type,
|
||||||
'purpose': self.purchase_purpose,
|
'purpose': self.purchase_purpose,
|
||||||
'request_id': self.id,
|
'request_id': self.id,
|
||||||
'user_id': self.employee_id.user_id.id,
|
'user_id': self.sudo().employee_id.user_id.id,
|
||||||
'line_ids': line_ids
|
'line_ids': line_ids
|
||||||
})
|
})
|
||||||
self.write({'purchase_create': True,'state':'employee'})
|
self.write({'purchase_create': True,'state':'employee'})
|
||||||
|
|
@ -94,7 +94,7 @@ class PurchaseRequest(models.Model):
|
||||||
'product_id': line.product_id.id,
|
'product_id': line.product_id.id,
|
||||||
'product_qty': line.qty_purchased,
|
'product_qty': line.qty_purchased,
|
||||||
'name':line.description or line.product_id.name,
|
'name':line.description or line.product_id.name,
|
||||||
'department_name': self.employee_id.department_id.id,
|
'department_name': self.sudo().employee_id.department_id.id,
|
||||||
'account_analytic_id': line.account_id.id,
|
'account_analytic_id': line.account_id.id,
|
||||||
'date_planned': datetime.today(),
|
'date_planned': datetime.today(),
|
||||||
'price_unit': 0,
|
'price_unit': 0,
|
||||||
|
|
@ -132,7 +132,7 @@ class PurchaseRequest(models.Model):
|
||||||
non_storable_product = self.line_ids - storable_product_lines
|
non_storable_product = self.line_ids - storable_product_lines
|
||||||
if any(storable_product_lines.filtered(lambda line: line.available_qty > 0)):
|
if any(storable_product_lines.filtered(lambda line: line.available_qty > 0)):
|
||||||
available = True
|
available = True
|
||||||
if any(storable_product_lines.filtered(lambda store_line: store_line.qty >= store_line.available_qty)):
|
if any(storable_product_lines.filtered(lambda store_line: store_line.qty > store_line.available_qty)):
|
||||||
context = {}
|
context = {}
|
||||||
view = self.env.ref('purchase_custom_stock.purchase_request_picking_wizard_view_form')
|
view = self.env.ref('purchase_custom_stock.purchase_request_picking_wizard_view_form')
|
||||||
wiz = self.env['purchase.request_picking.wizard']
|
wiz = self.env['purchase.request_picking.wizard']
|
||||||
|
|
|
||||||
|
|
@ -671,10 +671,9 @@ class ProductCustom(models.Model):
|
||||||
'Sale Price: ') + '{}'.format(product.list_price) + '\n' + _('Description: ') + '{}'.format(
|
'Sale Price: ') + '{}'.format(product.list_price) + '\n' + _('Description: ') + '{}'.format(
|
||||||
product.description) + '\n' + _('On Date: ') + '{}'.format(fields.Date.today()) + '\n' + _(
|
product.description) + '\n' + _('On Date: ') + '{}'.format(fields.Date.today()) + '\n' + _(
|
||||||
'Created By: ') + '{}'.format(self.env.user.name)
|
'Created By: ') + '{}'.format(self.env.user.name)
|
||||||
group = 'purchase.group_purchase_manager'
|
# group = 'purchase.group_purchase_manager'
|
||||||
author_id = self.env.user.partner_id.id or None
|
author_id = self.env.user.partner_id.id or None
|
||||||
self.env.user.partner_id.send_notification_message(subject=subject, body=message, author_id=author_id,
|
self.env.user.partner_id.send_notification_message(subject=subject, body=message, author_id=author_id)
|
||||||
group=group)
|
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def create(self, vals):
|
def create(self, vals):
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ class PurchaseRequest(models.Model):
|
||||||
def compute_edit_partner_id(self):
|
def compute_edit_partner_id(self):
|
||||||
"""Compute For Group Edit Partner Id"""
|
"""Compute For Group Edit Partner Id"""
|
||||||
for rec in self:
|
for rec in self:
|
||||||
if self.env.user.has_group("purchase_requisition_custom.create_purchase_request"):
|
if self.env.user.has_group("purchase.group_purchase_user") or self.env.user.has_group("purchase.group_purchase_manager"):
|
||||||
rec.edit_partner_id = True
|
rec.edit_partner_id = True
|
||||||
else:
|
else:
|
||||||
rec.edit_partner_id = False
|
rec.edit_partner_id = False
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue