pos_journal_sequence : pos_sequence -> sequence, to have the same as v9

This commit is contained in:
Alexis de Lattre
2014-12-02 15:42:36 +01:00
parent 7f1c5a9b7e
commit 5052b233dd
4 changed files with 12 additions and 8 deletions

View File

@@ -27,10 +27,13 @@
'license': 'AGPL-3', 'license': 'AGPL-3',
'summary': 'Order payment buttons in Point of Sale', 'summary': 'Order payment buttons in Point of Sale',
'description': """ 'description': """
This module adds a field *POS Sequence* on account journals that will This module adds a field *Sequence* field on account journals that will
allow you to control the order of the payment buttons in the interface allow you to control the order of the payment buttons in the interface
of the point of sale. It requires a patch on the Javascript code of the of the point of sale. It requires a patch on the Javascript code of the
point of sale (cf file odoo-point_of_sale.patch). point of sale (cf file odoo-point_of_sale.patch) for v8.
In Odoo v9, this feature will be native, cf
https://github.com/odoo/odoo/pull/3705
This module has been written by Alexis de Lattre This module has been written by Alexis de Lattre
<alexis.delattre@akretion.com>. <alexis.delattre@akretion.com>.

View File

@@ -25,7 +25,8 @@ from openerp import models, fields
class AccountJournal(models.Model): class AccountJournal(models.Model):
_inherit = 'account.journal' _inherit = 'account.journal'
_order = 'sequence,code'
pos_sequence = fields.Integer( sequence = fields.Integer(
string='POS Sequence', string='Sequence',
help='Sequence used to order Payment buttons in the Point of Sale') help='Sequence used to order Payment buttons in the Point of Sale')

View File

@@ -6,9 +6,9 @@ index 8e02ddd..b95c113 100644
renderElement: function() { renderElement: function() {
var self = this; var self = this;
this._super(); this._super();
+ // sort cashregisters by pos_sequence + // sort cashregisters by sequence
+ this.pos.cashregisters.sort(function(obj1, obj2) { + this.pos.cashregisters.sort(function(obj1, obj2) {
+ return obj1.journal.pos_sequence - obj2.journal.pos_sequence; + return obj1.journal.sequence - obj2.journal.sequence;
+ }); + });
_.each(this.pos.cashregisters,function(cashregister) { _.each(this.pos.cashregisters,function(cashregister) {

View File

@@ -15,7 +15,7 @@
<field name="inherit_id" ref="point_of_sale.view_account_journal_pos_user_form"/> <field name="inherit_id" ref="point_of_sale.view_account_journal_pos_user_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="amount_authorized_diff" position="after"> <field name="amount_authorized_diff" position="after">
<field name="pos_sequence"/> <field name="sequence"/>
</field> </field>
</field> </field>
</record> </record>
@@ -26,7 +26,7 @@
<field name="inherit_id" ref="point_of_sale.view_pos_config_form"/> <field name="inherit_id" ref="point_of_sale.view_pos_config_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//field[@name='journal_ids']/tree/field[@name='cash_control']" position="after"> <xpath expr="//field[@name='journal_ids']/tree/field[@name='cash_control']" position="after">
<field name="pos_sequence"/> <field name="sequence"/>
</xpath> </xpath>
</field> </field>
</record> </record>