Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIG] website_product_configurator_mrp: Migration to 16.0 #104

Open
wants to merge 24 commits into
base: 16.0
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
30b32a9
[ADD] Added website_product_config to repo
PCatinean Dec 23, 2016
580fc28
de translations of product_configurator (Pledra)
tv-openbig Dec 29, 2016
df0f82a
Flake8 fixes (#47)
PCatinean Mar 30, 2017
cb4e56f
[WIP] Basic subconfiguration process
PCatinean May 14, 2017
e0802ee
#T1532 partial commit
Feb 5, 2018
92ae445
Removed console.log, renamed __openerp__.py files to __manifest__.py
PCatinean Feb 20, 2018
d7a1051
Bumped version to 11.0 and removed all traces of coding: utf-8 from p…
PCatinean May 14, 2018
c1d3b9e
[FIX]product_configurator, website_product_configurator, product_conf…
bizzappdev Jul 5, 2018
2cc627f
Added product_configurator_stock and website_product_configurator and…
PCatinean Aug 30, 2018
2fb9ce8
[ADD][#T00494]website_product_configurator:solved flake8 and pylints
May 27, 2019
2014b73
[MIG][T3202]odoo-product-configurator:improve xpath and manifest file
Feb 19, 2020
e831d48
[MIG][3202]website-product-configurator-mrp:improve controller/main.p…
Feb 19, 2020
fcd3d6b
[FIX][T3202]fix controller cart_update
bizzappdev Feb 21, 2020
f5e2f66
[FIX][T3202]add product_configurator_mrp in dependency
bizzappdev Feb 21, 2020
ebca69c
[FIX][T3202]update po files
bizzappdev Feb 21, 2020
c82d576
[FIX][T3202]now assembly option id available only there are related p…
bizzappdev Feb 27, 2020
91b5027
[FIX]fix flake8 and used env.ref instead of search for view in xml_id…
bizzappdev Mar 2, 2020
b1886f1
[MIG] website_product_configurator_mrp : migrate to v14.
pledrateam May 25, 2021
8c3d008
[IMP] website_product_configurator_mrp : add the maintainers and deve…
pledrateam Jun 16, 2021
9481afa
[IMP] website_product_configurator_mrp: Add license info and generate…
pledrateam Jun 18, 2021
f4c59f7
[REF] *: fix PCatinean maintainer
dreispt Dec 10, 2021
c752963
[IMP] website_product_configurator_mrp: pre-commit execution
SirAionTech Jan 18, 2024
d2c3ddb
[MIG] website_product_configurator_mrp: Migration to 16.0
SirAionTech Jan 18, 2024
a794f27
[DON'T MERGE] test-requirements.txt
SirAionTech Jan 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[FIX][T3202]fix controller cart_update
bizzappdev authored and SirAionTech committed Nov 7, 2024
commit fcd3d6b8341b3aa36e4b6714df6877614172c916
26 changes: 13 additions & 13 deletions website_product_configurator_mrp/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
'name': 'Website Configurator Manufacturing',
'version': '13.0.1.0.0',
'category': 'Website',
'summary': 'Website integration of MRP',
'author': 'Pledra',
'license': 'AGPL-3',
'website': 'http://www.pledra.com/',
'depends': [
"name": "Website Configurator Manufacturing",
"version": "13.0.1.0.0",
"category": "Website",
"summary": "Website integration of MRP",
"author": "Pledra",
"license": "AGPL-3",
"website": "http://www.pledra.com/",
"depends": [
# 'product_configurator_mrp',
'website_product_configurator',
"website_product_configurator",
],
'data': ['templates.xml'],
'application': True,
'installable': True,
'auto_install': False,
"data": ["views/templates.xml"],
"application": True,
"installable": True,
"auto_install": False,
}
43 changes: 22 additions & 21 deletions website_product_configurator_mrp/controllers/main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from odoo.http import request
from odoo import http

from odoo.addons.website_product_configurator.controllers.main import ProductConfigWebsiteSale

from odoo.addons.website_product_configurator.controllers.main import (
ProductConfigWebsiteSale,
)


class WebsiteProductConfigMrp(ProductConfigWebsiteSale):

@http.route(
["/shop/cart/update"],
type="http",
@@ -16,31 +16,32 @@ class WebsiteProductConfigMrp(ProductConfigWebsiteSale):
csrf=False,
)
def cart_update(self, product_id, add_qty=1, set_qty=0, **kw):
if kw.get('assembly') == 'kit':
product = request.env['product.product'].browse(int(product_id))
attr_products = product.product_template_attribute_value_ids.mapped('product_attribute_value_id')
for product in attr_products.mapped('product_id'):
request.website.sale_get_order(force_create=1)._cart_update(
product_id=int(product.id),
product = request.env["product.product"].browse(int(product_id))
if product.config_ok:
return super(WebsiteProductConfigMrp, self).cart_update(
product_id=product_id,
add_qty=add_qty, set_qty=set_qty, **kw
)
sale_order = request.website.sale_get_order(force_create=True)
if kw.get("assembly") == "kit":
attr_value_ids = product.product_template_attribute_value_ids
attr_products = attr_value_ids.mapped(
"product_attribute_value_id.product_id"
)
for product_id in attr_products:
sale_order._cart_update(
product_id=int(product_id.id),
add_qty=add_qty,
set_qty=set_qty,
config_session_id=kw.get("config_session_id", False)
)
else:
product = request.env['product.product'].browse(int(product_id))
attr_products = product.product_template_attribute_value_ids.mapped('product_attribute_value_id')
request.website.sale_get_order(force_create=1)._cart_update(
sale_order._cart_update(
product_id=int(product.id),
add_qty=add_qty,
set_qty=set_qty,
config_session_id=kw.get("config_session_id", False)
config_session_id=kw.get("config_session_id", False),
)
if kw.get("express"):
return request.redirect("/shop/checkout?express=1")
return request.redirect("/shop/cart")

def config_vars(self, product_tmpl, active_step=None, data=None):
res = super(WebsiteProductConfigMrp, self).config_vars(
product_tmpl=product_tmpl, active_step=active_step, data=data)
active_step = res.get('active_step')
if active_step and active_step.product_tmpl_id != product_tmpl:
pass
return res
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>

<template id="cfg_session" inherit_id="website_product_configurator.cfg_product" name="Configuration Session MRP">
<xpath expr="//a[@id='add_to_cart']" position="before">
<div class="input-group mt8">
@@ -12,6 +11,5 @@
</div>
</xpath>
</template>

</data>
</odoo>