From 3751379f1e9a4c215fb6eb898b4ccc67659b9ace Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 May 2022 21:51:50 +0700 Subject: initial commit 2 --- addons/website_sale/data/data.xml | 128 ++++ addons/website_sale/data/demo.xml | 739 ++++++++++++++++++++++++ addons/website_sale/data/digest_data.xml | 8 + addons/website_sale/data/mail_template_data.xml | 110 ++++ 4 files changed, 985 insertions(+) create mode 100644 addons/website_sale/data/data.xml create mode 100644 addons/website_sale/data/demo.xml create mode 100644 addons/website_sale/data/digest_data.xml create mode 100644 addons/website_sale/data/mail_template_data.xml (limited to 'addons/website_sale/data') diff --git a/addons/website_sale/data/data.xml b/addons/website_sale/data/data.xml new file mode 100644 index 00000000..c3e23f32 --- /dev/null +++ b/addons/website_sale/data/data.xml @@ -0,0 +1,128 @@ + + + + + + Shop + /shop + + 20 + + + Website Shop + self + /shop + + + + open + + + + Sale + bg-success o_ribbon_left + + + + Sold out + bg-danger o_ribbon_left + + + + New! + bg-primary o_ribbon_left + + + + + + + + + + + + + + + + + + + + Products Dynamic Snippet + + code + +ProductProduct = model.env['product.product'] +FieldMonetary = model.env['ir.qweb.field.monetary'] + +website = request.website.get_current_website() +dynamic_filter = model.env.context.get('dynamic_filter') +limit = model.env.context.get('limit') +search_domain = model.env.context.get('search_domain') +get_rendering_data_structure = model.env.context.get('get_rendering_data_structure') +escape = dynamic_filter.escape_falsy_as_empty + +domain = [('website_published', '=', True)] + website.website_domain() + (search_domain or []) +products = ProductProduct.search(domain, limit=limit) +_ = products.mapped('name') + +monetary_options = { + 'display_currency': request.website.get_current_pricelist().currency_id, +} + +max_nb_chars = 100 +res_products = [] +for product in products: + res_product = product._read_format(['id', 'name', 'website_url', 'description_sale'])[0] + res_product.update(product._get_combination_info_variant()) + + if res_product['description_sale'] and len(res_product['description_sale']) > max_nb_chars: + res_product['description_sale'] = "%s ..." % res_product['description_sale'][:max_nb_chars] + res_product['list_price'] = FieldMonetary.value_to_html(res_product['price'], monetary_options) + data = get_rendering_data_structure() + for field_name in dynamic_filter.field_names.split(","): + field = ProductProduct._fields.get(field_name) + if field and field.type == 'binary': + data['image_fields'][field_name] = escape(website.image_url(product, field_name)) + elif field_name == 'list_price': + data['fields'][field_name] = res_product[field_name] + else: + data['fields'][field_name] = escape(res_product[field_name]) + data['fields']['call_to_action_url'] = escape(product['website_url']) + res_products.append(data) + +response = res_products + + + + + + display_name,description_sale,image_512,list_price + + Products + + + + sale.order + + + + + create_customer + True + Create a Customer + + + res.partner + + + + diff --git a/addons/website_sale/data/demo.xml b/addons/website_sale/data/demo.xml new file mode 100644 index 00000000..568c0f96 --- /dev/null +++ b/addons/website_sale/data/demo.xml @@ -0,0 +1,739 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 + 2 + 9950 + + + + + 10010 + + + + + + + + + + + + + + + + + + + + + list_price + 1_product + + + 20 + 2 + formula + + + + + + Desks + 15 + + + Furnitures + 17 + + + Boxes + 20 + + + Drawers + 21 + + + Cabinets + 22 + + + Bins + 23 + + + Lamps + 24 + + + Services + 25 + + + Multimedia + 26 + + + + + + Components + 16 + + + + Chairs + 18 + + + + Couches + 19 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + + + + + BeNeLux + + + + + Christmas + + + + 20 + + + + formula + list_price + 20 + + + + Benelux + + + + 2 + + + + percentage + list_price + 10 + + + + + + EUR + + + + 3 + + + + + formula + list_price + + + + + formula + list_price + + + + + + + + + + + + + sale + + + + + + + 1 + + 599.0 + + + + + + + + + + + + sale + + + + + + + 1 + + 900 + + + + + + + + + + + + + sale + + + + + + + 1 + + 750 + + + + + + + + + + + + sale + + + + + + + 1 + + 1199.0 + + + + + + + + + + + + sale + + + + + + + 3 + + 349.0 + + + + + + + + + + + + sale + + + + + + + 1 + + 1599.00 + + + + + + + + + + + + + sale + + + + + + + 1 + + 1349.00 + + + + + + + + + + + + + sale + + + + + + + 1 + + 1799.00 + + + + + + + + + + + + + + + + + + 1 + + 2950.00 + + + + + + + 1 + + 12.50 + + + + + + + + + + + + + + + + + + + + 2 + + 16.50 + + + + + + + + + + + + + + + + + + + 1 + + 47.0 + + + + + + + + + + + + + + sent + + + + + + + 1 + + 1799.0 + + + + + + + + + + + + + + + + + + 1 + + 25.0 + + + + + + + + + + + + + sale + + + + + + + 2 + + 1799.0 + + + + + + + + + + + + + + + + + + + 7 + + 47.0 + to invoice + + + + + + + + + + + + + + + + + + + 3 + + 47.0 + to invoice + + + + + + + + Warranty + 20.0 + 9980 + + service + + + Warranty, issued to the purchaser of an article by its manufacturer, promising to repair or replace it if necessary within a specified period of time. + + delivery + + + + + + + + + + + + + + + + + + + + SERV_125889 + + + SERV_125890 + + + + 18.00 + + + + + + + + + + + + + + + + Follow-up on satisfaction + + + + + + + + + Confirm quote + + + + + + + + + Send updated pricelist + + + + + diff --git a/addons/website_sale/data/digest_data.xml b/addons/website_sale/data/digest_data.xml new file mode 100644 index 00000000..0f9739fd --- /dev/null +++ b/addons/website_sale/data/digest_data.xml @@ -0,0 +1,8 @@ + + + + + True + + + diff --git a/addons/website_sale/data/mail_template_data.xml b/addons/website_sale/data/mail_template_data.xml new file mode 100644 index 00000000..f6317733 --- /dev/null +++ b/addons/website_sale/data/mail_template_data.xml @@ -0,0 +1,110 @@ + + + + + Sales Order: Cart Recovery Email + + You left items in your cart! + ${(object.user_id.email_formatted or user.email_formatted or '') | safe} + ${object.partner_id.id} + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+ % set company = object.company_id or object.user_id.company_id or user.company_id + Your Cart
+ + ${object.name} + +
+ ${company.name} +
+
+
+
+ + + +
+

THERE'S SOMETHING IN YOUR CART.

+ Would you like to complete your purchase?

+ % if object.order_line: + % for line in object.website_order_line: +
+ + + + + + +
+ Product image + + ${line.product_id.display_name}
${line.name} +
+ ${(line.product_uom_qty) | int} ${(line.product_uom.name)} +
+ % endfor +
+ % endif + +
Thank you for shopping with ${company.name}!
+
+
+
+
+ + + +
+ ${company.name} +
+ ${company.phone} + % if company.email + | ${company.email} + % endif + % if company.website + | ${company.website} + % endif +
+
+
+ + +
+ Powered by Odoo +
+
+
+ ${object.partner_id.lang} + +
+
+
-- cgit v1.2.3