fix purchase file upload
This commit is contained in:
parent
baf04cb515
commit
e0e99b686f
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.
|
|
@ -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(
|
||||
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)})
|
||||
|
||||
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:
|
||||
self.requisition_id.state = 'done'
|
||||
if order.request_id:
|
||||
self.request_id.write({'state': 'done'})
|
||||
return True
|
||||
|
||||
|
||||
def action_unsign(self):
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue