[PATCH] Upstream patch - 22062023

This commit is contained in:
Parthiv Patel committed 2023-06-22 08:34:34 +00:00
1 parent 87658fbb55
commit 5bedd4ce01
6 files changed
+67 -16

No files matched your search

@@ -52,9 +52,9 @@
"ua_psbp_183",183,"Інша дебіторська заборгованість","account.data_account_type_fixed_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_184",184,"Інші необоротні активи","account.data_account_type_fixed_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_191",191,"Гудвіл при придбаннi","account.data_account_type_fixed_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_192",192,"Негативный гудвил","account.data_account_type_fixed_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_192",192,"Негативний гудвіл","account.data_account_type_fixed_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_193",193,"Гудвіл при приватизації (корпоратизації)","account.data_account_type_fixed_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_200",200,"Транспортно-заготівельні витрати (матеріали)","account.data_account_type_current_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_200",200,"Виробничі запаси","account.data_account_type_current_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_201",201,"Сировина й матеріали","account.data_account_type_current_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_202",202,"Купівельні напівфабрикати та комплектуючі вироби","account.data_account_type_current_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_203",203,"Паливо","account.data_account_type_current_assets",FALSE,"l10n_ua_psbo_chart_template"
@@ -79,7 +79,7 @@
"ua_psbp_25",25,"Напівфабрикати","account.data_account_type_current_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_26",26,"Готова продукція","account.data_account_type_current_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_27",27,"Продукція сільськогосподарського виробництва","account.data_account_type_current_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_280",280,"Транспортно-заготівельні витрати","account.data_account_type_current_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_280",280,"Товари","account.data_account_type_current_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_281",281,"Товари на складі","account.data_account_type_current_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_2811",2811,"Товари відвантажені зі складу","account.data_account_type_current_assets",TRUE,"l10n_ua_psbo_chart_template"
"ua_psbp_2812",2812,"Товари отримані на склад","account.data_account_type_current_liabilities",TRUE,"l10n_ua_psbo_chart_template"
@@ -88,7 +88,7 @@
"ua_psbp_284",284,"Тара під товарами","account.data_account_type_current_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_285",285,"Торгова націнка","account.data_account_type_current_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_286",286,"Необоротні активи та групи вибуття, утримувані для продажу","account.data_account_type_current_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_289",289,"Товари в торгівлі (за покупною вартістю)","account.data_account_type_current_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_289",289,"Транспортно-заготівельні витрати (матеріали)","account.data_account_type_current_assets",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_311",311,"Поточні рахунки в національній валюті","account.data_account_type_liquidity",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_312",312,"Поточні рахунки в іноземній валюті","account.data_account_type_liquidity",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_313",313,"Інші рахунки в банку в національній валюті","account.data_account_type_liquidity",FALSE,"l10n_ua_psbo_chart_template"
@@ -263,7 +263,7 @@
"ua_psbp_740",740,"Дохід від зміни вартості фінансових інструментів","account.data_account_type_revenue",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_741",741,"Дохід від реалізації фінансових інвестицій","account.data_account_type_revenue",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_742",742,"Дохід від відновлення корисності активів","account.data_account_type_revenue",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_743",743,"Доход от реализации имущественных комплексов","account.data_account_type_revenue",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_743",743,"Дохід від реалізації майнових комплексів","account.data_account_type_revenue",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_744",744,"Дохід від неопераційної курсової різниці","account.data_account_type_revenue",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_745",745,"Дохід від безоплатно одержаних активів","account.data_account_type_revenue",FALSE,"l10n_ua_psbo_chart_template"
"ua_psbp_746",746,"Інші доходи","account.data_account_type_revenue",FALSE,"l10n_ua_psbo_chart_template"
1 id code name user_type_id:id reconcile chart_template_id:id
52 ua_psbp_183 183 Інша дебіторська заборгованість account.data_account_type_fixed_assets FALSE l10n_ua_psbo_chart_template
53 ua_psbp_184 184 Інші необоротні активи account.data_account_type_fixed_assets FALSE l10n_ua_psbo_chart_template
54 ua_psbp_191 191 Гудвіл при придбаннi account.data_account_type_fixed_assets FALSE l10n_ua_psbo_chart_template
55 ua_psbp_192 192 Негативный гудвил Негативний гудвіл account.data_account_type_fixed_assets FALSE l10n_ua_psbo_chart_template
56 ua_psbp_193 193 Гудвіл при приватизації (корпоратизації) account.data_account_type_fixed_assets FALSE l10n_ua_psbo_chart_template
57 ua_psbp_200 200 Транспортно-заготівельні витрати (матеріали) Виробничі запаси account.data_account_type_current_assets FALSE l10n_ua_psbo_chart_template
58 ua_psbp_201 201 Сировина й матеріали account.data_account_type_current_assets FALSE l10n_ua_psbo_chart_template
59 ua_psbp_202 202 Купівельні напівфабрикати та комплектуючі вироби account.data_account_type_current_assets FALSE l10n_ua_psbo_chart_template
60 ua_psbp_203 203 Паливо account.data_account_type_current_assets FALSE l10n_ua_psbo_chart_template
79 ua_psbp_25 25 Напівфабрикати account.data_account_type_current_assets FALSE l10n_ua_psbo_chart_template
80 ua_psbp_26 26 Готова продукція account.data_account_type_current_assets FALSE l10n_ua_psbo_chart_template
81 ua_psbp_27 27 Продукція сільськогосподарського виробництва account.data_account_type_current_assets FALSE l10n_ua_psbo_chart_template
82 ua_psbp_280 280 Транспортно-заготівельні витрати Товари account.data_account_type_current_assets FALSE l10n_ua_psbo_chart_template
83 ua_psbp_281 281 Товари на складі account.data_account_type_current_assets FALSE l10n_ua_psbo_chart_template
84 ua_psbp_2811 2811 Товари відвантажені зі складу account.data_account_type_current_assets TRUE l10n_ua_psbo_chart_template
85 ua_psbp_2812 2812 Товари отримані на склад account.data_account_type_current_liabilities TRUE l10n_ua_psbo_chart_template
88 ua_psbp_284 284 Тара під товарами account.data_account_type_current_assets FALSE l10n_ua_psbo_chart_template
89 ua_psbp_285 285 Торгова націнка account.data_account_type_current_assets FALSE l10n_ua_psbo_chart_template
90 ua_psbp_286 286 Необоротні активи та групи вибуття, утримувані для продажу account.data_account_type_current_assets FALSE l10n_ua_psbo_chart_template
91 ua_psbp_289 289 Товари в торгівлі (за покупною вартістю) Транспортно-заготівельні витрати (матеріали) account.data_account_type_current_assets FALSE l10n_ua_psbo_chart_template
92 ua_psbp_311 311 Поточні рахунки в національній валюті account.data_account_type_liquidity FALSE l10n_ua_psbo_chart_template
93 ua_psbp_312 312 Поточні рахунки в іноземній валюті account.data_account_type_liquidity FALSE l10n_ua_psbo_chart_template
94 ua_psbp_313 313 Інші рахунки в банку в національній валюті account.data_account_type_liquidity FALSE l10n_ua_psbo_chart_template
263 ua_psbp_740 740 Дохід від зміни вартості фінансових інструментів account.data_account_type_revenue FALSE l10n_ua_psbo_chart_template
264 ua_psbp_741 741 Дохід від реалізації фінансових інвестицій account.data_account_type_revenue FALSE l10n_ua_psbo_chart_template
265 ua_psbp_742 742 Дохід від відновлення корисності активів account.data_account_type_revenue FALSE l10n_ua_psbo_chart_template
266 ua_psbp_743 743 Доход от реализации имущественных комплексов Дохід від реалізації майнових комплексів account.data_account_type_revenue FALSE l10n_ua_psbo_chart_template
267 ua_psbp_744 744 Дохід від неопераційної курсової різниці account.data_account_type_revenue FALSE l10n_ua_psbo_chart_template
268 ua_psbp_745 745 Дохід від безоплатно одержаних активів account.data_account_type_revenue FALSE l10n_ua_psbo_chart_template
269 ua_psbp_746 746 Інші доходи account.data_account_type_revenue FALSE l10n_ua_psbo_chart_template
+7
View File
@@ -274,6 +274,13 @@ class StockWarehouse(models.Model):
})
return data
def _create_missing_locations(self, vals):
super()._create_missing_locations(vals)
for company_id in self.company_id:
location = self.env['stock.location'].search([('usage', '=', 'production'), ('company_id', '=', company_id.id)], limit=1)
if not location:
company_id._create_production_location()
def write(self, vals):
if any(field in vals for field in ('manufacture_steps', 'manufacture_to_resupply')):
for warehouse in self:
+2 -1
View File
@@ -103,7 +103,8 @@ def MockRequest(
debug=False,
sale_order_id=sale_order_id,
),
website=website
website=website,
render=lambda *a, **kw: '<MockResponse>',
)
with contextlib.ExitStack() as s:
+22 -4
View File
@@ -576,12 +576,30 @@ class WebsiteSale(http.Controller):
error = dict()
error_message = []
# prevent name change if invoices exist
if data.get('partner_id'):
partner = request.env['res.partner'].browse(int(data['partner_id']))
if partner.exists() and partner.sudo().name and not partner.sudo().can_edit_vat() and 'name' in data and (data['name'] or False) != (partner.sudo().name or False):
partner_su = request.env['res.partner'].sudo().browse(int(data['partner_id'])).exists()
name_change = partner_su and 'name' in data and data['name'] != partner_su.name
email_change = partner_su and 'email' in data and data['email'] != partner_su.email
# Prevent changing the partner name if invoices have been issued.
if name_change and not partner_su.can_edit_vat():
error['name'] = 'error'
error_message.append(_('Changing your name is not allowed once invoices have been issued for your account. Please contact us directly for this operation.'))
error_message.append(_(
"Changing your name is not allowed once invoices have been issued for your"
" account. Please contact us directly for this operation."
))
# Prevent change the partner name or email if it is an internal user.
if (name_change or email_change) and not all(partner_su.user_ids.mapped('share')):
error.update({
'name': 'error' if name_change else None,
'email': 'error' if email_change else None,
})
error_message.append(_(
"If you are ordering for an external person, please place your order via the"
" backend. If you wish to change your name or email address, please do so in"
" the account settings or contact your administrator."
))
# Required fields from form
required_fields = [f for f in (all_form_values.get('field_required') or '').split(',') if f]
+30 -5
View File
@@ -4,7 +4,7 @@
import flectra.tests
from flectra import api
from flectra.addons.base.tests.common import HttpCaseWithUserDemo, TransactionCaseWithUserDemo
from flectra.addons.base.tests.common import HttpCaseWithUserDemo, TransactionCaseWithUserDemo, HttpCaseWithUserPortal
from flectra.addons.website_sale.controllers.main import WebsiteSale
from flectra.addons.website_sale.tests.common import TestWebsiteSaleCommon
from flectra.addons.website.tools import MockRequest
@@ -103,7 +103,7 @@ class TestUi(HttpCaseWithUserDemo, TestWebsiteSaleCommon):
@flectra.tests.tagged('post_install', '-at_install')
class TestWebsiteSaleCheckoutAddress(TransactionCaseWithUserDemo):
class TestWebsiteSaleCheckoutAddress(TransactionCaseWithUserDemo, HttpCaseWithUserPortal):
''' The goal of this method class is to test the address management on
the checkout (new/edit billing/shipping, company_id, website_id..).
'''
@@ -175,6 +175,9 @@ class TestWebsiteSaleCheckoutAddress(TransactionCaseWithUserDemo):
self.demo_user.company_id = self.company_c
self.demo_partner = self.demo_user.partner_id
self.portal_user = self.user_portal
self.portal_partner = self.portal_user.partner_id
def test_02_demo_address_and_company(self):
''' This test ensure that the company_id of the address (partner) is
correctly set and also, is not wrongly changed.
@@ -196,12 +199,12 @@ class TestWebsiteSaleCheckoutAddress(TransactionCaseWithUserDemo):
self.assertTrue(new_shipping.company_id != self.env.user.company_id, "Logged in user new shipping should not get the company of the sudo() neither the one from it's partner..")
self.assertEqual(new_shipping.company_id, self.website.company_id, ".. but the one from the website.")
# 2. Logged in user, edit billing
# 2. Logged in user/internal user, should not edit name or email address of billing
self.default_address_values['partner_id'] = self.demo_partner.id
# Name cannot be changed if there are issued invoices
self.default_address_values['name'] = self.demo_partner.name
self.WebsiteSaleController.address(**self.default_address_values)
self.assertEqual(self.demo_partner.company_id, self.company_c, "Logged in user edited billing (the partner itself) should not get its company modified.")
self.assertNotEqual(self.demo_partner.name, self.default_address_values['name'], "Employee cannot change their name during the checkout process.")
self.assertNotEqual(self.demo_partner.email, self.default_address_values['email'], "Employee cannot change their email during the checkout process.")
def test_03_public_user_address_and_company(self):
''' Same as test_02 but with public user '''
@@ -240,3 +243,25 @@ class TestWebsiteSaleCheckoutAddress(TransactionCaseWithUserDemo):
self.WebsiteSaleController.pricelist('')
self.assertNotEqual(so.pricelist_id, eur_pl, "Pricelist should be removed when sending an empty pl code")
def test_05_portal_user_address_and_company(self):
''' Same as test_03 but with portal user '''
self._setUp_multicompany_env()
so = self._create_so(self.portal_partner.id)
env = api.Environment(self.env.cr, self.portal_user.id, {})
# change also website env for `sale_get_order` to not change order partner_id
with MockRequest(env, website=self.website.with_env(env), sale_order_id=so.id) as req:
req.httprequest.method = "POST"
# 1. Portal user, new shipping, same with the log in user
self.WebsiteSaleController.address(**self.default_address_values)
new_shipping = self._get_last_address(self.portal_partner)
self.assertTrue(new_shipping.company_id != self.env.user.company_id, "Portal user new shipping should not get the company of the sudo() neither the one from it's partner..")
self.assertEqual(new_shipping.company_id, self.website.company_id, ".. but the one from the website.")
# 2. Portal user, edit billing
self.default_address_values['partner_id'] = self.portal_partner.id
self.WebsiteSaleController.address(**self.default_address_values)
# Name cannot be changed if there are issued invoices
self.assertNotEqual(self.portal_partner.name, self.default_address_values['name'], "Portal User should not be able to change the name if they have invoices under their name.")
+1 -1
View File
@@ -101,7 +101,7 @@
<field name="public_categ_ids" widget="many2many_tags" string="Categories"/>
<field name="alternative_product_ids" widget="many2many_tags" domain="[('id', '!=', active_id), '|', ('company_id', '=', company_id), ('company_id', '=', False)]"/>
<field name="accessory_product_ids" widget="many2many_tags"/>
<field name="website_ribbon_id" groups="base.group_no_one" options="{'no_quick_create': True'}"/>
<field name="website_ribbon_id" groups="base.group_no_one" options="{'no_quick_create': True}"/>
</group>
</group>
<group name="product_template_images" string="Extra Product Media">