Skip to content
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

[8.0] [ADD] pos order to sale order (w/o picking) #188

Merged
merged 5 commits into from
Mar 9, 2018

Conversation

legalsylvain
Copy link
Contributor

@legalsylvain legalsylvain commented Jul 13, 2017

This PR add a new module pos_order_to_sale order that allow to create sale order based on draft pos order.
3 options are available : create Draft Order, Create Confirmed Order, or Create delivered Picking.

  • Configuration is available on pos.config :
    pos_config_form

  • New button is available on PoS :
    pos_create_picking_option_1

this PR is an alternative to another WIP module, made by Akretion team 'pos_sale_order'. (but the other module, completely remove pos.order feature). In that module, user can continue to create pos.order, and create sale.order (and delivered picking), if desired.
Ref OCA PR : #35 and other work here : https://github.com/stefanrijnhart/pos/tree/8.0-pos-sale-order.

CC : @sebastienbeau, @chafique-delli, @houssine78, @hparfr, @StefanRijnhart.
@grap/developers

More detailled feature available here :
https://github.com/grap/pos/blob/8.0_ADD_pos_order_to_sale_picking/pos_order_to_sale_order/README.rst

@legalsylvain legalsylvain added this to the 8.0 milestone Jul 13, 2017
@legalsylvain legalsylvain force-pushed the 8.0_ADD_pos_order_to_sale_picking branch from 80d612a to c09074a Compare July 13, 2017 11:55
Copy link

@elicoidal elicoidal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 good contribution!
some details

=======================


This module extends the functionality of point of sale to allow you create

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to allow sales order creation from the Point of Sales.

This module extends the functionality of point of sale to allow you create
Sale Orders from the Point of sale.

It adds a new button, below the current bill on the point of sale front end UI,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the POS UI, a button has been added to create the sales order and discard the current POS order

that allows you to create a Sale order, based on the current PoS Order lines
and then to discard the current PoS Order.

This module is usefull if you have some customers that come every day in your

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is a bit limited: this is not the only case I know. Another potential usage is the possibility to have a tablet in a fair and take orders with a very simple interface
Maybe add "For example"

