[PATCH] Upstream patch - 15032023

This commit is contained in:
Parthiv Patel committed 2023-03-15 08:35:04 +00:00
1 parent 0afe081e59
commit 4fbe874fe3
11 files changed
+111 -18

No files matched your search

@@ -169,6 +169,12 @@
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field>
</record>
<record id="tax_rep_comp_rule" model="ir.rule">
<field name="name">Tax Repartition multi-company</field>
<field name="model_id" ref="model_account_tax_repartition_line"/>
<field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field>
</record>
<record id="invoice_analysis_comp_rule" model="ir.rule">
<field name="name">Invoice Analysis multi-company</field>
<field name="model_id" ref="model_account_invoice_report"/>
+15 -12
View File
@@ -59,19 +59,22 @@
<table cellspacing="0" cellpadding="0" border="0" style="width: 600px; margin-top: 5px;">
<tbody><tr>
<td valign="center">
<a t-if="has_button_access"
t-att-href="button_access['url']"
style="padding: 8px 12px; font-size: 12px; color: #FFFFFF; text-decoration: none !important; font-weight: 400; background-color: #009EFB; border: 0px solid #009EFB; border-radius:3px">
<t t-esc="button_access['title']"/>
</a>
<t t-if="actions">
<t t-foreach="actions" t-as="action">
|
<a t-att-href="action['url']" style="color: #009EFB; text-decoration:none !important;">
<t t-esc="action['title']"/>
<table cellspacing="0" cellpadding="0" border="0"><tr>
<td t-if="has_button_access" style="padding: 8px 12px; border-radius: 3px; background-color: #009EFB;">
<a t-att-href="button_access['url']" class="button-a button-a-primary"
style="font-size: 12px; color: #FFFFFF; text-decoration: none !important; font-weight: 400;">
<t t-esc="button_access['title']"/>
</a>
</t>
</t>
</td>
<td t-if="actions">
<t t-foreach="actions" t-as="action">
|
<a t-att-href="action['url']" style="color: #009EFB; text-decoration:none !important;">
<t t-esc="action['title']"/>
</a>
</t>
</td>
</tr></table>
</td>
<td valign="center" align="right">
<img t-att-src="'/logo.png?company=%s' % (company.id or 0)" style="padding: 0px; margin: 0px; height: auto; max-width: 200px; max-height: 36px;" t-att-alt="'%s' % company.name"/>
+4 -4
View File
@@ -614,7 +614,7 @@ exports.PosModel = Backbone.Model.extend({
reject();
};
self.company_logo.crossOrigin = "anonymous";
self.company_logo.src = '/web/binary/company_logo' + '?dbname=' + self.session.db + '&company=' + self.company.id + '&_' + Math.random();
self.company_logo.src = `/web/image?model=res.company&id=${self.company.id}&field=logo`;
});
},
}, {
@@ -2290,14 +2290,14 @@ exports.Orderline = Backbone.Model.extend({
}
},
get_taxed_lst_unit_price: function(){
var lst_price = this.get_lst_price();
var base_price = this.compute_fixed_price(this.get_base_price());
if (this.pos.config.iface_tax_included === 'total') {
var product = this.get_product();
var taxes_ids = product.taxes_id;
var product_taxes = this.get_taxes_after_fp(taxes_ids);
return this.compute_all(product_taxes, lst_price, 1, this.pos.currency.rounding).total_included;
return this.compute_all(product_taxes, base_price, 1, this.pos.currency.rounding).total_included;
}
return lst_price;
return base_price;
},
get_price_without_tax: function(){
return this.get_all_prices().priceWithoutTax;
@@ -102,6 +102,17 @@ flectra.define('point_of_sale.tour.ProductScreen', function (require) {
ProductScreen.check.orderIsEmpty();
Tour.register('ProductScreenTour', { test: true, url: '/pos/ui' }, getSteps());
startSteps();
ProductScreen.do.clickHomeCategory();
ProductScreen.do.clickDisplayedProduct('Test Product');
ProductScreen.check.totalAmountIs('100.00');
ProductScreen.do.changeFiscalPosition('No Tax');
ProductScreen.check.noDiscountApplied("100.00");
ProductScreen.check.totalAmountIs('86.96');
Tour.register('FiscalPositionNoTax', { test: true, url: '/pos/ui' }, getSteps());
});
flectra.define('point_of_sale.tour.FixedPriceNegativeQty', function (require) {
@@ -123,6 +123,18 @@ flectra.define('point_of_sale.tour.ProductScreenTourMethods', function (require)
},
];
}
changeFiscalPosition(name) {
return [
{
content: 'click fiscal position button',
trigger: '.o_fiscal_position_button',
},
{
content: 'fiscal position screen is shown',
trigger: `.selection-item:contains("${name}")`,
},
];
}
}
class Check {
@@ -202,6 +214,14 @@ flectra.define('point_of_sale.tour.ProductScreenTourMethods', function (require)
},
];
}
noDiscountApplied(originalPrice) {
return [
{
content: 'no discount is applied',
trigger: `.info:not(:contains(${originalPrice}))`,
},
];
}
}
class Execute {
@@ -576,3 +576,44 @@ class TestUi(TestPointOfSaleHttpCommon):
self.assertAlmostEqual(lines[1].balance, 0)
self.assertEqual(lines[2].account_id, tax_received_account)
self.assertAlmostEqual(lines[2].balance, 1)
def test_fiscal_position_no_tax(self):
#create a tax of 15% with price included
tax = self.env['account.tax'].create({
'name': 'Tax 15%',
'amount': 15,
'price_include': True,
'amount_type': 'percent',
'type_tax_use': 'sale',
})
#create a product with the tax
self.product = self.env['product.product'].create({
'name': 'Test Product',
'taxes_id': [(6, 0, [tax.id])],
'list_price': 100,
'available_in_pos': True,
})
#create a fiscal position that map the tax to no tax
fiscal_position = self.env['account.fiscal.position'].create({
'name': 'No Tax',
'tax_ids': [(0, 0, {
'tax_src_id': tax.id,
'tax_dest_id': False,
})],
})
pricelist = self.env['product.pricelist'].create({
'name': 'Test Pricelist',
'discount_policy': 'without_discount',
})
self.main_pos_config.write({
'tax_regime_selection': True,
'fiscal_position_ids': [(6, 0, [fiscal_position.id])],
'available_pricelist_ids': [(6, 0, [pricelist.id])],
'pricelist_id': pricelist.id,
})
self.main_pos_config.open_session_cb(check_coa=False)
self.start_tour("/pos/ui?config_id=%d" % self.main_pos_config.id, 'FiscalPositionNoTax', login="admin")
+1 -1
View File
@@ -65,7 +65,7 @@ class QWeb(models.AbstractModel):
sub_call = el.get('t-call')
if sub_call:
el.set('t-call-options', f"{{'snippet-key': '{snippet_key}', 'snippet-sub-call-key': '{sub_call}'}}")
# If it already has a data-snippet it is a saved snippet.
# If it already has a data-snippet it is a saved or an inherited snippet.
# Do not override it.
elif 'data-snippet' not in el.attrib:
el.attrib['data-snippet'] = snippet_key.split('.', 1)[-1]
@@ -19,6 +19,8 @@ const dynamicSnippetOptions = options.Class.extend({
* @override
*/
onBuilt: function () {
// TODO Remove in master.
this.$target[0].dataset['snippet'] = 's_dynamic_snippet';
this._setOptionsDefaultValues();
},
@@ -5,6 +5,14 @@ const options = require('web_editor.snippets.options');
const s_dynamic_snippet_options = require('website.s_dynamic_snippet_options');
const dynamicSnippetCarouselOptions = s_dynamic_snippet_options.extend({
/**
* @override
*/
onBuilt() {
this._super(...arguments);
// TODO Remove in master.
this.$target[0].dataset['snippet'] = 's_dynamic_snippet_carousel';
},
//--------------------------------------------------------------------------
// Options
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<flectra>
<template id="website.s_dynamic_snippet_template">
<section t-attf-class="#{snippet_name} s_dynamic d-none pt24 pb24">
<section t-attf-class="#{snippet_name} s_dynamic d-none pt24 pb24" t-att-data-snippet="snippet_name">
<div class="container o_not_editable">
<div class="css_non_editable_mode_hidden">
<div class="missing_option_warning alert alert-info rounded-0 fade show d-print-none">
@@ -20,6 +20,8 @@ const dynamicSnippetProductsOptions = s_dynamic_snippet_carousel_options.extend(
*/
onBuilt: function () {
this._super.apply(this, arguments);
// TODO Remove in master.
this.$target[0].dataset['snippet'] = 's_dynamic_snippet_products';
this._rpc({
route: '/website_sale/snippet/options_filters'
}).then((data) => {