[MERGE] website_portal_purchase: move customer portal to purchase
As already done for account, sale, project and helpdesk, customer portal for purchase is moved directly into purchase. No dependency to website is required anymore. This merge also removes website_portal_purchase as all its content has been moved.
This commit is contained in:
@@ -867,11 +867,6 @@ file_filter = addons/website_payment/i18n/<lang>.po
|
||||
source_file = addons/website_payment/i18n/website_payment.pot
|
||||
source_lang = en
|
||||
|
||||
[odoo-master.website_portal_purchase]
|
||||
file_filter = addons/website_portal_purchase/i18n/<lang>.po
|
||||
source_file = addons/website_portal_purchase/i18n/website_portal_purchase.pot
|
||||
source_lang = en
|
||||
|
||||
[odoo-master.website_project]
|
||||
file_filter = addons/website_project/i18n/<lang>.po
|
||||
source_file = addons/website_project/i18n/website_project.pot
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import controllers
|
||||
from . import models
|
||||
from . import report
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
'data/mail_template_data.xml',
|
||||
'views/purchase_config_settings_views.xml',
|
||||
'views/account_config_settings_views.xml',
|
||||
'views/portal_templates.xml',
|
||||
'report/purchase_order_templates.xml',
|
||||
'report/purchase_quotation_templates.xml',
|
||||
],
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import purchase
|
||||
from . import portal
|
||||
+7
-7
@@ -8,13 +8,13 @@ from odoo.exceptions import AccessError
|
||||
from odoo.http import request
|
||||
from odoo.tools import pycompat
|
||||
from odoo.tools.translate import _
|
||||
from odoo.addons.portal.controllers.portal import get_records_pager, CustomerPortal
|
||||
from odoo.addons.portal.controllers.portal import get_records_pager, pager as portal_pager, CustomerPortal
|
||||
|
||||
|
||||
class WebsitePortal(CustomerPortal):
|
||||
class CustomerPortal(CustomerPortal):
|
||||
|
||||
def _prepare_portal_layout_values(self):
|
||||
values = super(WebsitePortal, self)._prepare_portal_layout_values()
|
||||
values = super(CustomerPortal, self)._prepare_portal_layout_values()
|
||||
partner = request.env.user.partner_id
|
||||
values['purchase_count'] = request.env['purchase.order'].search_count([
|
||||
'|',
|
||||
@@ -64,7 +64,7 @@ class WebsitePortal(CustomerPortal):
|
||||
# count for pager
|
||||
purchase_count = PurchaseOrder.search_count(domain)
|
||||
# make pager
|
||||
pager = request.website.pager(
|
||||
pager = portal_pager(
|
||||
url="/my/purchase",
|
||||
url_args={'date_begin': date_begin, 'date_end': date_end},
|
||||
total=purchase_count,
|
||||
@@ -92,7 +92,7 @@ class WebsitePortal(CustomerPortal):
|
||||
'filterby': filterby,
|
||||
'default_url': '/my/purchase',
|
||||
})
|
||||
return request.render("website_portal_purchase.portal_my_purchase_orders", values)
|
||||
return request.render("purchase.portal_my_purchase_orders", values)
|
||||
|
||||
@http.route(['/my/purchase/<int:order_id>'], type='http', auth="user", website=True)
|
||||
def portal_my_purchase_order(self, order_id=None, **kw):
|
||||
@@ -101,10 +101,10 @@ class WebsitePortal(CustomerPortal):
|
||||
order.check_access_rights('read')
|
||||
order.check_access_rule('read')
|
||||
except AccessError:
|
||||
return request.render("website.403")
|
||||
return request.redirect('/my')
|
||||
history = request.session.get('my_purchases_history', [])
|
||||
values = {
|
||||
'order': order.sudo(),
|
||||
}
|
||||
values.update(get_records_pager(history, order))
|
||||
return request.render("website_portal_purchase.portal_my_purchase_order", values)
|
||||
return request.render("purchase.portal_my_purchase_order", values)
|
||||
@@ -163,6 +163,14 @@ class PurchaseOrder(models.Model):
|
||||
group_id = fields.Many2one('procurement.group', string="Procurement Group", copy=False)
|
||||
is_shipped = fields.Boolean(compute="_compute_is_shipped")
|
||||
|
||||
website_url = fields.Char(
|
||||
'Website URL', compute='_website_url',
|
||||
help='The full URL to access the document through the website.')
|
||||
|
||||
def _website_url(self):
|
||||
for order in self:
|
||||
order.website_url = '/my/purchase/%s' % (order.id)
|
||||
|
||||
@api.model
|
||||
def name_search(self, name, args=None, operator='ilike', limit=100):
|
||||
args = args or []
|
||||
@@ -595,6 +603,9 @@ class PurchaseOrderLine(models.Model):
|
||||
taxes_id = fields.Many2many('account.tax', string='Taxes', domain=['|', ('active', '=', False), ('active', '=', True)])
|
||||
product_uom = fields.Many2one('product.uom', string='Product Unit of Measure', required=True)
|
||||
product_id = fields.Many2one('product.product', string='Product', domain=[('purchase_ok', '=', True)], change_default=True, required=True)
|
||||
product_image = fields.Binary(
|
||||
'Product Image', related="product_id.image",
|
||||
help="Non-stored related field to allow portal user to see the image of the product he has ordered")
|
||||
move_ids = fields.One2many('stock.move', 'purchase_line_id', string='Reservation', readonly=True, ondelete='set null', copy=False)
|
||||
price_unit = fields.Float(string='Unit Price', required=True, digits=dp.get_precision('Product Price'))
|
||||
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_purchase_order,purchase.order,model_purchase_order,group_purchase_user,1,1,1,1
|
||||
access_purchase_order_manager,purchase.order,model_purchase_order,group_purchase_manager,1,1,1,1
|
||||
access_purchase_order_stock_worker,purchase.order,model_purchase_order,stock.group_stock_user,1,0,0,0
|
||||
access_purchase_order_invoicing_payments,purchase.order,model_purchase_order,account.group_account_invoice,1,1,0,0
|
||||
access_purchase_order_portal,purchase.order.portal,purchase.model_purchase_order,base.group_portal,1,0,0,0
|
||||
access_purchase_order_line,purchase.order.line user,model_purchase_order_line,group_purchase_user,1,1,1,1
|
||||
access_purchase_order_line_manager,purchase.order.line manager,model_purchase_order_line,group_purchase_manager,1,0,0,0
|
||||
access_purchase_order_line_manager,purchase.order.line,model_purchase_order_line,group_purchase_manager,1,1,1,1
|
||||
access_purchase_order_line_stock_worker,purchase.order.line,model_purchase_order_line,stock.group_stock_user,1,0,0,0
|
||||
access_purchase_order_line_invoicing_payments,purchase.order.line,model_purchase_order_line,account.group_account_invoice,1,1,0,0
|
||||
access_purchase_order_line_portal,purchase.order.line.portal,purchase.model_purchase_order_line,base.group_portal,1,0,0,0
|
||||
access_stock_location_purchase_user,stock.location,stock.model_stock_location,group_purchase_user,1,0,0,0
|
||||
access_stock_warehouse_purchase_user,stock.warehouse,stock.model_stock_warehouse,group_purchase_user,1,0,0,0
|
||||
access_stock_picking_purchase_user,stock.picking,stock.model_stock_picking,group_purchase_user,1,1,1,1
|
||||
access_stock_move_purchase_user,stock.move,stock.model_stock_move,group_purchase_user,1,1,1,0
|
||||
access_purchase_order_stock_worker,purchase.order,model_purchase_order,stock.group_stock_user,1,0,0,0
|
||||
access_purchase_order_line_stock_worker,purchase.order.line,model_purchase_order_line,stock.group_stock_user,1,0,0,0
|
||||
access_account_tax_purchase_user,account.tax,account.model_account_tax,group_purchase_user,1,0,0,0
|
||||
access_report_purchase_order,purchase.report,model_purchase_report,group_purchase_manager,1,0,0,0
|
||||
access_report_purchase_order_user,purchase.report user,model_purchase_report,group_purchase_user,1,0,0,0
|
||||
access_purchase_order_line_manager,purchase.order.line,model_purchase_order_line,group_purchase_manager,1,1,1,1
|
||||
access_stock_location_purchase_user_manager,stock.location,stock.model_stock_location,group_purchase_manager,1,0,0,0
|
||||
access_stock_warehouse_purchase_user_manager,stock.warehouse,stock.model_stock_warehouse,group_purchase_manager,1,0,0,0
|
||||
access_stock_picking_purchase_user_manager,stock.picking,stock.model_stock_picking,group_purchase_manager,1,1,1,1
|
||||
@@ -49,6 +52,4 @@ access_stock_location_purchase_manager,stock.location purchase manager,stock.mod
|
||||
access_stock_warehouse_orderpoint_manager,stock.warehouse.orderpoint,stock.model_stock_warehouse_orderpoint,purchase.group_purchase_manager,1,0,0,0
|
||||
access_stock_warehouse_orderpoint_manager,stock.warehouse.orderpoint,stock.model_stock_warehouse_orderpoint,group_purchase_user,1,0,0,0
|
||||
access_product_price_history_purchase_user,prices.history purchase user,product.model_product_price_history,purchase.group_purchase_user,1,0,0,0
|
||||
access_product_price_history_purchase_manager,prices.history purchase manager,product.model_product_price_history,purchase.group_purchase_manager,1,1,1,1
|
||||
access_purchase_order_invoicing_payments,purchase.order,model_purchase_order,account.group_account_invoice,1,1,0,0
|
||||
access_purchase_order_line_invoicing_payments,purchase.order.line,model_purchase_order_line,account.group_account_invoice,1,1,0,0
|
||||
access_product_price_history_purchase_manager,prices.history purchase manager,product.model_product_price_history,purchase.group_purchase_manager,1,1,1,1
|
||||
|
@@ -51,5 +51,22 @@
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
|
||||
<record id="portal_purchase_order_user_rule" model="ir.rule">
|
||||
<field name="name">Portal Purchase Orders</field>
|
||||
<field name="model_id" ref="purchase.model_purchase_order"/>
|
||||
<field name="domain_force">[('message_partner_ids','child_of',[user.commercial_partner_id.id])]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
|
||||
<field name="perm_unlink" eval="1"/>
|
||||
<field name="perm_write" eval="1"/>
|
||||
<field name="perm_read" eval="1"/>
|
||||
<field name="perm_create" eval="0"/>
|
||||
</record>
|
||||
|
||||
<record id="portal_purchase_order_line_rule" model="ir.rule">
|
||||
<field name="name">Portal Purhcase Orders Line</field>
|
||||
<field name="model_id" ref="purchase.model_purchase_order_line"/>
|
||||
<field name="domain_force">[('order_id.message_partner_ids','child_of',[user.commercial_partner_id.id])]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@
|
||||
</t>
|
||||
</table></div>
|
||||
<div t-if="pager" class="o_portal_pager text-center">
|
||||
<t t-call="website.pager"/>
|
||||
<t t-call="portal.pager"/>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
@@ -1,5 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import controllers
|
||||
from . import models
|
||||
@@ -1,23 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
{
|
||||
'name': 'Website Portal for Purchases',
|
||||
'category': 'Website',
|
||||
'summary': 'Add your purchase orders in the frontend portal',
|
||||
'version': '1.0',
|
||||
'description': """
|
||||
Display purchase orders on your website. Customers will be able to access their purchase orders in their own portal, see their state and communicate with salesmen.
|
||||
""",
|
||||
'depends': [
|
||||
'purchase',
|
||||
'website',
|
||||
'portal',
|
||||
],
|
||||
'data': [
|
||||
'views/website_portal_purchase_templates.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'security/website_portal_purchase_security.xml',
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import website_portal
|
||||
@@ -1,158 +0,0 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * website_portal_purchase
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.saas~16\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-07-25 10:04+0000\n"
|
||||
"PO-Revision-Date: 2017-07-25 10:04+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: website_portal_purchase
|
||||
#: model:ir.ui.view,arch_db:website_portal_purchase.portal_my_purchase_orders
|
||||
msgid "<span class=\"label label-default\"><i class=\"fa fa-fw fa-remove\"/> Cancelled</span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: model:ir.ui.view,arch_db:website_portal_purchase.portal_my_purchase_order
|
||||
msgid "<strong>Date:</strong>"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: model:ir.ui.view,arch_db:website_portal_purchase.portal_my_purchase_order
|
||||
msgid "<strong>Product</strong>"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: model:ir.ui.view,arch_db:website_portal_purchase.portal_my_purchase_order
|
||||
msgid "<strong>Quantity</strong>"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: model:ir.ui.view,arch_db:website_portal_purchase.portal_my_purchase_order
|
||||
msgid "<strong>Subtotal</strong>"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: model:ir.ui.view,arch_db:website_portal_purchase.portal_my_purchase_order
|
||||
msgid "<strong>Total:</strong>"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: model:ir.ui.view,arch_db:website_portal_purchase.portal_my_purchase_order
|
||||
msgid "<strong>Unit Price</strong>"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: code:addons/website_portal_purchase/controllers/website_portal.py:54
|
||||
#, python-format
|
||||
msgid "All"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: code:addons/website_portal_purchase/controllers/website_portal.py:56
|
||||
#, python-format
|
||||
msgid "Cancelled"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: model:ir.model.fields,help:website_portal_purchase.field_purchase_order_line_product_image
|
||||
msgid "Image of the product variant (Big-sized image of product template if false). It is automatically resized as a 1024x1024px image, with aspect ratio preserved."
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: code:addons/website_portal_purchase/controllers/website_portal.py:57
|
||||
#, python-format
|
||||
msgid "Locked"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: model:ir.ui.view,arch_db:website_portal_purchase.portal_my_purchase_order
|
||||
msgid "My Purchase Orders"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: code:addons/website_portal_purchase/controllers/website_portal.py:45
|
||||
#, python-format
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: code:addons/website_portal_purchase/controllers/website_portal.py:44
|
||||
#, python-format
|
||||
msgid "Newest"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: model:ir.ui.view,arch_db:website_portal_purchase.portal_my_purchase_orders
|
||||
msgid "Order Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: model:ir.model.fields,field_description:website_portal_purchase.field_purchase_order_line_product_image
|
||||
msgid "Product Image"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: code:addons/website_portal_purchase/controllers/website_portal.py:55
|
||||
#: model:ir.model,name:website_portal_purchase.model_purchase_order
|
||||
#: model:ir.ui.view,arch_db:website_portal_purchase.portal_my_purchase_order
|
||||
#, python-format
|
||||
msgid "Purchase Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: model:ir.model,name:website_portal_purchase.model_purchase_order_line
|
||||
msgid "Purchase Order Line"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: model:ir.ui.view,arch_db:website_portal_purchase.portal_my_home_menu_purchase
|
||||
msgid "Purchase Orders"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: model:ir.ui.view,arch_db:website_portal_purchase.portal_my_purchase_orders
|
||||
msgid "Purchase Orders #"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: model:ir.ui.view,arch_db:website_portal_purchase.portal_my_purchase_order
|
||||
msgid "Taxes:"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: model:ir.model.fields,help:website_portal_purchase.field_purchase_order_website_url
|
||||
msgid "The full URL to access the document through the website."
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: code:addons/website_portal_purchase/controllers/website_portal.py:46
|
||||
#: model:ir.ui.view,arch_db:website_portal_purchase.portal_my_purchase_orders
|
||||
#, python-format
|
||||
msgid "Total"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: model:ir.ui.view,arch_db:website_portal_purchase.portal_my_purchase_order
|
||||
msgid "Untaxed Amount:"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: model:ir.model.fields,field_description:website_portal_purchase.field_purchase_order_website_url
|
||||
msgid "Website URL"
|
||||
msgstr ""
|
||||
|
||||
#. module: website_portal_purchase
|
||||
#: model:ir.ui.view,arch_db:website_portal_purchase.portal_my_home_purchase
|
||||
#: model:ir.ui.view,arch_db:website_portal_purchase.portal_my_purchase_orders
|
||||
msgid "Your Purchase Orders"
|
||||
msgstr ""
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class PurchaseOrder(models.Model):
|
||||
|
||||
_inherit = 'purchase.order'
|
||||
|
||||
website_url = fields.Char('Website URL', compute='_website_url', help='The full URL to access the document through the website.')
|
||||
|
||||
def _website_url(self):
|
||||
for order in self:
|
||||
order.website_url = '/my/purchase/%s' % (order.id)
|
||||
|
||||
|
||||
class PurchaseOrderLine(models.Model):
|
||||
|
||||
_inherit = 'purchase.order.line'
|
||||
|
||||
# Non-stored related field to allow portal user to see the image of the product he has ordered
|
||||
product_image = fields.Binary('Product Image', related="product_id.image")
|
||||
@@ -1,3 +0,0 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_purchase_order_portal,purchase.order.portal,purchase.model_purchase_order,base.group_portal,1,0,0,0
|
||||
access_purchase_order_line_portal,purchase.order.line.portal,purchase.model_purchase_order_line,base.group_portal,1,0,0,0
|
||||
|
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
|
||||
<record id="portal_purchase_order_user_rule" model="ir.rule">
|
||||
<field name="name">Portal Purchase Orders</field>
|
||||
<field name="model_id" ref="purchase.model_purchase_order"/>
|
||||
<field name="domain_force">[('message_partner_ids','child_of',[user.commercial_partner_id.id])]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
|
||||
<field name="perm_unlink" eval="1"/>
|
||||
<field name="perm_write" eval="1"/>
|
||||
<field name="perm_read" eval="1"/>
|
||||
<field name="perm_create" eval="0"/>
|
||||
</record>
|
||||
|
||||
<record id="portal_purchase_order_line_rule" model="ir.rule">
|
||||
<field name="name">Portal Purhcase Orders Line</field>
|
||||
<field name="model_id" ref="purchase.model_purchase_order_line"/>
|
||||
<field name="domain_force">[('order_id.message_partner_ids','child_of',[user.commercial_partner_id.id])]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -1,6 +0,0 @@
|
||||
/* ---- My Purchase Orders page ---- */
|
||||
|
||||
.purchases_vertical_align {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
Reference in New Issue
Block a user