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

🚑 fix redirection and mandatory fields #430

Merged
merged 1 commit into from Oct 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions website_sale_checkout_store/README.rst
Expand Up @@ -35,7 +35,7 @@ Maintainers

To get a guaranteed support
you are kindly requested to purchase the module
at `odoo apps store <https://apps.odoo.com/apps/modules/11.0/website_sale_checkout_store/>`__.
at `odoo apps store <https://apps.odoo.com/apps/modules/12.0/website_sale_checkout_store/>`__.

Thank you for understanding!

Expand All @@ -44,14 +44,14 @@ Maintainers
Further information
===================

Demo: http://runbot.it-projects.info/demo/website-addons/11.0
Demo: http://runbot.it-projects.info/demo/website-addons/12.0

HTML Description: https://apps.odoo.com/apps/modules/11.0/website_sale_checkout_store/
HTML Description: https://apps.odoo.com/apps/modules/12.0/website_sale_checkout_store/

Usage instructions: `<doc/index.rst>`_

Changelog: `<doc/changelog.rst>`_

Notifications on updates: `via Atom <https://github.com/it-projects-llc/website-addons/commits/11.0/website_sale_checkout_store.atom>`_, `by Email <https://blogtrottr.com/?subscribe=https://github.com/it-projects-llc/website-addons/commits/11.0/website_sale_checkout_store.atom>`_
Notifications on updates: `via Atom <https://github.com/it-projects-llc/website-addons/commits/12.0/website_sale_checkout_store.atom>`_, `by Email <https://blogtrottr.com/?subscribe=https://github.com/it-projects-llc/website-addons/commits/12.0/website_sale_checkout_store.atom>`_

Tested on Odoo 11.0 475027b9889c0701f8fe5e0373a40663f6a831e1
2 changes: 1 addition & 1 deletion website_sale_checkout_store/__manifest__.py
Expand Up @@ -8,7 +8,7 @@
'summary': """Simplify checkout process by excluding shipping and/or payment information""",
'category': 'eCommerce',
'images': ['images/1.png'],
'version': '12.0.1.0.4',
'version': '12.0.1.0.5',

'author': 'IT-Projects LLC',
"support": "apps@it-projects.info",
Expand Down
15 changes: 9 additions & 6 deletions website_sale_checkout_store/controllers/main.py
Expand Up @@ -52,20 +52,23 @@ def payment_get_status(self, sale_order_id, **post):
else:
return super(WebsiteSaleExtended, self).payment_get_status(sale_order_id, **post)

def _get_mandatory_fields(self):
def _get_mandatory_fields(self, shipping=None):
order = request.website.sale_get_order()
if not order.buy_way or 'nobill' not in order.buy_way and 'noship' not in order.buy_way:
return ["name", "phone", "email", "street", "city", "country_id"]
fields = ["name", "phone", "street", "city", "country_id"]
elif 'noship' in order.buy_way:
if 'nobill' in order.buy_way:
return ["name", "phone", "email"]
fields = ["name", "phone"]
else:
return ["name", "phone", "email", "country_id"]
fields = ["name", "phone", "country_id"]
else:
return ["name", "phone", "email", "street", "city"]
fields = ["name", "phone", "street", "city"]
if not shipping:
fields.append('email')
yelizariev marked this conversation as resolved.
Show resolved Hide resolved
return fields

def _get_mandatory_billing_fields(self):
return self._get_mandatory_fields()

def _get_mandatory_shipping_fields(self):
return self._get_mandatory_fields()
return self._get_mandatory_fields(shipping=True)
5 changes: 5 additions & 0 deletions website_sale_checkout_store/doc/changelog.rst
@@ -1,3 +1,8 @@
`1.0.5`
-------

- FIX: Redirection error on the address page

`1.0.4`
-------

Expand Down
34 changes: 18 additions & 16 deletions website_sale_checkout_store/templates.xml
Expand Up @@ -123,6 +123,9 @@
</template>