iface_create_sale_order_action = fields.Selection(
string='Sale Order Actions', default='delivered_picking',
required=True, selection=CREATE_SALE_ORDER_ACTION_SELECTION,
help="Choose wich operation will be done after creating a Sale Order"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well... The selection is dynamic but the help message is not 😉 (none blocking)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean, the warning message of the PoS front end ?

}
self.pos.pos_widget.screen_selector.show_popup('confirm', {
message: _t('Create Sale Order and discard the current PoS Order ?'),
comment: _t("This operation will permanently destroy the current PoS Order and create a Sale Order, based on the current order lines. You'll have to create later an invoice.\n Note if you had manually changed unit prices for some products, this changes will not been taken into account in the sale order, and should be done manually on the invoice again."),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/destroy/discard

@legalsylvain legalsylvain changed the title 8.0 add pos order to sale picking [8.0] [ADD] pos order to sale order (w/o picking) Jul 18, 2017
@legalsylvain
Copy link
Contributor Author

Hi,

@elicoidal : Thanks a lot for your review. I'll fix the description in the next days.

I just talked with @sebastienbeau, about this module, and we was imagining having the possibility to create an invoice too. (based on the delivered products), and even to create a paid invoice (with account payment) that mark the invoice as paid.

could you be interested by such features ?

return;
}
// Check Customer
if (current_order.get('client') === null){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!current_order.get('client'))

Are you sure get() returns null and not Undefined ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it works yes. Do you want I test with Undefined, because it's a best practice ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!current_order.get('client'))

Less strict, more conscise

comment: _t("This operation will permanently destroy the current PoS Order and create a Sale Order, based on the current order lines. You'll have to create later an invoice.\n Note if you had manually changed unit prices for some products, this changes will not been taken into account in the sale order, and should be done manually on the invoice again."),
confirm: function(){
var SaleOrderModel = new instance.web.Model('sale.order');
SaleOrderModel.call('create_order_from_pos', [self.prepare_create_sale_order(current_order)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may return SaleOrderModel.call(... for somewhere else.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure to understand. renderElement doesn't return a deferred (in the native Odoo). So it will not be interpreted and managed ?

).then(function (result) {
self.hook_create_sale_order_success(result);
}).fail(function (error, event){
self.hook_create_sale_order_error(error, event);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and re-throw a failed promise

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same remark here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was a suggestion of improvement.
It's ok as is.

Copy link
Contributor

@hparfr hparfr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few remarks which are not blocking.
Thanks for this great work @legalsylvain
👍

Copy link
Contributor Author

@legalsylvain legalsylvain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for you review @hparfr . Do you have any thought about my proposal to include paid invoices ?

).then(function (result) {
self.hook_create_sale_order_success(result);
}).fail(function (error, event){
self.hook_create_sale_order_error(error, event);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same remark here.


This module is usefull if you have some customers that come every day in your
shop, but want to have a unique invoice at the end of the month. With that
module, you can create a sale order adn deliver products every time to keep
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:s/adn/and/

@elicoidal
Copy link

could you be interested by such features ?

Personally not (at least not for my customers) but having a quick entry for sales order and invoices looks like a very good idea for Very Small Businesses

@tjgurwara99
Copy link

This module doesn't take into account of the taxes in sales order. Has anyone been able to get a solution for it! I am new in Odoo community and will really appreciate the help.

@legalsylvain
Copy link
Contributor Author

Hi all. Sorry for the late.
@elicoidal : I updated the description according to your remarks. Could you update your review ?

@hparfr : the same, except two JS remarks. (promise, promise, ...) need help !

Note : I changed the field selection on pos.config by three checkbox. So :

  • it allows to have custom comment in the confirmation popup
  • it allows to display many buttons in the same time, if desired

Copy link

@elicoidal elicoidal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some details.
LGTM

class PosConfig(models.Model):
_inherit = 'pos.config'

iface_create_draft_sale_order = fields.Boolean(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a remark: it could have been interesting to have a checkbox "Create Sales Order" and a selection box with all possible states (you give 3 but multiple others could be imaginable).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Saw your previous message later 👅 anyway both usability options have pros and cons 😄 )

this.sale_order_state = options.sale_order_state;
if (this.sale_order_state == 'draft') {
this.display_text = _t("Create Draft Order");
this.confirmation_message = _t('Create Draft Sale Order and discard the current PoS Order ?');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove space before '?' (multiple)

if (this.sale_order_state == 'draft') {
this.display_text = _t("Create Draft Order");
this.confirmation_message = _t('Create Draft Sale Order and discard the current PoS Order ?');
this.confirmation_comment = _t("This operation will permanently discard the current PoS Order and create a draft Sale Order, based on the current order lines. Note if you had manually changed unit prices for some products, this changes will not been taken into account in the sale order.");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had changed->have changed
(shouldnot this limitation be highlighted in the README BTW)

Copy link
Contributor Author

@legalsylvain legalsylvain Jan 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is written in the readme.

@@ -71,7 +82,10 @@ openerp.pos_order_to_sale_order = function(instance, local) {

// Overload This function to send custom sale order data to server
prepare_create_sale_order: function(order) {
return order.export_as_JSON();
var res = order.export_as_JSON();
console.log(res);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console.log

@legalsylvain
Copy link
Contributor Author

@elicoidal : typo fixed. Now ok ?
thanks.

Copy link

@elicoidal elicoidal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@legalsylvain legalsylvain force-pushed the 8.0_ADD_pos_order_to_sale_picking branch from 17890bd to 7e5e612 Compare March 6, 2018 15:39
@legalsylvain legalsylvain merged commit 4c1879b into OCA:8.0 Mar 9, 2018
hparfr pushed a commit to akretion/pos that referenced this pull request Mar 26, 2018
* [ADD] new module pos_order_to_sale_order
legalsylvain added a commit to grap/pos that referenced this pull request Jul 15, 2018
* [ADD] new module pos_order_to_sale_order
legalsylvain added a commit to legalsylvain/pos that referenced this pull request Apr 27, 2019
* [ADD] new module pos_order_to_sale_order
legalsylvain added a commit to legalsylvain/pos that referenced this pull request Jan 19, 2020
* [ADD] new module pos_order_to_sale_order
legalsylvain added a commit to legalsylvain/pos that referenced this pull request Mar 19, 2020
* [ADD] new module pos_order_to_sale_order
legalsylvain added a commit to legalsylvain/pos that referenced this pull request Jul 4, 2020
* [ADD] new module pos_order_to_sale_order
AdriaGForgeFlow pushed a commit to ForgeFlow/pos that referenced this pull request Aug 14, 2020
* [ADD] new module pos_order_to_sale_order
manuelregidor pushed a commit to sygel-technology/pos that referenced this pull request Jun 28, 2021
* [ADD] new module pos_order_to_sale_order
legalsylvain added a commit to legalsylvain/pos that referenced this pull request Oct 7, 2022
* [ADD] new module pos_order_to_sale_order
zamberjo pushed a commit to aurestic/pos that referenced this pull request Mar 31, 2023
* [ADD] new module pos_order_to_sale_order
zamberjo pushed a commit to aurestic/pos that referenced this pull request Mar 31, 2023
* [ADD] new module pos_order_to_sale_order
zamberjo pushed a commit to aurestic/pos that referenced this pull request Mar 31, 2023
* [ADD] new module pos_order_to_sale_order
zamberjo pushed a commit to aurestic/pos that referenced this pull request Apr 3, 2023
* [ADD] new module pos_order_to_sale_order
zamberjo pushed a commit to aurestic/pos that referenced this pull request Apr 19, 2023
* [ADD] new module pos_order_to_sale_order
anmarmo1 pushed a commit to aurestic/pos that referenced this pull request May 3, 2023
* [ADD] new module pos_order_to_sale_order
zamberjo pushed a commit to aurestic/pos that referenced this pull request May 4, 2023
* [ADD] new module pos_order_to_sale_order
anmarmo1 pushed a commit to aurestic/pos that referenced this pull request May 5, 2023
* [ADD] new module pos_order_to_sale_order
zamberjo pushed a commit to aurestic/pos that referenced this pull request Jan 9, 2024
* [ADD] new module pos_order_to_sale_order
anmarmo1 pushed a commit to aurestic/pos that referenced this pull request Jan 25, 2024
* [ADD] new module pos_order_to_sale_order
vasi26ro pushed a commit to vasi26ro/pos that referenced this pull request Feb 12, 2024
* [ADD] new module pos_order_to_sale_order
anmarmo1 pushed a commit to aurestic/pos that referenced this pull request May 2, 2024
* [ADD] new module pos_order_to_sale_order
chaule97 pushed a commit to chaule97/pos that referenced this pull request Aug 21, 2024
* [ADD] new module pos_order_to_sale_order
chaule97 pushed a commit to chaule97/pos that referenced this pull request Sep 18, 2024
* [ADD] new module pos_order_to_sale_order
anmarmo1 pushed a commit to aurestic/pos that referenced this pull request Nov 21, 2024
* [ADD] new module pos_order_to_sale_order
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants