fix
This commit is contained in:
parent
64b2254b2e
commit
2ec95099dc
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -127,15 +127,15 @@ 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' )):
|
||||
product=self.line_ids.filtered(lambda line: line.qty > line.available_qty and line.product_id.type == 'product').mapped("product_id.name")
|
||||
print("product",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">
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -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):
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -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
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue