Skip to content

Commit

Permalink
[MIG] website_sale_secondary_unit: Migration to 14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Carmen Rondon Regalado committed Jul 21, 2023
1 parent e24184a commit 010163f
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion website_sale_secondary_unit/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Website Sale Secondary Unit",
"summary": "Allow manage secondary units in website shop",
"version": "13.0.1.0.0",
"version": "14.0.1.0.0",
"development_status": "Beta",
"category": "Website",
"website": "https://github.com/OCA/e-commerce",
Expand Down
4 changes: 4 additions & 0 deletions website_sale_secondary_unit/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@

* Sergio Teruel
* Carlos Roca

* `ArcheTI <https://www.archeti.com>`_:

* Carmen Rondon Regalado
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@ odoo.define("website_sale_secondary_unit.animation", function (require) {

const VariantMixin = require("sale.VariantMixin");
const sAnimation = require("website.content.snippets.animation");
var publicWidget = require("web.public.widget");
require("website_sale.website_sale");

publicWidget.registry.WebsiteSale.include({
_submitForm: function () {
if (
this.$form.find('input[name="add_secondary_qty"]').val() !== undefined
) {
this.rootProduct.add_secondary_qty = parseFloat(
this.$form.find('input[name="add_secondary_qty"]').val()
);
}
if (
this.$form.find('select[name="secondary_uom_id"]').val() !== undefined
) {
this.rootProduct.secondary_uom_id = parseFloat(
this.$form.find('select[name="secondary_uom_id"]').val()
);
}
return this._super();
},
});

sAnimation.registry.sale_secondary_unit = sAnimation.Class.extend(VariantMixin, {
selector: ".secondary-unit",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,13 @@ def setUp(self):
def test_ui_website(self):
"""Test frontend tour."""
self.start_tour("/", "website_sale_secondary_unit", login="admin")

def test_add_product_not_allowed_uom(self):
self.product_template.write({"allow_uom_sell": False})
order = self.env['sale.order'].create(
{"partner_id": self.env.ref('base.res_partner_1').id}
)
order._cart_update(
product_id=self.product_template.product_variant_id.id, add_qty=1
)
self.assertEqual(order.cart_quantity, 1)
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<field name="model">product.template</field>
<field name="inherit_id" ref="website_sale.product_template_form_view" />
<field name="arch" type="xml">
<field name="website_style_ids" position="after">
<field name="website_ribbon_id" position="after">
<field name="allow_uom_sell" />
</field>
</field>
Expand Down

0 comments on commit 010163f

Please sign in to comment.