From f6671dd4595af3c1075b27925f10c457854cecf8 Mon Sep 17 00:00:00 2001 From: IT Fixcomart Date: Tue, 15 Nov 2022 17:35:23 +0700 Subject: Fitur crud cart dan wishlist Update struktur response product --- indoteknik_custom/__manifest__.py | 2 + indoteknik_custom/models/__init__.py | 1 + indoteknik_custom/models/website_user_cart.py | 9 ++--- indoteknik_custom/models/website_user_wishlist.py | 9 +++++ indoteknik_custom/security/ir.model.access.csv | 4 +- indoteknik_custom/views/website_user_cart.xml | 47 +++++++++++++++++++++++ indoteknik_custom/views/website_user_wishlist.xml | 45 ++++++++++++++++++++++ 7 files changed, 110 insertions(+), 7 deletions(-) create mode 100644 indoteknik_custom/models/website_user_wishlist.py create mode 100755 indoteknik_custom/views/website_user_cart.xml create mode 100755 indoteknik_custom/views/website_user_wishlist.xml (limited to 'indoteknik_custom') diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index a703bcef..e0369306 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -26,6 +26,8 @@ 'views/vit_kelurahan.xml', 'views/vit_kecamatan.xml', 'views/vit_kota.xml', + 'views/website_user_cart.xml', + 'views/website_user_wishlist.xml', 'views/x_banner_banner.xml', 'views/x_banner_category.xml', 'views/x_biaya_kirim.xml', diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index 21549684..c4f1a443 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -30,3 +30,4 @@ from . import ir_attachment from . import delivery_carrier from . import dunning_run from . import website_user_cart +from . import website_user_wishlist diff --git a/indoteknik_custom/models/website_user_cart.py b/indoteknik_custom/models/website_user_cart.py index 165170a9..8046469f 100644 --- a/indoteknik_custom/models/website_user_cart.py +++ b/indoteknik_custom/models/website_user_cart.py @@ -1,13 +1,10 @@ -from odoo import fields, models, api, _ -from odoo.exceptions import AccessError, UserError, ValidationError +from odoo import fields, models class WebsiteUserCart(models.Model): _name = 'website.user.cart' + _rec_name = 'user_id' + user_id = fields.Many2one('res.users', string='User', help="User ID yang terdaftar di table res.users") - cart_type = fields.Selection([ - ('cart', 'Cart'), - ('wishlist', 'Wishlist'), - ], string='Cart Type', help="Type apakah Cart atau Wishlist") product_id = fields.Many2one('product.product', string='Product', help="Product yang terdaftar di table product.product") qty = fields.Float(string='Quantity', digits='Product Unit of Measure') diff --git a/indoteknik_custom/models/website_user_wishlist.py b/indoteknik_custom/models/website_user_wishlist.py new file mode 100644 index 00000000..a6ee35d4 --- /dev/null +++ b/indoteknik_custom/models/website_user_wishlist.py @@ -0,0 +1,9 @@ +from odoo import fields, models + + +class WebsiteUserWishlist(models.Model): + _name = 'website.user.wishlist' + _rec_name = 'user_id' + + user_id = fields.Many2one('res.users', string='User', help="User ID yang terdaftar di table res.users") + product_id = fields.Many2one('product.template', string='Product', help="Product yang terdaftar di table product.template") diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv index 9d2137f6..d0cc631d 100755 --- a/indoteknik_custom/security/ir.model.access.csv +++ b/indoteknik_custom/security/ir.model.access.csv @@ -13,4 +13,6 @@ access_sale_monitoring_detail,access.sale.monitoring.detail,model_sale_monitorin access_delivery_order,access.delivery.order,model_delivery_order,,1,1,1,1 access_delivery_order_line,access.delivery.order.line,model_delivery_order_line,,1,1,1,1 access_dunning_run,access.dunning.run,model_dunning_run,,1,1,1,1 -access_dunning_run_line,access.dunning.run.line,model_dunning_run_line,,1,1,1,1 \ No newline at end of file +access_dunning_run_line,access.dunning.run.line,model_dunning_run_line,,1,1,1,1 +access_website_user_cart,access.website.user.cart,model_website_user_cart,,1,1,1,1 +access_website_user_wishlist,access.website.user.wishlist,model_website_user_wishlist,,1,1,1,1 \ No newline at end of file diff --git a/indoteknik_custom/views/website_user_cart.xml b/indoteknik_custom/views/website_user_cart.xml new file mode 100755 index 00000000..890d801c --- /dev/null +++ b/indoteknik_custom/views/website_user_cart.xml @@ -0,0 +1,47 @@ + + + + User Cart + website.user.cart + tree,form + + + + User Cart + website.user.cart + + + + + + + + + + + User Cart + website.user.cart + +
+ + + + + + + + + + +
+
+
+ + +
+
\ No newline at end of file diff --git a/indoteknik_custom/views/website_user_wishlist.xml b/indoteknik_custom/views/website_user_wishlist.xml new file mode 100755 index 00000000..998877b2 --- /dev/null +++ b/indoteknik_custom/views/website_user_wishlist.xml @@ -0,0 +1,45 @@ + + + + User Wishlist + website.user.wishlist + tree,form + + + + User Wishlist + website.user.wishlist + + + + + + + + + + User Wishlist + website.user.wishlist + +
+ + + + + + + + + +
+
+
+ + +
+
\ No newline at end of file -- cgit v1.2.3