[FIX] point_of_sale: Correctly set fiscal position on refunded order
Current behavior: If you apply a fiscal position on a POS order, then refund it, the fiscal position is not applied on the refund order. Steps to reproduce: - Create a fiscal position that match 15% of taxes to 0% of taxes - Create a POS order with a product that has 15% of taxes - Apply the fiscal position on the order - Refund the order - Check the taxes on the refund order, they are not correct opw-3371028 closes odoo/odoo#132768 X-original-commit: 09dbf51e88ea76934634e1b2f4c0292e83f4c9e4 Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com> Signed-off-by: Robin Engels (roen) <roen@odoo.com>
This commit is contained in:
@@ -2383,6 +2383,13 @@ msgstr ""
|
||||
msgid "Fiscal Position"
|
||||
msgstr ""
|
||||
|
||||
#. module: point_of_sale
|
||||
#. odoo-javascript
|
||||
#: code:addons/point_of_sale/static/src/js/Screens/TicketScreen/TicketScreen.js:0
|
||||
#, python-format
|
||||
msgid "Fiscal Position not found"
|
||||
msgstr ""
|
||||
|
||||
#. module: point_of_sale
|
||||
#: model:ir.model.fields,field_description:point_of_sale.field_pos_config__fiscal_position_ids
|
||||
#: model:ir.model.fields,field_description:point_of_sale.field_res_config_settings__pos_fiscal_position_ids
|
||||
@@ -6392,6 +6399,15 @@ msgid ""
|
||||
"The fiscal data module encountered an error while receiving your order."
|
||||
msgstr ""
|
||||
|
||||
#. module: point_of_sale
|
||||
#. odoo-javascript
|
||||
#: code:addons/point_of_sale/static/src/js/Screens/TicketScreen/TicketScreen.js:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"The fiscal position used in the original order is not loaded. Make sure it "
|
||||
"is loaded by adding it in the pos configuration."
|
||||
msgstr ""
|
||||
|
||||
#. module: point_of_sale
|
||||
#. odoo-python
|
||||
#: code:addons/point_of_sale/models/pos_session.py:0
|
||||
|
||||
@@ -261,6 +261,15 @@ export class TicketScreen extends Component {
|
||||
refundDetail.destinationOrderUid = destinationOrder.uid;
|
||||
}
|
||||
|
||||
//Add a check too see if the fiscal position exist in the pos
|
||||
if (order.fiscal_position_not_found) {
|
||||
this.showPopup('ErrorPopup', {
|
||||
title: this.env._t('Fiscal Position not found'),
|
||||
body: this.env._t('The fiscal position used in the original order is not loaded. Make sure it is loaded by adding it in the pos configuration.')
|
||||
});
|
||||
return;
|
||||
}
|
||||
destinationOrder.fiscal_position = order.fiscal_position;
|
||||
// Set the partner to the destinationOrder.
|
||||
this.setPartnerToRefundOrder(partner, destinationOrder);
|
||||
|
||||
|
||||
@@ -1331,7 +1331,8 @@ export class Order extends PosModel {
|
||||
if (fiscal_position) {
|
||||
this.fiscal_position = fiscal_position;
|
||||
} else {
|
||||
console.error("ERROR: trying to load a fiscal position not available in the pos");
|
||||
this.fiscal_position_not_found = true;
|
||||
console.error('ERROR: trying to load a fiscal position not available in the pos');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user