<template id="address" name="my_checkout" inherit_id="website_sale.address">
<xpath expr="//t[@t-if=&quot;partner_id == website_sale_order.partner_shipping_id.id == website_sale_order.partner_invoice_id.id&quot;]" position="attributes">
<attribute name="t-if">partner_id == website_sale_order.partner_shipping_id.id == website_sale_order.partner_invoice_id.id and ship_enabled == '1'</attribute>
</xpath>
<xpath expr="//div[hasclass('container','oe_website_sale')]" position="attributes">
<attribute name="t-attf-ship_enabled">#{ship_enabled}</attribute>
<attribute name="t-attf-bill_enabled">#{bill_enabled}</attribute>
Expand All @@ -149,10 +152,6 @@
<xpath expr="//input[@name='company_name']/.." position="attributes">
<attribute name="ship">1</attribute>
</xpath>

<xpath expr="//select[@name='state_id']/.." position="attributes">
<attribute name="bill">1</attribute>
</xpath>
<xpath expr="//input[@name='vat']/.." position="attributes">
<attribute name="style">display: none</attribute>
</xpath>
Expand Down Expand Up @@ -183,18 +182,21 @@
</tbody>
</table>
</xpath>
<xpath expr="//div[hasclass('oe_cart')]/div[hasclass('card', 'mt-3')]/div[hasclass('card-body')]/div" position="replace">
<t t-if="order.buy_way == 'bill_noship'">
<div><b>Billing : </b><span t-esc='order.partner_id' t-options="dict(widget='contact', fields=['address'], no_marker=True, separator=' ')" class="address-inline"/></div>
</t>
<t t-if="order.buy_way == 'nobill_ship'">
<div><b><t t-if="same_shipping and not only_services">Shipping</t>: </b><span t-esc='order.partner_id' t-options="dict(widget='contact', fields=['address'], no_marker=True, separator=', ')" class="address-inline"/></div>
<div t-if="not same_shipping and not only_services" groups="sale.group_delivery_invoice_address"><b>Shipping: </b><span t-esc='order.partner_shipping_id' t-options="dict(widget='contact', fields=['address'], no_marker=True, separator=', ')" class="address-inline"/></div>
</t>
<t t-if="order.buy_way == 'bill_ship'">
<div><b>Billing <t t-if="same_shipping and not only_services"> &amp; Shipping</t>: </b><span t-esc='order.partner_id' t-options="dict(widget='contact', fields=['address'], no_marker=True, separator=', ')" class="address-inline"/></div>
<div t-if="not same_shipping and not only_services" groups="sale.group_delivery_invoice_address"><b>Shipping: </b><span t-esc='order.partner_shipping_id' t-options="dict(widget='contact', fields=['address'], no_marker=True, separator=', ')" class="address-inline"/></div>
</t>
<xpath expr="//div[hasclass('oe_cart')]/div[hasclass('card', 'mt-3')]/div[hasclass('card-body')]/." position="replace">
<div class="card-body">
<t t-set="same_shipping" t-value="bool(order.partner_shipping_id==order.partner_id or only_services)" />
<t t-if="order.buy_way == 'bill_noship'">
<div><b>Billing : </b><span t-esc='order.partner_id' t-options="dict(widget='contact', fields=['address'], no_marker=True, separator=' ')" class="address-inline"/></div>
</t>
<t t-if="order.buy_way == 'nobill_ship'">
<div t-if="same_shipping and not only_services"><b>Shipping: </b><span t-esc='order.partner_id' t-options="dict(widget='contact', fields=['address'], no_marker=True, separator=', ')" class="address-inline"/></div>
<div t-if="not same_shipping and not only_services" groups="sale.group_delivery_invoice_address"><b>Shipping: </b><span t-esc='order.partner_shipping_id' t-options="dict(widget='contact', fields=['address'], no_marker=True, separator=', ')" class="address-inline"/></div>
</t>
<t t-if="order.buy_way == 'bill_ship'">
<div><b>Billing <t t-if="same_shipping and not only_services"> &amp; Shipping</t>: </b><span t-esc='order.partner_id' t-options="dict(widget='contact', fields=['address'], no_marker=True, separator=', ')" class="address-inline"/></div>
<div t-if="not same_shipping and not only_services" groups="sale.group_delivery_invoice_address"><b>Shipping: </b><span t-esc='order.partner_shipping_id' t-options="dict(widget='contact', fields=['address'], no_marker=True, separator=', ')" class="address-inline"/></div>
</t>
</div>
</xpath>
</template>
</odoo>