[WIP] removing incomplete fidelity points feature for the v8.0 release
This commit is contained in:
parent
8cabd5eac9
commit
c4049bc356
|
@ -95,7 +95,6 @@ class pos_config(osv.osv):
|
|||
'barcode_price': fields.char('Price Barcodes', size=64, help='The pattern that identifies a product with a barcode encoded price'),
|
||||
'barcode_weight': fields.char('Weight Barcodes', size=64, help='The pattern that identifies a product with a barcode encoded weight'),
|
||||
'barcode_discount': fields.char('Discount Barcodes', size=64, help='The pattern that identifies a product with a barcode encoded discount'),
|
||||
'fidelity_id': fields.many2one('pos.fidelity','Fidelity Card', help='The type of fidelity card available for this point_of_sale'),
|
||||
}
|
||||
|
||||
def _check_cash_control(self, cr, uid, ids, context=None):
|
||||
|
@ -204,23 +203,6 @@ class pos_config(osv.osv):
|
|||
obj.sequence_id.unlink()
|
||||
return super(pos_config, self).unlink(cr, uid, ids, context=context)
|
||||
|
||||
class pos_fidelity(osv.osv):
|
||||
_name = 'pos.fidelity'
|
||||
|
||||
_columns = {
|
||||
'name' : fields.char('Fidelity Card Name', size=32, select=1,
|
||||
required=True, help="An internal identification for the fidelity card configuration"),
|
||||
'fidpoints_currency': fields.float('Points per paid currency',help="How many fidelity points are given to the customer by sold currency"),
|
||||
'fidpoints_product': fields.float('Points per sold product',help="How many fidelity points are given to the customer by product sold"),
|
||||
'fidpoints_sale': fields.float('Points per sale',help="How many fidelity points are given to the customer for each sale"),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'fidpoints_currency': 0,
|
||||
'fidpoints_product': 0,
|
||||
'fidpoints_sale': 0,
|
||||
}
|
||||
|
||||
class pos_session(osv.osv):
|
||||
_name = 'pos.session'
|
||||
_order = 'id desc'
|
||||
|
@ -564,7 +546,6 @@ class pos_order(osv.osv):
|
|||
'lines': ui_order['lines'],
|
||||
'pos_reference':ui_order['name'],
|
||||
'partner_id': ui_order['partner_id'] or False,
|
||||
'fidpoints': ui_order['fidpoints'],
|
||||
}
|
||||
|
||||
def _payment_fields(self,ui_paymentline):
|
||||
|
@ -598,10 +579,6 @@ class pos_order(osv.osv):
|
|||
session.write({'sequence_number': order['sequence_number'] + 1})
|
||||
session.refresh()
|
||||
|
||||
if order['fidpoints'] and order['partner_id']:
|
||||
partner = self.pool.get('res.partner').browse(cr, uid, order['partner_id'], context=context)
|
||||
partner.write({'fidpoints': partner['fidpoints'] + order['fidpoints']})
|
||||
|
||||
if order['amount_return']:
|
||||
cash_journal = session.cash_journal_id
|
||||
if not cash_journal:
|
||||
|
@ -710,7 +687,6 @@ class pos_order(osv.osv):
|
|||
'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', required=True, states={'draft': [('readonly', False)]}, readonly=True),
|
||||
'partner_id': fields.many2one('res.partner', 'Customer', change_default=True, select=1, states={'draft': [('readonly', False)], 'paid': [('readonly', False)]}),
|
||||
'sequence_number': fields.integer('Sequence Number', help='A session-unique sequence number for the order'),
|
||||
'fidpoints': fields.integer('Won Fidelity Points ', help='The Fidelity Points the client won with this order'),
|
||||
|
||||
'session_id' : fields.many2one('pos.session', 'Session',
|
||||
#required=True,
|
||||
|
@ -760,7 +736,6 @@ class pos_order(osv.osv):
|
|||
'date_order': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'nb_print': 0,
|
||||
'sequence_number': 1,
|
||||
'fidpoints': 0,
|
||||
'session_id': _default_session,
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
|
||||
'pricelist_id': _default_pricelist,
|
||||
|
|
|
@ -672,9 +672,6 @@
|
|||
<field name="receipt_header" placeholder="A custom receipt header message"/>
|
||||
<field name="receipt_footer" placeholder="A custom receipt header footage"/>
|
||||
</group>
|
||||
<group string="Fidelity Cards" col="4" >
|
||||
<field name="fidelity_id" />
|
||||
</group>
|
||||
<group string="Barcode Types" col="4">
|
||||
<field name="barcode_product" />
|
||||
<field name="barcode_cashier" />
|
||||
|
@ -714,59 +711,6 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Fidelity Cards -->
|
||||
|
||||
<record model="ir.ui.view" id="view_pos_fidelity_form">
|
||||
<field name="name">pos.fidelity.form.view</field>
|
||||
<field name="model">pos.fidelity</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Fidelity Card">
|
||||
|
||||
<group col="2">
|
||||
<field name="name" />
|
||||
<field name="fidpoints_currency" />
|
||||
<field name="fidpoints_product" />
|
||||
<field name="fidpoints_sale" />
|
||||
</group>
|
||||
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_pos_fidelity_tree">
|
||||
<field name="name">pos.fidelity.form.view</field>
|
||||
<field name="model">pos.fidelity</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Fidelity Cards">
|
||||
<field name="name" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_pos_fidelity_form">
|
||||
<field name="name">Fidelity Cards</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">pos.fidelity</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to add a Fidelity Card System
|
||||
</p><p>
|
||||
Fidelity card system allows you customer to earn points
|
||||
and rewards when doing business at your shops.
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
parent="point_of_sale.menu_point_config_product"
|
||||
action="action_pos_fidelity_form"
|
||||
id="menu_pos_fidelity"
|
||||
sequence="30"
|
||||
groups="point_of_sale.group_pos_manager" />
|
||||
|
||||
|
||||
<!-- Sessions -->
|
||||
|
||||
<act_window
|
||||
|
|
|
@ -10,7 +10,6 @@ class res_users(osv.osv):
|
|||
_inherit = 'res.partner'
|
||||
_columns = {
|
||||
'ean13' : fields.char('EAN13', size=13, help="BarCode"),
|
||||
'fidpoints': fields.integer('Fidelity Points'),
|
||||
}
|
||||
|
||||
def _check_ean(self, cr, uid, ids, context=None):
|
||||
|
|
|
@ -13,9 +13,6 @@
|
|||
<field name="ean13" />
|
||||
<button name="edit_ean" type="object" string="Edit" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="fidpoints" />
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
</field>
|
||||
|
|
|
@ -49,7 +49,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
|
|||
this.units_by_id = {};
|
||||
this.pricelist = null;
|
||||
this.order_sequence = 1;
|
||||
this.fidelity = null;
|
||||
window.posmodel = this;
|
||||
|
||||
// these dynamic attributes can be watched for change by other models or widgets
|
||||
|
@ -161,7 +160,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
|
|||
}).then(function(users){
|
||||
self.users = users;
|
||||
|
||||
return self.fetch('res.partner', ['name','street','city','country_id','phone','zip','mobile','email','ean13','fidpoints']);
|
||||
return self.fetch('res.partner', ['name','street','city','country_id','phone','zip','mobile','email','ean13']);
|
||||
}).then(function(partners){
|
||||
self.partners = partners;
|
||||
self.db.add_partners(partners);
|
||||
|
@ -207,12 +206,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
|
|||
}).then(function(currencies){
|
||||
self.currency = currencies[0];
|
||||
|
||||
return self.fetch('pos.fidelity',[],[['id','=',self.config.fidelity_id[0] || -1]]);
|
||||
}).then(function(fidelity){
|
||||
if(fidelity.length){
|
||||
self.fidelity = fidelity[0];
|
||||
}
|
||||
|
||||
return self.fetch('product.packaging',['ean','product_id']);
|
||||
}).then(function(packagings){
|
||||
self.db.add_packagings(packagings);
|
||||
|
@ -839,15 +832,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
|
|||
this.get('orderLines').add(line);
|
||||
this.selectLine(this.getLastOrderline());
|
||||
},
|
||||
getWonFidpoints: function(){
|
||||
if(!this.pos.fidelity){
|
||||
return 0;
|
||||
}else{
|
||||
return round_di(this.getTotalTaxIncluded() * this.pos.fidelity.fidpoints_currency +
|
||||
this.get('orderLines').models.length * this.pos.fidelity.fidpoints_product +
|
||||
this.pos.fidelity.fidpoints_sale,0);
|
||||
}
|
||||
},
|
||||
addProduct: function(product, options){
|
||||
options = options || {};
|
||||
var attr = JSON.parse(JSON.stringify(product));
|
||||
|
@ -1038,7 +1022,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
|
|||
cashier: cashier ? cashier.name : null,
|
||||
header: this.pos.config.receipt_header || '',
|
||||
footer: this.pos.config.receipt_footer || '',
|
||||
fidpoints: this.getWonFidpoints(),
|
||||
precision: {
|
||||
price: 2,
|
||||
money: 2,
|
||||
|
@ -1093,7 +1076,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
|
|||
user_id: this.pos.cashier ? this.pos.cashier.id : this.pos.user.id,
|
||||
uid: this.uid,
|
||||
sequence_number: this.sequence_number,
|
||||
fidpoints: this.getWonFidpoints(),
|
||||
};
|
||||
},
|
||||
getSelectedLine: function(){
|
||||
|
|
|
@ -271,21 +271,6 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
|
|||
this.el.querySelector('.summary .total > .value').textContent = this.format_currency(total);
|
||||
this.el.querySelector('.summary .total .subentry .value').textContent = this.format_currency(taxes);
|
||||
|
||||
var $fidpoints = $(this.el).find('.summary .fidpoints');
|
||||
|
||||
if(this.pos.fidelity && order.get_client()){
|
||||
var points = order.getWonFidpoints();
|
||||
var total = order.get_client().fidpoints + points;
|
||||
if( points ){
|
||||
points = points > 0 ? '+'+points : +points;
|
||||
}
|
||||
$fidpoints.replaceWith($(QWeb.render('FidelityPoints',{ widget:this, totalpoints:total, wonpoints: points })));
|
||||
$fidpoints.removeClass('oe_hidden');
|
||||
}else{
|
||||
$fidpoints.empty();
|
||||
$fidpoints.addClass('oe_hidden');
|
||||
}
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -290,7 +290,6 @@
|
|||
<tr class='client-line' t-att-data-id='partner.id'>
|
||||
<td><t t-esc='partner.name' /></td>
|
||||
<td><t t-esc='partner.address' /></td>
|
||||
<td><t t-esc='partner.fidpoints.toFixed(0)' /></td>
|
||||
</tr>
|
||||
</t>
|
||||
|
||||
|
@ -322,10 +321,6 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class='client-details-right'>
|
||||
<div class='client-detail'>
|
||||
<span class='label'>Points</span>
|
||||
<span class='detail client-points'><t t-esc='partner.fidpoints.toFixed(0)' /></span>
|
||||
</div>
|
||||
<div class='client-detail'>
|
||||
<span class='label'>ID</span>
|
||||
<t t-if='partner.ean13'>
|
||||
|
@ -337,7 +332,7 @@
|
|||
</div>
|
||||
<div class='client-detail'>
|
||||
<span class='label'>Tax ID</span>
|
||||
<span class='detail client-vat'>123-45678-9101145</span>
|
||||
<span class='detail client-vat'>TODO</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -378,7 +373,6 @@
|
|||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Address</th>
|
||||
<th>Points</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class='client-list-contents'>
|
||||
|
@ -737,17 +731,6 @@
|
|||
</li>
|
||||
</t>
|
||||
|
||||
<t t-name="FidelityPoints">
|
||||
<div class='fidpoints'>
|
||||
<span class="won">
|
||||
<span class='value'><t t-esc='wonpoints'/></span> Points.
|
||||
</span>
|
||||
<span class='total'>
|
||||
Total: <span class='value'><t t-esc='totalpoints' /></span>
|
||||
</span>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
<t t-name="OrderWidget">
|
||||
<div class="order-container">
|
||||
<div class="order-scroller touch-scrollable">
|
||||
|
@ -760,7 +743,6 @@
|
|||
</t>
|
||||
</ul>
|
||||
<div class="summary clearfix">
|
||||
<div class='fidpoints oe_hidden'>.</div>
|
||||
<div t-attf-class="line #{orderlines.length === 0 ? 'empty' : ''}">
|
||||
<div class='entry total'>
|
||||
<span class="label">Total: </span> <span class="value">0.00 €</span>
|
||||
|
|
Loading…
Reference in New Issue