commit
f513b2cb34
|
|
@ -249,7 +249,7 @@ msgstr "المستودع"
|
|||
#. module: purchase_custom_stock
|
||||
#: model:ir.model.fields.selection,name:purchase_custom_stock.selection__purchase_request__state__warehouse
|
||||
msgid "Warehouses Department"
|
||||
msgstr "ادارة المسودعات"
|
||||
msgstr "المستودعات"
|
||||
|
||||
#. module: purchase_custom_stock
|
||||
#: model:ir.model,name:purchase_custom_stock.model_purchase_request_picking_wizard
|
||||
|
|
|
|||
|
|
@ -457,24 +457,35 @@ class PurchaseOrderCustom(models.Model):
|
|||
self.requisition_id.state = 'purchase_manager'
|
||||
|
||||
def button_confirm(self):
|
||||
res = super(PurchaseOrderCustom, self).button_confirm()
|
||||
for line in self.order_line:
|
||||
analytic_account = line.account_analytic_id
|
||||
budget_lines = analytic_account.crossovered_budget_line.filtered(
|
||||
lambda x:
|
||||
x.crossovered_budget_id.state == 'done' and
|
||||
fields.Date.from_string(x.date_from) <= fields.Date.from_string(
|
||||
self.date_order) <= fields.Date.from_string(x.date_to))
|
||||
amount = budget_lines.purchase_remain
|
||||
amount += line.price_subtotal
|
||||
budget_lines.write({'purchase_remain': amount})
|
||||
budget_lines.write({'reserve': abs(line.price_subtotal - budget_lines.reserve)})
|
||||
# res = super(PurchaseOrderCustom, self).button_confirm()
|
||||
for order in self:
|
||||
if order.state not in ['draft']:
|
||||
continue
|
||||
order._add_supplier_to_product()
|
||||
# Deal with double validation process
|
||||
if order._approval_allowed():
|
||||
order.button_approve()
|
||||
else:
|
||||
order.write({'state': 'to approve'})
|
||||
if order.partner_id not in order.message_partner_ids:
|
||||
order.message_subscribe([order.partner_id.id])
|
||||
for line in order.order_line:
|
||||
analytic_account = line.account_analytic_id
|
||||
budget_lines = analytic_account.crossovered_budget_line.filtered(
|
||||
lambda x:
|
||||
x.crossovered_budget_id.state == 'done' and
|
||||
fields.Date.from_string(x.date_from) <= fields.Date.from_string(
|
||||
order.date_order) <= fields.Date.from_string(x.date_to))
|
||||
amount = budget_lines.purchase_remain
|
||||
amount += line.price_subtotal
|
||||
budget_lines.write({'purchase_remain': amount})
|
||||
budget_lines.write({'reserve': abs(line.price_subtotal - budget_lines.reserve)})
|
||||
|
||||
if self.requisition_id.id:
|
||||
self.requisition_id.state = 'done'
|
||||
if self.request_id:
|
||||
self.request_id.write({'state': 'done'})
|
||||
return res
|
||||
if order.requisition_id.id:
|
||||
order.requisition_id.state = 'done'
|
||||
if order.request_id:
|
||||
order.request_id.write({'state': 'done'})
|
||||
return True
|
||||
|
||||
|
||||
def action_unsign(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue