Skip to content

Commit

Permalink
Merge pull request #10 from lepistone/port_framework_agreement_requis…
Browse files Browse the repository at this point in the history
…ition

port framework_agreement_requisition
  • Loading branch information
gurneyalex committed Oct 31, 2014
2 parents 350f5f4 + 7bf14b5 commit ee60be7
Show file tree
Hide file tree
Showing 15 changed files with 357 additions and 80 deletions.
21 changes: 21 additions & 0 deletions framework_agreement_requisition/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Negociate framework agreement in the Tender
===========================================

This module allows you to negociate a framework agreement in the Tender.

To to so you have to check the box "Negociate Agreement".

The module add a state "Agreement selected" on the tender and on the Purchase
Order.

These will be the final state once you have chosen the agreement that best fits
your needs.

Once the selection is done just use the button "Agreement selected" on the
tender. That will close the flow of tender and the related PO accordingly.

Future Improvements
===================

The generated framework agreement does not contain the negociated prices.
Those need to be filled in manually.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2013 Camptocamp SA
# Copyright 2013, 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand All @@ -19,3 +19,4 @@
#
##############################################################################
from . import model
from . import wizard
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2013 Camptocamp SA
# Copyright 2013, 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand All @@ -18,41 +18,25 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{'name': 'Framework Agreement Negociation',
'version': '0.1',
{'name': 'Framework Agreement Negociation in the Tender',
'version': '1.0',
'author': 'Camptocamp',
'maintainer': 'Camptocamp',
'category': 'NGO',
'complexity': 'normal',
'depends': ['purchase_requisition',
'purchase_requisition_extended',
'purchase_requisition_bid_selection',
'framework_agreement'],
'description': """
Negociate framework agreement using tender process
==================================================
This will allows you to use "The calls for Bids" model
to negociate agreement.
To to so you have too check the box "Negociate Agreement".
The module add a state "Agreement selected" on tender and PO.
These will be the final state once you have choosen
the agreement that fit your needs the best.
Once the selection is done juste use the button "Agreement selected" on tender
That will close flow of tender and related PO accordingly.
""",
'website': 'http://www.camptocamp.com',
'data': ['requisition_workflow.xml',
'purchase_workflow.xml',
'view/purchase_requisition_view.xml'],
'view/purchase_requisition.xml',
'view/purchase_order.xml',
'wizard/confirm_generate_agreement.xml'
],
'demo': [],
'test': ['test/agreement_requisition.yml'],
'installable': False,
'installable': True,
'auto_install': False,
'license': 'AGPL-3',
'application': False,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * framework_agreement_requisition
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-10-30 18:21+0000\n"
"PO-Revision-Date: 2014-10-30 18:21+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: framework_agreement_requisition
#: view:confirm.generate.agreement:framework_agreement_requisition.confirm_generate_agreement_form_view
msgid "Cancel"
msgstr ""

#. module: framework_agreement_requisition
#: view:confirm.generate.agreement:framework_agreement_requisition.confirm_generate_agreement_form_view
msgid "Confirm"
msgstr ""

#. module: framework_agreement_requisition
#: field:confirm.generate.agreement,create_uid:0
msgid "Created by"
msgstr ""

#. module: framework_agreement_requisition
#: field:confirm.generate.agreement,create_date:0
msgid "Created on"
msgstr ""

#. module: framework_agreement_requisition
#: view:purchase.order:framework_agreement_requisition.view_purchase_order_filter
#: field:purchase.order,for_agreement:0
msgid "For Framework Agreement"
msgstr ""

#. module: framework_agreement_requisition
#: view:purchase.requisition:framework_agreement_requisition.view_purchase_requisition_filter
msgid "Framework Agreement Negociation"
msgstr ""

#. module: framework_agreement_requisition
#: view:purchase.requisition:framework_agreement_requisition.view_purchase_requisition_form_agreement
msgid "Framework agreement selected"
msgstr ""

#. module: framework_agreement_requisition
#: code:addons/framework_agreement_requisition/model/purchase_requisition.py:137
#, python-format
msgid "Generated Agreements"
msgstr ""

#. module: framework_agreement_requisition
#: field:confirm.generate.agreement,id:0
msgid "ID"
msgstr ""

#. module: framework_agreement_requisition
#: code:addons/framework_agreement_requisition/model/purchase_requisition.py:97
#, python-format
msgid "Invalid tender"
msgstr ""

#. module: framework_agreement_requisition
#: field:purchase.order,agreement_expected_date:0
#: field:purchase.requisition,agreement_end_date:0
msgid "LTA expected valitidy period"
msgstr ""

#. module: framework_agreement_requisition
#: field:purchase.order,agreement_promised_date:0
msgid "LTA promised valitidy period"
msgstr ""

#. module: framework_agreement_requisition
#: field:confirm.generate.agreement,write_uid:0
msgid "Last Updated by"
msgstr ""

#. module: framework_agreement_requisition
#: field:confirm.generate.agreement,write_date:0
msgid "Last Updated on"
msgstr ""

