[FIX] point_of_sale,l10n_be_pos_sale: invoice settled order
Current behavior: ?In Belgium? when using a EU intracom tax, as we need to report those special sales to the government we need to create an invoice as we need to report the customer name, VAT number and the country where the goods are going to end up Steps to reproduce: - Create an order with a product and a tax (0% EU M) - Settle the order in the PoS and pay it (no invoice) - Go to the accounting and check the EC Sales List report - There is an error shown in the report opw-3514737 closes odoo/odoo#149239 X-original-commit: bea9ab596950967873766434787e705ccfe04839 Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com> Signed-off-by: Robin Engels (roen) <roen@odoo.com>
This commit is contained in:
@@ -0,0 +1 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
@@ -0,0 +1,21 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
|
||||
{
|
||||
'name': 'l10n_be_pos_sale',
|
||||
'version': '1.0',
|
||||
'category': 'Hidden',
|
||||
'sequence': 6,
|
||||
'summary': 'Link module between pos_sale and l10n_be',
|
||||
'depends': ['pos_sale', 'l10n_be'],
|
||||
'auto_install': True,
|
||||
'assets': {
|
||||
'point_of_sale._assets_pos': [
|
||||
'l10n_be_pos_sale/static/src/js/**/*',
|
||||
],
|
||||
'web.assets_tests': [
|
||||
'l10n_be_pos_sale/static/tests/**/*',
|
||||
],
|
||||
},
|
||||
'license': 'LGPL-3',
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * l10n_be_pos_sale
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0+e\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2023-10-30 09:20+0000\n"
|
||||
"PO-Revision-Date: 2023-10-30 09:20+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: l10n_be_pos_sale
|
||||
#. odoo-javascript
|
||||
#: code:addons/l10n_be_pos_sale/static/src/js/PaymentScreen.js:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"If you do not invoice imported orders you will encounter issues in your "
|
||||
"accounting. Especially in the EC Sale List report"
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_be_pos_sale
|
||||
#. odoo-javascript
|
||||
#: code:addons/l10n_be_pos_sale/static/src/js/PaymentScreen.js:0
|
||||
#, python-format
|
||||
msgid "This order needs to be invoiced"
|
||||
msgstr ""
|
||||
@@ -0,0 +1,21 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { ErrorPopup } from "@point_of_sale/app/errors/popups/error_popup";
|
||||
import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen";
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { _t } from "@web/core/l10n/translation";
|
||||
|
||||
patch(PaymentScreen.prototype, {
|
||||
toggleIsToInvoice() {
|
||||
const has_origin_order = this.currentOrder.get_orderlines().some(line => line.sale_order_origin_id);
|
||||
if(this.currentOrder.is_to_invoice() && this.pos.company.country && this.pos.company.country.code === "BE" && has_origin_order){
|
||||
this.popup.add(ErrorPopup, {
|
||||
title: _t('This order needs to be invoiced'),
|
||||
body: _t('If you do not invoice imported orders you will encounter issues in your accounting. Especially in the EC Sale List report'),
|
||||
});
|
||||
}
|
||||
else{
|
||||
super.toggleIsToInvoice(...arguments);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { Order } from "@point_of_sale/app/store/models";
|
||||
|
||||
patch(Order.prototype, {
|
||||
async pay() {
|
||||
const has_origin_order = this.get_orderlines().some(line => line.sale_order_origin_id);
|
||||
if (this.pos.company.country && this.pos.company.country.code === "BE" && has_origin_order) {
|
||||
this.to_invoice = true;
|
||||
}
|
||||
return super.pay(...arguments);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
/** @odoo-module */
|
||||
|
||||
import * as ErrorPopup from "@point_of_sale/../tests/tours/helpers/ErrorPopupTourMethods";
|
||||
import * as PaymentScreen from "@point_of_sale/../tests/tours/helpers/PaymentScreenTourMethods";
|
||||
import * as ProductScreenPos from "@point_of_sale/../tests/tours/helpers/ProductScreenTourMethods";
|
||||
import * as ProductScreenSale from "@pos_sale/../tests/helpers/ProductScreenTourMethods";
|
||||
const ProductScreen = { ...ProductScreenPos, ...ProductScreenSale };
|
||||
import { registry } from "@web/core/registry";
|
||||
|
||||
registry.category("web_tour.tours").add("PosSettleOrderIsInvoice", {
|
||||
test: true,
|
||||
url: "/pos/ui",
|
||||
steps: () =>
|
||||
[
|
||||
ProductScreen.confirmOpeningPopup(),
|
||||
ProductScreen.clickQuotationButton(),
|
||||
ProductScreen.selectFirstOrder(),
|
||||
ProductScreen.clickPayButton(),
|
||||
PaymentScreen.isInvoiceButtonChecked(),
|
||||
PaymentScreen.clickInvoiceButton(),
|
||||
PaymentScreen.isInvoiceButtonChecked(),
|
||||
ErrorPopup.clickConfirm(),
|
||||
].flat(),
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import test_l10n_be_pos_sale
|
||||
@@ -0,0 +1,40 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import odoo
|
||||
|
||||
from odoo.addons.point_of_sale.tests.test_frontend import TestPointOfSaleHttpCommon
|
||||
from odoo import Command
|
||||
|
||||
@odoo.tests.tagged('post_install_l10n', 'post_install', '-at_install')
|
||||
class TestPoSSaleL10NBe(TestPointOfSaleHttpCommon):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls, chart_template_ref='be_comp'):
|
||||
super().setUpClass(chart_template_ref=chart_template_ref)
|
||||
|
||||
def test_settle_order_is_invoice(self):
|
||||
#Change company country to Belgium
|
||||
self.env.user.company_id.country_id = self.env.ref('base.be')
|
||||
|
||||
self.product_a = self.env['product.product'].create({
|
||||
'name': 'Product A',
|
||||
'type': 'product',
|
||||
'list_price': 10,
|
||||
'taxes_id': False,
|
||||
'available_in_pos': True,
|
||||
})
|
||||
|
||||
sale_order = self.env['sale.order'].create({
|
||||
'partner_id': self.partner_a.id,
|
||||
'order_line': [Command.create({
|
||||
'product_id': self.product_a.id,
|
||||
'product_uom_qty': 10,
|
||||
'product_uom': self.product_a.uom_id.id,
|
||||
'price_unit': 10,
|
||||
'tax_id': False,
|
||||
})],
|
||||
})
|
||||
|
||||
sale_order.action_confirm()
|
||||
self.main_pos_config.open_ui()
|
||||
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'PosSettleOrderIsInvoice', login="accountman")
|
||||
@@ -254,3 +254,13 @@ export function pay(method, amount) {
|
||||
steps.push(...clickValidate());
|
||||
return steps;
|
||||
}
|
||||
|
||||
export function isInvoiceButtonChecked() {
|
||||
return [
|
||||
{
|
||||
content: 'check invoice button is checked',
|
||||
trigger: '.js_invoice.highlight',
|
||||
run: () => {},
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user