[MERGE] forward port branch saas-14 up to 23d93a69581
This commit is contained in:
@@ -13,3 +13,9 @@ class WebsiteSale(WebsiteSale):
|
||||
if coupon_status.get('error', False):
|
||||
return super(WebsiteSale, self).pricelist(promo, **post)
|
||||
return request.redirect(post.get('r', '/shop/cart'))
|
||||
|
||||
@http.route(['/shop/payment'], type='http', auth="public", website=True)
|
||||
def payment(self, **post):
|
||||
order = request.website.sale_get_order()
|
||||
order.recompute_coupon_lines()
|
||||
return super(WebsiteSale, self).payment(**post)
|
||||
|
||||
@@ -2,5 +2,4 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import sale_coupon_rule
|
||||
import sale_coupon_program
|
||||
import sale_order
|
||||
@@ -1,13 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import models
|
||||
|
||||
class SaleCouponProgram(models.Model):
|
||||
_inherit = 'sale.coupon.program'
|
||||
|
||||
def _filter_programs_on_partners(self, order):
|
||||
return self.filtered(lambda program:
|
||||
program.with_context(active_test=False).rule_partner_ids and
|
||||
order.partner_id.id in program.with_context(active_test=False).rule_partner_ids.ids or
|
||||
not program.with_context(active_test=False).rule_partner_ids)
|
||||
@@ -1,18 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import models, fields, api
|
||||
from odoo.tools.safe_eval import safe_eval
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class SaleCouponRule(models.Model):
|
||||
_inherit = "sale.coupon.rule"
|
||||
|
||||
is_public_included = fields.Boolean(string="Include Public User", help="Is the public user included into the set of autorized customers", default=True)
|
||||
|
||||
@api.depends('is_public_included')
|
||||
def _compute_rule_partner_ids(self):
|
||||
for applicability in self.filtered(lambda x: x.rule_partners_domain):
|
||||
domain = safe_eval(applicability.rule_partners_domain)
|
||||
applicability.rule_partner_ids = domain and self.env['res.partner'].search(domain)
|
||||
if self.is_public_included:
|
||||
public_users = self.sudo().env.ref('base.group_public').with_context(active_test=False).users
|
||||
public_partners = public_users.mapped('partner_id')
|
||||
applicability.rule_partner_ids += public_partners
|
||||
# TODO Remove in master, useless now
|
||||
is_public_included = fields.Boolean(string="Include Public User",
|
||||
help="Is the public user included into the set of autorized customers", default=True, deprecated=True)
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="sale_coupon_program_view_form" model="ir.ui.view">
|
||||
<field name="name">sale.coupon.program.view.form</field>
|
||||
<field name="model">sale.coupon.program</field>
|
||||
<field name="inherit_id" ref="sale_coupon.sale_coupon_program_view_promo_program_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="rule_partners_domain" position="before">
|
||||
<field name="is_public_included"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="sale_coupon.sale_coupon_program_action_promo_program" id="menu_promotion_type_config" name="Promotion Programs" parent="website_sale.menu_catalog" groups="sales_team.group_sale_manager" sequence="50"/>
|
||||
<menuitem id="menu_coupon_type_config" action="sale_coupon.sale_coupon_program_action_coupon_program" name="Coupon Programs" parent="website_sale.menu_catalog" groups="sales_team.group_sale_manager" sequence="51"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user