Merge pull request #259 from expsa/dev_odex25_purchase_changes
Dev odex25 purchase changes
This commit is contained in:
commit
ee92e62d05
|
|
@ -55,11 +55,11 @@ class PurchaseRequest(models.Model):
|
|||
if not self.employee_id.department_id:
|
||||
raise ValidationError(_("Choose A Department For this Employee!"))
|
||||
line_ids = []
|
||||
for line in self.line_ids:
|
||||
for line in self.line_ids.filtered(lambda line: line.qty_purchased > 0):
|
||||
line_ids.append((0, 6, {
|
||||
'product_id': line.product_id.id,
|
||||
'department_id': line.request_id.department_id.id or False,
|
||||
'product_qty': line.qty-line.available_qty,
|
||||
'product_qty': line.qty_purchased,
|
||||
'name': line.product_id.name,
|
||||
'account_analytic_id': line.account_id.id,
|
||||
}))
|
||||
|
|
@ -90,7 +90,7 @@ class PurchaseRequest(models.Model):
|
|||
for line in self.line_ids.filtered(lambda line: line.qty_purchased > 0):
|
||||
line_ids.append((0, 6, {
|
||||
'product_id': line.product_id.id,
|
||||
'product_qty': line.qty-line.available_qty,
|
||||
'product_qty': line.qty_purchased,
|
||||
'name':line.description or line.product_id.name,
|
||||
'department_name': self.employee_id.department_id.id,
|
||||
'account_analytic_id': line.account_id.id,
|
||||
|
|
@ -127,15 +127,13 @@ class PurchaseRequest(models.Model):
|
|||
available=True
|
||||
|
||||
|
||||
if any(self.line_ids.filtered(lambda line: line.qty > line.available_qty)):
|
||||
if any(self.line_ids.filtered(lambda line: line.qty > line.available_qty and line.product_id.type == 'product' )):
|
||||
context={}
|
||||
view = self.env.ref('purchase_custom_stock.purchase_request_picking_wizard_view_form')
|
||||
wiz = self.env['purchase.request_picking.wizard']
|
||||
context['default_request_id'] = self.id
|
||||
context['default_is_available'] = available
|
||||
|
||||
|
||||
context['default_request_line_ids'] = [(6,0,self.line_ids.filtered(lambda line: line.product_id.type != 'service').ids)]
|
||||
context['default_request_line_ids'] = [(6,0,self.line_ids.filtered(lambda line: line.product_id.type == 'product').ids)]
|
||||
|
||||
return {
|
||||
'name': _('Picking Options'),
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
<button class="oe_stat_button" name="open_picking" type="object"
|
||||
string="Delivery" icon="fa-list-ol"
|
||||
attrs="{'invisible' : [('picking_id' , '=' ,False)]}"
|
||||
groups="purchase.group_purchase_user,purchase.group_purchase_manager"/>
|
||||
groups="stock.group_stock_user,stock.group_stock_manager"/>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//button[@name='action_confirm']" position="after">
|
||||
|
|
|
|||
|
|
@ -16,11 +16,12 @@ class PurcahseRefues(models.TransientModel):
|
|||
|
||||
|
||||
def delivery_close(self):
|
||||
picking_id= self.env.ref('purchase_custom_stock.stock_picking_type_stock')
|
||||
picking_vals = {
|
||||
"picking_type_id": self.env.ref('purchase_custom_stock.stock_picking_type_stock').id,
|
||||
"origin": self.request_id.name,
|
||||
"location_id": self.request_id.location_id.id,
|
||||
"location_dest_id": self.request_id.picking_type_id.default_location_dest_id.id
|
||||
"location_dest_id": picking_id.default_location_dest_id.id
|
||||
}
|
||||
|
||||
move_vals = []
|
||||
|
|
@ -30,7 +31,6 @@ class PurcahseRefues(models.TransientModel):
|
|||
"name": line.product_id.name,
|
||||
"product_uom": line.product_id.uom_id.id,
|
||||
'product_uom_qty': line.available_qty,
|
||||
|
||||
}))
|
||||
picking_vals.update({'move_lines': move_vals})
|
||||
picking_id = self.env['stock.picking'].create(picking_vals)
|
||||
|
|
@ -38,26 +38,35 @@ class PurcahseRefues(models.TransientModel):
|
|||
self.request_id.write({'state': 'employee'})
|
||||
|
||||
def delivery_purchase(self):
|
||||
picking_id= self.env.ref('purchase_custom_stock.stock_picking_type_stock')
|
||||
picking_vals = {
|
||||
"picking_type_id": self.env.ref('purchase_custom_stock.stock_picking_type_stock').id,
|
||||
"origin": self.request_id.name,
|
||||
"location_id": self.request_id.location_id.id,
|
||||
"location_dest_id": self.request_id.picking_type_id.default_location_dest_id.id
|
||||
"location_dest_id": picking_id.default_location_dest_id.id
|
||||
}
|
||||
|
||||
move_vals = []
|
||||
for line in self.request_line_ids:
|
||||
move_vals.append((0, 0, {
|
||||
"product_id": line.product_id.id,
|
||||
"name": line.product_id.name,
|
||||
"product_uom": line.product_id.uom_id.id,
|
||||
'product_uom_qty': line.available_qty,
|
||||
}))
|
||||
line.qty_purchased=line.qty
|
||||
if line.qty < line.available_qty:
|
||||
move_vals.append((0, 0, {
|
||||
"product_id": line.product_id.id,
|
||||
"name": line.product_id.name,
|
||||
"product_uom": line.product_id.uom_id.id,
|
||||
'product_uom_qty': line.qty,
|
||||
}))
|
||||
line.qty_purchased=0
|
||||
else:
|
||||
if line.available_qty > 0:
|
||||
move_vals.append((0, 0, {
|
||||
"product_id": line.product_id.id,
|
||||
"name": line.product_id.name,
|
||||
"product_uom": line.product_id.uom_id.id,
|
||||
'product_uom_qty': line.available_qty,
|
||||
}))
|
||||
line.qty_purchased = line.qty - line.available_qty
|
||||
picking_vals.update({'move_lines': move_vals})
|
||||
picking_id = self.env['stock.picking'].create(picking_vals)
|
||||
for line in self.request_line_ids:
|
||||
line.qty_purchased=line.qty-line.available_qty
|
||||
self.request_id.picking_id = picking_id.id
|
||||
self.request_id.write({'state': 'waiting'})
|
||||
def convert_purchase(self):
|
||||
|
|
|
|||
|
|
@ -1471,7 +1471,7 @@ msgstr "مدير المشتريات"
|
|||
#. module: purchase_requisition_custom
|
||||
#: model:res.groups,name:purchase_requisition_custom.group_purchase_set_to_draft
|
||||
msgid "Purchase set to Draft "
|
||||
msgstr ""
|
||||
msgstr "اعادة الى مسودة"
|
||||
|
||||
#. module: purchase_requisition_custom
|
||||
#: model:ir.model.fields,field_description:purchase_requisition_custom.field_purchase_order__purpose
|
||||
|
|
|
|||
|
|
@ -481,6 +481,8 @@ class PurchaseOrderCustom(models.Model):
|
|||
"""
|
||||
Move document to Wait state
|
||||
"""
|
||||
if self.requisition_id:
|
||||
self.requisition_id.write({'state': 'in_progress'})
|
||||
self.write({'state': 'wait', 'is_signed': False})
|
||||
|
||||
def action_select(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue