budget updates
This commit is contained in:
parent
ca1261a05a
commit
fc09a14093
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -24,7 +24,7 @@
|
|||
'reports/committee_meeting_minutes_report.xml',
|
||||
'views/budget_confirmation.xml',
|
||||
],
|
||||
'depends': ['stock', 'purchase_requisition', 'exp_analytic', 'project','account_budget_custom'],
|
||||
'depends': ['stock', 'purchase_requisition', 'exp_analytic', 'project','account_budget_custom','account_fiscal_year'],
|
||||
'installable': True,
|
||||
'application': True,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ msgstr "إعتماد"
|
|||
#. module: purchase_requisition_custom
|
||||
#: model_terms:ir.ui.view,arch_db:purchase_requisition_custom.purchase_order_custom_form_view
|
||||
msgid "Approve Order"
|
||||
msgstr "تاكيد امر الشراء"
|
||||
msgstr ""
|
||||
|
||||
#. module: purchase_requisition_custom
|
||||
#: model:res.groups,name:purchase_requisition_custom.group_approve_purchase_requisition
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
from odoo import models,fields,api
|
||||
|
||||
|
||||
class CrossoveredBudgetLines(models.Model):
|
||||
_inherit = "crossovered.budget.lines"
|
||||
|
||||
purchase_remain = fields.Float(compute='_compute_operations_amount_new')
|
||||
|
||||
@api.depends('from_operation_ids', 'to_operation_ids','general_budget_id')
|
||||
def _compute_operations_amount_new(self):
|
||||
for item in self:
|
||||
purchase_order_lines = item.env['purchase.order.line'].search([('order_id.state', '=', 'purchase'), ('order_id.budget_id', '=', item.crossovered_budget_id.id),
|
||||
('account_analytic_id','=',item.analytic_account_id.id)])
|
||||
not_invoiced_lines = purchase_order_lines.filtered(lambda x: x.order_id.invoice_status != 'invoiced')
|
||||
not_invoiced_amount = sum(not_invoiced_lines.mapped('price_total'))
|
||||
item.reserve = not_invoiced_amount
|
||||
|
||||
vendor_invoices = item.env['account.move.line'].search([('move_id.state', '=', 'posted'), ('move_id.move_type', '=', 'in_invoice'),
|
||||
('move_id.invoice_date_due', '>=', fields.Date.today()),
|
||||
|
||||
('analytic_account_id', '=', item.analytic_account_id.id),
|
||||
'|', ('purchase_order_id.budget_id', '=', item.crossovered_budget_id.id),('move_id.purchase_id.budget_id', '=', item.crossovered_budget_id.id)])
|
||||
|
||||
due_amount = sum(vendor_invoices.mapped('move_id').mapped('amount_residual'))
|
||||
item.purchase_remain = due_amount
|
||||
|
|
@ -22,17 +22,17 @@ class BudgetConfirmationCustom(models.Model):
|
|||
rec.po_id.write({'state': 'budget_rejected'})
|
||||
body = _(
|
||||
"Purchase Order %s is Rejected By : %s With Reject Reason : %s" % (
|
||||
str(rec.name), str(rec.env.user.name), str(rec.reject_reason)))
|
||||
str(rec.name), str(rec.env.user.name), str(rec.reject_reason or self.env.context.get('reject_reason',''))))
|
||||
# Send Notifications
|
||||
subject = _('Reject Purchase Order')
|
||||
author_id = rec.env.user.partner_id.id or None
|
||||
rec.create_uid.partner_id.send_notification_message(subject=subject, body=body, author_id=author_id)
|
||||
rec.po_id.message_post(body=body)
|
||||
if rec.request_id and rec.type == 'purchase.request':
|
||||
rec.request_id.write({'state': 'send_budget'})
|
||||
rec.request_id.write({'state': 'refuse'})
|
||||
body = _(
|
||||
"Purchase Request %s is Rejected By : %s With Reject Reason : %s" % (
|
||||
str(rec.name), str(rec.env.user.name), str(rec.reject_reason)))
|
||||
str(rec.name), str(rec.env.user.name), str(rec.reject_reason or self.env.context.get('reject_reason',''))))
|
||||
# Send Notifications
|
||||
subject = _('Reject Purchase Request Budget Confirmation')
|
||||
author_id = rec.env.user.partner_id.id or None
|
||||
|
|
@ -55,14 +55,14 @@ class BudgetConfirmationCustom(models.Model):
|
|||
amount = rec.reserve
|
||||
amount += line.amount
|
||||
budget_lines.write({'reserve': amount})
|
||||
if self.po_id and self.po_id.requisition_id:
|
||||
self.po_id.write({'state': 'to approve'}) # draft
|
||||
self.po_id.requisition_id.write({'state': 'checked'})
|
||||
elif self.po_id:
|
||||
# if self.po_id.email_to_vendor:
|
||||
# self.po_id.write({'state': 'sent'})
|
||||
# else:
|
||||
self.po_id.write({'state': 'draft'})
|
||||
|
||||
if self.po_id.requisition_id:
|
||||
self.po_id.requisition_id.write({'state': 'checked'})
|
||||
if self.po_id:
|
||||
self.po_id.write({'state': 'to approve'})
|
||||
if self.request_id and self.type == 'purchase.request':
|
||||
# Update reserve of budget_lines
|
||||
self.request_id.write({'state': 'waiting'})
|
||||
|
||||
class CrossoveredBudgetLines(models.Model):
|
||||
_inherit = "crossovered.budget.lines"
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ class PurchaseOrderCustom(models.Model):
|
|||
line.account_analytic_id = line.department_name.analytic_account_id
|
||||
|
||||
def button_draft(self):
|
||||
self.write({'state': 'wait'})
|
||||
self.write({'state': 'draft'})
|
||||
|
||||
def button_cancel(self):
|
||||
budgets = self.env['budget.confirmation'].search([
|
||||
|
|
@ -327,7 +327,7 @@ class PurchaseOrderCustom(models.Model):
|
|||
def action_skip_budget(self):
|
||||
""" Skip purchase budget"""
|
||||
for po_id in self:
|
||||
if po_id.state == 'wait_for_send' or po_id.request_id:
|
||||
if po_id.state == 'wait_for_send':
|
||||
# Deal with double validation process
|
||||
valid_amount = self.env.user.company_id.currency_id.compute(
|
||||
po_id.company_id.po_double_validation_amount, po_id.currency_id)
|
||||
|
|
@ -473,7 +473,7 @@ class PurchaseOrderCustom(models.Model):
|
|||
if self.requisition_id.id:
|
||||
self.requisition_id.state = 'done'
|
||||
if self.request_id:
|
||||
self.request_id.write({'state': 'employee'})
|
||||
self.request_id.write({'state': 'done'})
|
||||
return res
|
||||
|
||||
|
||||
|
|
@ -481,8 +481,6 @@ 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):
|
||||
|
|
@ -673,10 +671,10 @@ class ProductCustom(models.Model):
|
|||
'Sale Price: ') + '{}'.format(product.list_price) + '\n' + _('Description: ') + '{}'.format(
|
||||
product.description) + '\n' + _('On Date: ') + '{}'.format(fields.Date.today()) + '\n' + _(
|
||||
'Created By: ') + '{}'.format(self.env.user.name)
|
||||
# group = self.env.ref('purchase.group_purchase_manager')
|
||||
group = 'purchase.group_purchase_manager'
|
||||
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,
|
||||
)
|
||||
group=group)
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class PurchaseRequest(models.Model):
|
|||
domain="['|', ('warehouse_id', '=', False), ('warehouse_id.company_id', '=', company_id)]",
|
||||
help="This will determine operation type of incoming shipment")
|
||||
|
||||
purchase_create = fields.Boolean(string='Purchase Create')
|
||||
purchase_create = fields.Boolean(string='Purchase Create',copy=False)
|
||||
by_purchase = fields.Boolean('Requested by Purchase')
|
||||
type = fields.Selection([('project', 'Project'), ('operational', 'Operational')], default='operational')
|
||||
edit_partner_id = fields.Boolean(compute="compute_edit_partner_id")
|
||||
|
|
|
|||
|
|
@ -32,4 +32,3 @@ purchase_request_create_purchase_request_stock,stock move create_purchase_reques
|
|||
|
||||
committe_group_direct_manger,committe_group_direct_manger,model_committe_member,purchase_requisition_custom.group_direct_manger,1,1,1,1
|
||||
|
||||
physical_member_purchase_manager,physiacl_purchase_manager,account_fiscal_year.model_fiscalyears_periods,purchase.group_purchase_manager,1,1,0,0
|
||||
|
|
|
@ -139,7 +139,7 @@
|
|||
|
||||
<button string='PO To Contract' name="open_convert_po_contract" type="object"
|
||||
class="oe_highlight" groups="purchase.group_purchase_manager"
|
||||
attrs="{'invisible':[('state','in',('draft','wait','wait_for_send','sent','to approve','sign','waiting','done','purchase','cancel'))]}"/>
|
||||
attrs="{'invisible':[('state','in',('draft','wait','wait_for_send','sent','to approve','sign','waiting','purchase','cancel'))]}"/>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//field[@name='date_order']" position="after">
|
||||
|
|
@ -151,7 +151,7 @@
|
|||
<attribute name="groups">purchase.group_purchase_manager</attribute>
|
||||
<attribute name="states">""</attribute>
|
||||
<attribute name="attrs">
|
||||
{'invisible':[('state','in',('wait','wait_for_send','sign','sent','to approve','done','waiting','purchase','cancel'))]}
|
||||
{'invisible':[('state','in',('wait','wait_for_send','sign','sent','to approve','waiting','purchase','cancel'))]}
|
||||
</attribute>
|
||||
</xpath>
|
||||
<xpath expr="/form/header/button[@id='bid_confirm']" position="attributes">
|
||||
|
|
|
|||
|
|
@ -56,26 +56,26 @@
|
|||
</record>
|
||||
|
||||
|
||||
<record id="res_partner_documents" model="ir.ui.view">
|
||||
<field name="name">res.partner.inherit.view.form</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[last()]" position="after">
|
||||
<page string="Documents">
|
||||
<field name="documents_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="name" required="1"/>
|
||||
<field name="attachment" required="1"/>
|
||||
<field name="type_id"/>
|
||||
<field name="exp_date"/>
|
||||
<!-- <record id="res_partner_documents" model="ir.ui.view">-->
|
||||
<!-- <field name="name">res.partner.inherit.view.form</field>-->
|
||||
<!-- <field name="model">res.partner</field>-->
|
||||
<!-- <field name="inherit_id" ref="base.view_partner_form"/>-->
|
||||
<!-- <field name="arch" type="xml">-->
|
||||
<!-- <xpath expr="//page[last()]" position="after">-->
|
||||
<!-- <page string="Documents">-->
|
||||
<!-- <field name="documents_ids">-->
|
||||
<!-- <tree editable="bottom">-->
|
||||
<!-- <field name="name" required="1"/>-->
|
||||
<!-- <field name="attachment" required="1"/>-->
|
||||
<!-- <field name="type_id"/>-->
|
||||
<!-- <field name="exp_date"/>-->
|
||||
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</xpath>
|
||||
<!-- </tree>-->
|
||||
<!-- </field>-->
|
||||
<!-- </page>-->
|
||||
<!-- </xpath>-->
|
||||
|
||||
|
||||
</field>
|
||||
</record>
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
</odoo>
|
||||
Loading…
Reference in New Issue