@ -0,0 +1,48 @@ |
|||
.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg |
|||
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
|||
:alt: License: LGPL-3 |
|||
|
|||
Odoo Vendor Portal |
|||
================== |
|||
* This module helps to sent quotations for a product to multiple vendors and vendors can add their price in their portal and can choose best quotation for product. |
|||
|
|||
Configuration |
|||
============= |
|||
* No additional configurations needed |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
General Public License, Version 3 (LGPL v3). |
|||
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
* Developer: (V17) Ashwin A, |
|||
(V18) Akhil, |
|||
Contact: odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,24 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import controllers |
|||
from . import models |
|||
from . import wizard |
@ -0,0 +1,54 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
{ |
|||
'name': 'Odoo Vendor Portal', |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Purchases', |
|||
'summary': """Vendor Portal Management in Odoo""", |
|||
'description': """This module helps to sent quotations for a product |
|||
to multiple vendors and vendors can add their |
|||
price in their portal, and can choose best quotation for product""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'website': "https://www.cybrosys.com", |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'depends': ['website', 'purchase', 'portal', 'contacts', 'stock'], |
|||
'data': [ |
|||
'security/vendor_rfq_security.xml', |
|||
'security/ir.model.access.csv', |
|||
'data/rfq_sequence.xml', |
|||
'data/rfq_mail_templates.xml', |
|||
'data/rfq_cron.xml', |
|||
'wizard/register_vendor_views.xml', |
|||
'views/res_partner_views.xml', |
|||
'views/vendor_rfq_views.xml', |
|||
'views/res_config_settings_views.xml', |
|||
'views/portal_rfq_templates.xml', |
|||
'views/vendor_portal_menus.xml', |
|||
'wizard/rfq_done_views.xml', |
|||
], |
|||
'images': ['static/description/banner.png'], |
|||
'license': 'LGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': True, |
|||
} |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import vendor_portal_odoo |
@ -0,0 +1,144 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from collections import OrderedDict |
|||
from odoo import http, _ |
|||
from odoo.http import request |
|||
from odoo.addons.portal.controllers.portal import pager as portal_pager, \ |
|||
CustomerPortal |
|||
|
|||
|
|||
class RFQCustomerPortal(CustomerPortal): |
|||
|
|||
def _prepare_home_portal_values(self, counter): |
|||
"""Retrieves and prepares the values to be displayed on the home portal |
|||
for the user.""" |
|||
values = super()._prepare_home_portal_values(counter) |
|||
partner_id = request.env.user.partner_id |
|||
values['my_rfq_count'] = request.env['vendor.rfq'].sudo().search_count( |
|||
[('vendor_ids', 'in', partner_id.ids), |
|||
('state', 'not in', ['draft'])]) |
|||
return values |
|||
|
|||
def _rfq_get_page_view_values(self, vendor_rfq, access_token, **kwargs): |
|||
"""RFQ Page values""" |
|||
values = { |
|||
'page_name': 'vendor_rfq', |
|||
'vendor_rfq': vendor_rfq, |
|||
} |
|||
return self._get_page_view_values(vendor_rfq, access_token, values, |
|||
'my_rfq_history', False, **kwargs) |
|||
|
|||
@http.route(['/my/vendor_rfqs', '/my/vendor_rfqs/page/<int:page>'], |
|||
type='http', auth="public", website=True) |
|||
def portal_my_vendor_rfqs(self, page=1, date_begin=None, |
|||
date_end=None, sortby=None, filterby=None, **kw): |
|||
""" Displays the portal page for vendor RFQs (Request for Quotations) |
|||
for the logged-in user.This method is responsible for rendering the |
|||
vendor RFQs in the portal with various filtering, sorting, and |
|||
pagination options.""" |
|||
values = self._prepare_portal_layout_values() |
|||
user_partner = request.env.user.partner_id |
|||
vendor_rfq = request.env['vendor.rfq'].sudo().search([]) |
|||
domain = [ |
|||
('vendor_ids', 'in', user_partner.ids), |
|||
('state', 'not in', ['draft'])] |
|||
if date_begin and date_end: |
|||
domain += [('create_date', '>', date_begin), |
|||
('create_date', '<=', date_end)] |
|||
|
|||
searchbar_sortings = { |
|||
'date': {'label': _('Newest'), |
|||
'order': 'create_date desc, id desc'}, |
|||
'name': {'label': _('Name'), 'order': 'name asc, id asc'}, |
|||
} |
|||
if not sortby: |
|||
sortby = 'name' |
|||
order = searchbar_sortings[sortby]['order'] |
|||
searchbar_filters = { |
|||
'all': {'label': _('All'), 'domain': [ |
|||
('state', 'in', ['draft', 'in_progress', 'pending', |
|||
'done', 'cancel'])]}, |
|||
'Done': {'label': _('Done'), 'domain': [('state', '=', 'done')]}, |
|||
'In Progress': {'label': _('In Progress'), |
|||
'domain': [('state', '=', 'in_progress')]}, |
|||
} |
|||
# default filter by value |
|||
if not filterby: |
|||
filterby = 'all' |
|||
domain += searchbar_filters[filterby]['domain'] |
|||
rfq_unit_count = vendor_rfq.search_count(domain) |
|||
pager = portal_pager( |
|||
url="/my/vendor_rfqs", |
|||
url_args={'date_begin': date_begin, 'date_end': date_end, |
|||
'sortby': sortby, 'filterby': filterby}, |
|||
total=rfq_unit_count, |
|||
page=page, |
|||
step=self._items_per_page |
|||
) |
|||
|
|||
orders = vendor_rfq.search( |
|||
domain, |
|||
order=order, |
|||
limit=self._items_per_page, |
|||
offset=pager['offset'] |
|||
) |
|||
values.update({ |
|||
'date': date_begin, |
|||
'rfqs': orders, |
|||
'page_name': 'vendor_rfq', |
|||
'pager': pager, |
|||
'searchbar_sortings': searchbar_sortings, |
|||
'sortby': sortby, |
|||
'searchbar_filters': OrderedDict(sorted(searchbar_filters.items())), |
|||
'filterby': filterby, |
|||
'default_url': '/my/vendor_rfqs', |
|||
}) |
|||
return request.render( |
|||
"vendor_portal_odoo.portal_my_rfq", |
|||
values) |
|||
|
|||
@http.route(['/my/vendor_rfq/<int:rfq_id>'], type='http', auth="public", |
|||
website=True) |
|||
def portal_my_vendor_rfq(self, rfq_id, access_token=None, **kw): |
|||
""" Displays the details of a specific vendor RFQ (Request for Quotation) |
|||
for the logged-in user.""" |
|||
rfq_details = request.env['vendor.rfq'].sudo().browse(int(rfq_id)) |
|||
vendor_quote = rfq_details.vendor_quote_history_ids.filtered( |
|||
lambda x: x.vendor_id.id == request.env.user.partner_id.id) |
|||
quoted_price = vendor_quote.quoted_price |
|||
values = self._rfq_get_page_view_values(rfq_details, access_token, **kw) |
|||
values['quoted_price'] = quoted_price |
|||
values['vendor_quote'] = vendor_quote |
|||
return request.render( |
|||
"vendor_portal_odoo.portal_my_vendor_rfq", values) |
|||
|
|||
@http.route(['/quote/details'], type='http', auth="public", website=True) |
|||
def quote_details(self, **post): |
|||
"""Handle the submission of a vendor's quote details.""" |
|||
request.env['vendor.quote.history'].sudo().create({ |
|||
'vendor_id': request.env.user.partner_id.id, |
|||
'quoted_price': float(post.get('price')), |
|||
'estimate_date': post.get('delivery_date'), |
|||
'note': post.get('additional_note'), |
|||
'quote_id': post.get('rfq_id'), |
|||
}) |
|||
return request.redirect('/my/vendor_rfq/%s' % (post.get('rfq_id'))) |
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- Cron job for Done the RFQ--> |
|||
<record id="ir_cron_quote_rfq" model="ir.cron"> |
|||
<field name="name">Set RFQs as Done</field> |
|||
<field name="model_id" ref="model_vendor_rfq"/> |
|||
<field name="state">code</field> |
|||
<field name="code">model.set_rfq_done()</field> |
|||
<field name="user_id" ref="base.user_root"/> |
|||
<field name="interval_number">1</field> |
|||
<field name="interval_type">days</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,77 @@ |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<odoo> |
|||
<data> |
|||
<!-- Template for RFQ--> |
|||
<record id="email_template_vendor_rfq_request" model="mail.template"> |
|||
<field name="name">Purchase Order: Send RFQ</field> |
|||
<field name="model_id" ref="vendor_portal_odoo.model_vendor_rfq"/> |
|||
<field name="subject">RFQ Request</field> |
|||
<field name="partner_to">{{ ctx.get('partner_to') }}</field> |
|||
<field name="body_html" type="html"> |
|||
<div style="margin: 0px; padding: 0px;"> |
|||
<p style="margin: 0px; padding: 0px; font-size: 13px;"> |
|||
Dear <t t-out="ctx.get('name') or ''"/>, |
|||
<br/> |
|||
<br/> |
|||
We would like to request a quotation for the Product |
|||
<strong t-out="object.product_id.name or ''"/> |
|||
of |
|||
<strong t-out="object.quantity"/> |
|||
<t t-out="object.uom_id.name"/> |
|||
Quantity from you. |
|||
<br/> |
|||
<br/> |
|||
If you are interested, please check and let us know the quote |
|||
<br/> |
|||
<br/> |
|||
Best regards, |
|||
<br/> |
|||
<t t-out="object.user_id.name"/> |
|||
</p> |
|||
</div> |
|||
</field> |
|||
<field name="lang">{{ ctx.get('lang') }}</field> |
|||
<field name="auto_delete" eval="True"/> |
|||
</record> |
|||
<!-- Template for Accepted Quote--> |
|||
<record id="email_template_vendor_rfq_mark_done" model="mail.template"> |
|||
<field name="name">Purchase Order: Quote Accepted</field> |
|||
<field name="model_id" ref="vendor_portal_odoo.model_vendor_rfq"/> |
|||
<field name="subject">Quote Accepted</field> |
|||
<field name="partner_to">{{ ctx.get('partner_to') }}</field> |
|||
<field name="body_html" type="html"> |
|||
<div style="margin: 0px; padding: 0px;"> |
|||
<p style="margin: 0px; padding: 0px; font-size: 13px;"> |
|||
Dear<t t-out="ctx.get('name') or ''"/>, |
|||
<br/> |
|||
<br/> |
|||
We want to let you know that we accept your quoted price of |
|||
<strong t-esc="ctx.get('price') or ''" |
|||
t-options='{"widget": "monetary", "display_currency": ctx.get("currency_id")}'/> |
|||
for the |
|||
<strong t-out="object.product_id.name or ''"/> |
|||
within your specified delivery date |
|||
<strong t-out="ctx.get('delivery_date') or ''"/> |
|||
from you. |
|||
<br/> |
|||
<br/> |
|||
We'd like to buy |
|||
<strong t-out="object.quantity or ''"/> |
|||
units of |
|||
<strong t-out="object.product_id.name or ''"/> |
|||
from you by the estimated date. |
|||
<br/> |
|||
We will send you a purchase order as soon as possible. |
|||
<br/> |
|||
<br/> |
|||
Best regards, |
|||
<br/> |
|||
<t t-out="object.user_id.name"/> |
|||
</p> |
|||
</div> |
|||
</field> |
|||
<field name="lang">{{ ctx.get('lang') }}</field> |
|||
<field name="auto_delete" eval="True"/> |
|||
</record> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<odoo> |
|||
<data noupdate="1"> |
|||
<!-- Sequence of vendor RFQ--> |
|||
<record id="seq_vendor_rfq" model="ir.sequence"> |
|||
<field name="name">RFQ Sequence</field> |
|||
<field name="code">vendor.rfq</field> |
|||
<field name="prefix">RFQ</field> |
|||
<field name="padding">5</field> |
|||
<field name="company_id" eval="False"/> |
|||
</record> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,6 @@ |
|||
## Module <vendor_portal_odoo> |
|||
|
|||
#### 26.03.2025 |
|||
#### Version 18.0.1.0.0 |
|||
##### ADD |
|||
-Initial Commit for Odoo Vendor Portal |
@ -0,0 +1,25 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import res_config_settings |
|||
from . import res_partner |
|||
from . import vendor_quote_history |
|||
from . import vendor_rfq |
@ -0,0 +1,73 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class ResConfigSettings(models.TransientModel): |
|||
"""Class used to add field to res.config.settings""" |
|||
_inherit = 'res.config.settings' |
|||
|
|||
rfq_done_based_on = fields.Selection([ |
|||
('based_on_price', 'Minimum Quoted Price'), |
|||
('based_on_delivery_time', 'Minimum Delivery time') |
|||
], string="Set RFQs Based on", default='based_on_price', help='RFQ Based On') |
|||
quote_submission_msg = fields.Text("Quote Submission", |
|||
help="Status message to display if a quote was submitted") |
|||
quote_accept_msg = fields.Text("Quote Acceptance", |
|||
help="Status message to display if a quote was accepted") |
|||
quote_not_accept_msg = fields.Text("Quote not Accepted", |
|||
help="Status message to display if a quote was not accepted" |
|||
) |
|||
quote_cancel_msg = fields.Text("Quote Cancelled", |
|||
help="Status message to display if a quote was cancelled") |
|||
quote_to_po_msg = fields.Text("PO created for the RFQ", |
|||
help="Status message to display if a quote was converted to PO") |
|||
|
|||
def set_values(self): |
|||
"""Setting field values""" |
|||
res = super(ResConfigSettings, self).set_values() |
|||
config_parm = self.env['ir.config_parameter'].sudo() |
|||
config_parm.set_param( |
|||
'vendor_portal_odoo.rfq_done_based_on', self.rfq_done_based_on) |
|||
config_parm.set_param( |
|||
'vendor_portal_odoo.quote_submission_msg', self.quote_submission_msg) |
|||
config_parm.set_param( |
|||
'vendor_portal_odoo.quote_accept_msg', self.quote_accept_msg) |
|||
config_parm.set_param( |
|||
'vendor_portal_odoo.quote_not_accept_msg', self.quote_not_accept_msg) |
|||
config_parm.set_param( |
|||
'vendor_portal_odoo.quote_cancel_msg', self.quote_cancel_msg) |
|||
config_parm.set_param( |
|||
'vendor_portal_odoo.quote_to_po_msg', self.quote_to_po_msg) |
|||
return res |
|||
|
|||
def get_values(self): |
|||
"""Getting field values""" |
|||
res = super(ResConfigSettings, self).get_values() |
|||
config_parm = self.env['ir.config_parameter'].sudo() |
|||
res['rfq_done_based_on'] = config_parm.get_param('vendor_portal_odoo.rfq_done_based_on') |
|||
res['quote_submission_msg'] = config_parm.get_param('vendor_portal_odoo.quote_submission_msg') |
|||
res['quote_accept_msg'] = config_parm.get_param('vendor_portal_odoo.quote_accept_msg') |
|||
res['quote_not_accept_msg'] = config_parm.get_param('vendor_portal_odoo.quote_not_accept_msg') |
|||
res['quote_cancel_msg'] = config_parm.get_param('vendor_portal_odoo.quote_cancel_msg') |
|||
res['quote_to_po_msg'] = config_parm.get_param('vendor_portal_odoo.quote_to_po_msg') |
|||
return res |
@ -0,0 +1,32 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class ResPartner(models.Model): |
|||
"""Class used to add field to res.partner for differentiate |
|||
registered vendors""" |
|||
_inherit = 'res.partner' |
|||
|
|||
is_registered = fields.Boolean("Is Registered Vendor", default=False, |
|||
help="To denote the is the partner is " |
|||
"registered as vendor") |
@ -0,0 +1,44 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class VendorQuoteHistory(models.Model): |
|||
"""Vendor Quotation History""" |
|||
_name = 'vendor.quote.history' |
|||
_description = "Vendor Quotation History" |
|||
_rec_name = 'vendor_id' |
|||
|
|||
vendor_id = fields.Many2one('res.partner', |
|||
domain="[('is_registered', '=', True)]", |
|||
string="Vendor", |
|||
help="Select Vendor") |
|||
quoted_price = fields.Monetary(currency_field='currency_id', |
|||
help="Quoted Price") |
|||
currency_id = fields.Many2one('res.currency', string='Currency', |
|||
help="Currency", |
|||
required=True, |
|||
default=lambda |
|||
self: self.env.user.company_id.currency_id) |
|||
estimate_date = fields.Date(string="Estimate date", help="Estimated Date") |
|||
note = fields.Text(string="Note", help="Additional Note") |
|||
quote_id = fields.Many2one('vendor.rfq', help="Quote ID") |
@ -0,0 +1,184 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import api, fields, models, _ |
|||
|
|||
|
|||
class VendorRFQ(models.Model): |
|||
"""Vendor RFQ model""" |
|||
_name = 'vendor.rfq' |
|||
_inherit = ['mail.thread', 'mail.activity.mixin'] |
|||
_description = 'Vendor RFQ' |
|||
|
|||
name = fields.Char('RFQ Reference', required=True, index=True, |
|||
help="Name", copy=False, default=lambda x: _('New')) |
|||
product_id = fields.Many2one('product.product', string='Product', |
|||
help="Select Product") |
|||
quantity = fields.Float(string="Quantity", help="Quantity Required") |
|||
uom_id = fields.Many2one('uom.uom', string='UoM', help="UOM") |
|||
estimated_quote = fields.Monetary("Estimated Quote", |
|||
currency_field='currency_id', |
|||
help="Estimated Quote Price") |
|||
currency_id = fields.Many2one('res.currency', string='Currency', |
|||
help="Currency", |
|||
required=True, |
|||
default=lambda |
|||
self: self.env.user.company_id.currency_id) |
|||
notes = fields.Html(string='Notes', help="Additional Note") |
|||
estimated_delivery_date = fields.Date(string="Delivery date", |
|||
help="Vendor's delivery date") |
|||
quote_date = fields.Date(default=fields.Datetime.now(), help="Quote Date ") |
|||
closing_date = fields.Date(string="Closing date", |
|||
help="Quotation closing date") |
|||
vendor_ids = fields.Many2many('res.partner', |
|||
domain="[('is_registered', '=', True)]", |
|||
help="Vendors you want to send quotations") |
|||
vendor_quote_history_ids = fields.One2many('vendor.quote.history', |
|||
'quote_id', |
|||
string="Vendor Quote History", |
|||
help="Vendor Quote History") |
|||
user_id = fields.Many2one('res.users', default=lambda self: self.env.user, |
|||
string="Responsible", help="Responsible Person") |
|||
approved_vendor_id = fields.Many2one('res.partner', string="Approved Vendor", help="Approved Vendor") |
|||
order_id = fields.Many2one('purchase.order', string='Order ID', help="Order ID") |
|||
state = fields.Selection([ |
|||
('draft', 'Draft'), |
|||
('pending', 'Pending'), |
|||
('in_progress', 'In Progress'), |
|||
('done', 'Done'), |
|||
('cancel', 'Cancelled'), ('order', 'Purchase Order'), |
|||
], string="Status", default='draft', help="Different stages") |
|||
company_id = fields.Many2one( |
|||
'res.company', string='Company', |
|||
default=lambda self: self.env.company, help="Select Company" |
|||
) |
|||
|
|||
@api.model |
|||
def create(self, vals): |
|||
"""Override the create method to assign a unique sequence to the |
|||
'name' field.""" |
|||
if vals.get('name', 'New') == 'New': |
|||
vals['name'] = self.env['ir.sequence'].next_by_code( |
|||
'vendor.rfq') or '/' |
|||
res = super(VendorRFQ, self).create(vals) |
|||
return res |
|||
|
|||
def action_send_by_mail(self): |
|||
"""This method sends an email to each vendor listed in the `vendor_ids` |
|||
field, using a predefined email template. The template is personalized |
|||
with the vendor's name and language. The email is sent from the current |
|||
user's email address.""" |
|||
template = self.env.ref( |
|||
'vendor_portal_odoo.email_template_vendor_rfq_request').id |
|||
for vendor in self.vendor_ids: |
|||
context = { |
|||
'name': vendor.name, |
|||
'lang': vendor.lang, |
|||
} |
|||
email_values = { |
|||
'email_to': vendor.email, |
|||
'email_from': self.env.user.partner_id.email, |
|||
} |
|||
self.env['mail.template'].browse(template).with_context( |
|||
context).send_mail(self.id, email_values=email_values, |
|||
force_send=True) |
|||
self.state = 'in_progress' |
|||
|
|||
def action_pending(self): |
|||
"""For changing state to pending""" |
|||
self.state = 'pending' |
|||
|
|||
def action_cancel(self): |
|||
"""For changing state to cancel""" |
|||
self.state = 'cancel' |
|||
|
|||
def action_done(self): |
|||
"""For mark as done""" |
|||
|
|||
return { |
|||
'type': 'ir.actions.act_window', |
|||
'view_mode': 'form', |
|||
'res_model': 'rfq.done', |
|||
'target': 'new', |
|||
'views': [[False, 'form']], |
|||
'context': {'default_quote_ids': self.vendor_quote_history_ids.ids}, |
|||
} |
|||
|
|||
def action_create_quotation(self): |
|||
"""For creating purchase RFQ from vendor quotations""" |
|||
rfq_quote = self.env['vendor.quote.history'].search([ |
|||
('vendor_id', '=', self.approved_vendor_id.id), |
|||
('quote_id', '=', self.id)]) |
|||
price = rfq_quote.quoted_price |
|||
order = self.env['purchase.order'].sudo().create({ |
|||
'partner_id': self.approved_vendor_id.id, |
|||
'order_line': [ |
|||
(0, 0, { |
|||
'name': self.product_id.name, |
|||
'product_id': self.product_id.id, |
|||
'product_qty': self.quantity, |
|||
'product_uom': self.product_id.uom_po_id.id, |
|||
'price_unit': price, |
|||
'date_planned': rfq_quote.estimate_date, |
|||
'taxes_id': [(6, 0, self.product_id.supplier_taxes_id.ids)], |
|||
})], |
|||
}) |
|||
self.write({ |
|||
'state': 'order', |
|||
'order_id': order.id |
|||
}) |
|||
return { |
|||
'type': 'ir.actions.act_window', |
|||
'res_model': 'purchase.order', |
|||
'res_id': order.id, |
|||
'target': 'current', |
|||
'views': [(False, 'form')], |
|||
} |
|||
|
|||
def set_rfq_done(self): |
|||
"""Set the RFQ as done""" |
|||
quotes = self.search([('state', '=', 'in_progress'), |
|||
('vendor_quote_history_ids', |
|||
'!=', False), |
|||
('closing_date', '=', |
|||
fields.Date.today())]) |
|||
if quotes: |
|||
rfq_done_based_on = self.env['ir.config_parameter'].get_param( |
|||
'vendor_portal_odoo.rfq_done_based_on') |
|||
for rec in quotes: |
|||
order = 'quoted_price asc' if rfq_done_based_on == 'based_on_price' else 'estimate_date asc' |
|||
vendor_quotes = rec.vendor_quote_history_ids.search([], |
|||
limit=1, |
|||
order=order) |
|||
rec.write({ |
|||
'approved_vendor_id': vendor_quotes.vendor_id.id, |
|||
'state': 'done' |
|||
}) |
|||
|
|||
def get_purchase_order(self): |
|||
"""Retrieve the purchase order associated with the current record.""" |
|||
return { |
|||
'type': 'ir.actions.act_window', |
|||
'res_model': 'purchase.order', |
|||
'res_id': self.order_id.id, |
|||
'target': 'current', |
|||
'views': [(False, 'form')], |
|||
} |
|
@ -0,0 +1,9 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Multi company Rule--> |
|||
<record id="vendor_rfq_rule_company" model="ir.rule"> |
|||
<field name="name">Vendor Quotation multi company rule</field> |
|||
<field name="model_id" ref="model_vendor_rfq"/> |
|||
<field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'in', company_ids)]</field> |
|||
</record> |
|||
</odoo> |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 392 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 767 KiB |
After Width: | Height: | Size: 138 KiB |
After Width: | Height: | Size: 760 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 697 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 166 KiB |
After Width: | Height: | Size: 151 KiB |
After Width: | Height: | Size: 117 KiB |
After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 150 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 111 KiB |