#. module: framework_agreement_requisition
#: field:purchase.requisition,framework_agreement_tender:0
msgid "Negociate Agreement"
msgstr ""

#. module: framework_agreement_requisition
#: code:addons/framework_agreement_requisition/model/purchase_requisition.py:118
#, python-format
msgid "No confirmed RFQ related to tender"
msgstr ""

#. module: framework_agreement_requisition
#: code:addons/framework_agreement_requisition/model/purchase_requisition.py:119
#, python-format
msgid "Please choose at least one"
msgstr ""

#. module: framework_agreement_requisition
#: model:ir.model,name:framework_agreement_requisition.model_purchase_order
msgid "Purchase Order"
msgstr ""

#. module: framework_agreement_requisition
#: model:ir.model,name:framework_agreement_requisition.model_purchase_order_line
msgid "Purchase Order Line"
msgstr ""

#. module: framework_agreement_requisition
#: model:ir.model,name:framework_agreement_requisition.model_purchase_requisition
msgid "Purchase Requisition"
msgstr ""

#. module: framework_agreement_requisition
#: code:addons/framework_agreement_requisition/model/purchase_requisition.py:98
#, python-format
msgid "Request is not of type agreement"
msgstr ""

#. module: framework_agreement_requisition
#: constraint:purchase.order.line:0
#: sql_constraint:purchase.order.line:0
msgid "Selected quantity must be less or equal than the quantity in the bid"
msgstr ""

#. module: framework_agreement_requisition
#: view:confirm.generate.agreement:framework_agreement_requisition.confirm_generate_agreement_form_view
msgid "The chosen bid will now be converted into a Long Term Agreement.\n"
" Please note that at the moment you will need to manually set the\n"
" price in the agreement."
msgstr ""

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2013 Camptocamp SA
# Copyright 2013, 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2013 Camptocamp SA
# Copyright 2013, 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
Expand All @@ -18,8 +18,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import netsvc
from openerp.osv import orm
from openerp import api
from openerp.osv import orm, fields

SELECTED_STATE = ('agreement_selected', 'Agreement selected')
AGR_SELECT = 'agreement_selected'
Expand All @@ -30,20 +30,26 @@ class purchase_order(orm.Model):

_inherit = "purchase.order"

_columns = {
'for_agreement': fields.boolean('For Framework Agreement'),
'agreement_expected_date': fields.date('LTA expected valitidy period'),
'agreement_promised_date': fields.date('LTA promised valitidy period'),
}

def __init__(self, pool, cr):
"""Add a new state value using PO class property"""
if SELECTED_STATE not in super(purchase_order, self).STATE_SELECTION:
super(purchase_order, self).STATE_SELECTION.append(SELECTED_STATE)
return super(purchase_order, self).__init__(pool, cr)
super(purchase_order, self).__init__(pool, cr)

@api.cr_uid_id_context
def select_agreement(self, cr, uid, agr_id, context=None):
"""Pass PO in state 'Agreement selected'"""
if isinstance(agr_id, (list, tuple)):
assert len(agr_id) == 1
agr_id = agr_id[0]
wf_service = netsvc.LocalService("workflow")
return wf_service.trg_validate(uid, 'purchase.order',
agr_id, 'select_agreement', cr)
return self.signal_workflow(cr, uid, [agr_id], 'select_agreement',
context=context)

def po_tender_agreement_selected(self, cr, uid, ids, context=None):
"""Workflow function that write state 'Agreement selected'"""
Expand All @@ -58,24 +64,29 @@ class purchase_order_line(orm.Model):

# Did you know a good way to supress SQL constraint to add
# Python constraint...
_sql_constraints = [
('quantity_bid', 'CHECK(true)',
'Selected quantity must be less or equal than the quantity in the bid'),
]
_sql_constraints = [(
'quantity_bid',
'CHECK(true)',
'Selected quantity must be less or equal than the quantity in the bid'
)]

def _check_quantity_bid(self, cr, uid, ids, context=None):
for line in self.browse(cr, uid, ids, context=context):
if line.order_id.framework_agreement_id:
continue
if line.product_id.type == 'product' and not line.quantity_bid <= line.product_qty:
if (
line.product_id.type == 'product'
and not line.quantity_bid <= line.product_qty
):
return False
return True

_constraints = [
(_check_quantity_bid,
'Selected quantity must be less or equal than the quantity in the bid',
[])
]
_constraints = [(
_check_quantity_bid,
'Selected quantity must be less or equal than the quantity in the bid',
[]
)]

def _agreement_data(self, cr, uid, po_line, origin, context=None):
"""Get agreement values from PO line
Expand All @@ -87,7 +98,7 @@ def _agreement_data(self, cr, uid, po_line, origin, context=None):
vals['supplier_id'] = po_line.order_id.partner_id.id
vals['product_id'] = po_line.product_id.id
vals['quantity'] = po_line.product_qty
vals['delay'] = po_line.product_lead_time
vals['delay'] = po_line.product_id.seller_delay
vals['origin'] = origin if origin else False
return vals

Expand Down
Loading

0 comments on commit ee60be7

Please sign in to comment.