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
[add] pos_default_invoice_active #212
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functional test on runbot instance: ok
this._super(); | ||
// activate invoicing | ||
if (this.pos.config.iface_invoicing_active) { | ||
this.$('.js_invoice').trigger('click'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you first go on the payment screen, invoice option is active. But if you didn't select any customer, you will be redirected on customer list to select one. After selecting a partner, go back on payment screen, you will see that invoice option is not enabled. Not sure if it's a bug or not, but it's confusing for a user to be asked to select a customer to be able to invoice the order, and then the user has to enable invoice feature again.
I think it's due to this.$('.js_invoice').trigger('click')
, when we go back on the payment screen, it toggles the feature.
@benwillig can you try again? :) |
So as I told you, I think a better way would be to init /******************************************************************************
* Copyright (C) 2017-TODAY Camptocamp SA (<http://www.camptocamp.com>).
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
******************************************************************************/
odoo.define('pos_default_invoice_active.activate_invoicing', function (require) {
"use strict";
var pos_models = require('point_of_sale.models');
var pos_screens = require('point_of_sale.screens');
var PosModel = pos_models.PosModel;
var PosModelSuper = PosModel.prototype;
// add `iface_invoicing_active` to loaded pos config's fields
pos_models.load_fields("pos.config", "iface_invoicing_active");
pos_screens.PaymentScreenWidget.include({
show: function () {
var self = this;
self._super();
self.init_to_invoice_button();
},
init_to_invoice_button: function () {
var self = this;
var order = self.pos.get_order();
var $invoice_button = self.$('.js_invoice');
if (order.is_to_invoice()) {
$invoice_button.addClass('highlight');
} else {
$invoice_button.removeClass('highlight');
}
}
});
pos_models.PosModel = PosModel.extend({
add_new_order: function () {
var self = this;
var order = PosModelSuper.add_new_order.call(self);
if (self.config.iface_invoicing_active) {
order.set_to_invoice(true);
}
return order;
}
})
}); What do you think @simahawk ? |
// activate invoicing | ||
// TODO: any better way to check if the button is already enabled? | ||
if (this.pos.config.iface_invoicing_active && !this.$('.js_invoice').hasClass('highlight')) { | ||
this.$('.js_invoice').trigger('click'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a better way would be to set the order as "To Invoice" when initializing it. I will try to find a way to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any update ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I proposed a fix in an other comment but I don't know what's the status of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry guys, I'm not working on this (well, our related project) since a while. Feel free to carry on 😉
closing, due to inactivity. Feel free to reopen. |
Another module to speed up payment phase like #211