Skip to content
This repository was archived by the owner on Oct 3, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1437d4c
Do not drop indexes
rconjour Aug 11, 2021
29d1ff9
Do not use demo data for unit tests
chrisb-c01 Sep 17, 2021
0036edd
Updated gitignore
chrisb-c01 Sep 23, 2021
72bc507
Merge commit '1437d4c7ed10' into HEAD
Nov 18, 2021
0c5706b
[IMP] core: large object support
KangOl Jan 27, 2021
3cefa6b
[IMP] l10n_fr_fec: fix report
xmo-odoo Mar 27, 2021
b827b80
[FIX] base: prevent messing up existing registry
Jan 24, 2021
61cb007
[IMP] website_mail: optimise nonsense subscription
xmo-odoo Nov 23, 2021
46dd874
[FIX] website: fix video loading
qsm-odoo Sep 8, 2021
2b943b9
[FIX] web: more reliably avoid downloads on new file
xmo-odoo Oct 1, 2021
792dea3
[FIX] web: expect explicit sign up parameters
odony Mar 11, 2021
0da4e6f
[IMP] base: don't try authenticating inactive users
EslamTharwatotrium Jan 12, 2022
b8a02d0
[IMP] base: don't try authenticating inactive users
EslamTharwatotrium Jan 12, 2022
4a86350
[FIX] base: filter assets
EslamTharwatotrium Jan 12, 2022
6d2cee9
[IMP] avoid cycle on request
EslamTharwatotrium Jan 12, 2022
30896ef
Merge pull request #1 from otriumofficial/fix/CVE-2021-23166
Jan 18, 2022
9185223
Merge pull request #10 from otriumofficial/fix/CVE-2021-44476
Jan 18, 2022
69dfab7
Merge pull request #2 from otriumofficial/fix/CVE-2021-23176
Jan 18, 2022
a6d905c
Merge pull request #3 from otriumofficial/fix/CVE-2021-23186
Jan 18, 2022
20755f6
Merge pull request #4 from otriumofficial/fix/CVE-2021-44465
Jan 18, 2022
071b090
Merge pull request #5 from otriumofficial/fix/CVE-2021-44775
Jan 18, 2022
03ef801
Merge pull request #6 from otriumofficial/fix/CVE-2021-45071
Jan 18, 2022
7355deb
Merge pull request #7 from otriumofficial/fix/CVE-2021-26947
Jan 18, 2022
5294ce7
Merge pull request #8 from otriumofficial/fix/CVE-2021-44460
Jan 18, 2022
53ed24b
Merge pull request #9 from otriumofficial/fix/CVE-2021-44475
Jan 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 166 additions & 10 deletions addons/account/tests/test_account_customer_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,39 @@ def test_customer_invoice(self):
# Test with that user which have rights to make Invoicing and payment and who is accountant.
# Create a customer invoice
self.account_invoice_obj = self.env['account.invoice']
self.payment_term = self.env.ref('account.account_payment_term_advance')
account_payment_term_advance = self.env['account.payment.term'].create(dict(
name="30% Advance End of Following Month",
note="Payment terms: 30% Advance End of Following Month",
line_ids=[
(5, 0),
(0, 0, {'value': 'percent', 'value_amount': 30.0, 'sequence': 400, 'days': 0, 'option': 'day_after_invoice_date'}),
(0, 0, {'value': 'balance', 'value_amount': 0.0, 'sequence': 500, 'days': 0, 'option': 'last_day_following_month'})
]
))
self.payment_term = account_payment_term_advance
self.journalrec = self.env['account.journal'].search([('type', '=', 'sale')])[0]
self.partner3 = self.env.ref('base.res_partner_3')
res_partner_category_8 = self.env['res.partner.category'].create(dict(
name="Consultancy Services",
color=5
))
res_partner_category_14 = self.env['res.partner.category'].create(dict(
name="Manufacturer",
color=10
))
res_partner_3 = self.env['res.partner'].create(dict(
name="China Export",
supplier=True,
category_id=[(6, 0, [res_partner_category_8.id, res_partner_category_14.id])],
is_company=True,
city="Shanghai",
zip="200000",
country_id=self.env.ref('base.cn').id,
street="52 Chop Suey street",
email="chinaexport@yourcompany.example.com",
phone="+86 21 6484 5671",
website="http://www.chinaexport.com/"
))
self.partner3 = res_partner_3
account_user_type = self.env.ref('account.data_account_type_receivable')
self.ova = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_current_assets').id)], limit=1)

Expand All @@ -32,10 +62,26 @@ def test_customer_invoice(self):
reconcile=True,
))

product_category_5 = self.env['product.category'].create(dict(
parent_id=self.env.ref('product.product_category_1').id,
name="Physical"
))
product_product_5 = self.env['product.product'].create(dict(
name="Custom Computer (kit)",
categ_id=product_category_5.id,
standard_price=600.0,
list_price=147.0,
type="consu",
uom_id=self.env.ref('product.product_uom_unit').id,
uom_po_id=self.env.ref('product.product_uom_unit').id,
description="Custom computer shipped in kit.",
default_code="E-COM06"
))

invoice_line_data = [
(0, 0,
{
'product_id': self.env.ref('product.product_product_5').id,
'product_id': product_product_5.id,
'quantity': 10.0,
'account_id': self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_revenue').id)], limit=1).id,
'name': 'product test 5',
Expand Down Expand Up @@ -106,9 +152,39 @@ def test_customer_invoice_tax(self):

self.env.user.company_id.tax_calculation_rounding_method = 'round_globally'

payment_term = self.env.ref('account.account_payment_term_advance')
account_payment_term_advance = self.env['account.payment.term'].create(dict(
name="30% Advance End of Following Month",
note="Payment terms: 30% Advance End of Following Month",
line_ids=[
(5, 0),
(0, 0, {'value': 'percent', 'value_amount': 30.0, 'sequence': 400, 'days': 0, 'option': 'day_after_invoice_date'}),
(0, 0, {'value': 'balance', 'value_amount': 0.0, 'sequence': 500, 'days': 0, 'option': 'last_day_following_month'})
]
))
payment_term = account_payment_term_advance
journalrec = self.env['account.journal'].search([('type', '=', 'sale')])[0]
partner3 = self.env.ref('base.res_partner_3')
res_partner_category_8 = self.env['res.partner.category'].create(dict(
name="Consultancy Services",
color=5
))
res_partner_category_14 = self.env['res.partner.category'].create(dict(
name="Manufacturer",
color=10
))
res_partner_3 = self.env['res.partner'].create(dict(
name="China Export",
supplier=True,
category_id=[(6, 0, [res_partner_category_8.id, res_partner_category_14.id])],
is_company=True,
city="Shanghai",
zip="200000",
country_id=self.env.ref('base.cn').id,
street="52 Chop Suey street",
email="chinaexport@yourcompany.example.com",
phone="+86 21 6484 5671",
website="http://www.chinaexport.com/"
))
partner3 = res_partner_3
account_id = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_revenue').id)], limit=1).id

tax = self.env['account.tax'].create({
Expand All @@ -118,10 +194,53 @@ def test_customer_invoice_tax(self):
'type_tax_use': 'sale',
})

product_category_3 = self.env['product.category'].create(dict(
parent_id=self.env.ref('product.product_category_1').id,
name="Services"
))
product_product_1 = self.env['product.product'].create(dict(
name="GAP Analysis Service",
categ_id=product_category_3.id,
standard_price=20.5,
list_price=30.75,
type="service",
uom_id=self.env.ref('product.product_uom_hour').id,
uom_po_id=self.env.ref('product.product_uom_hour').id,
description="Example of products to invoice based on delivery.",
invoice_policy="delivery"
))
product_product_2 = self.env['product.product'].create(dict(
name="Support Service",
categ_id=product_category_3.id,
standard_price=25.5,
list_price=38.25,
type="service",
uom_id=self.env.ref('product.product_uom_hour').id,
uom_po_id=self.env.ref('product.product_uom_hour').id,
description="Example of product to invoice based on delivery.",
invoice_policy="delivery"
))
product_category_5 = self.env['product.category'].create(dict(
parent_id=self.env.ref('product.product_category_1').id,
name="Physical"
))
product_product_3 = self.env['product.product'].create(dict(
name="Computer SC234",
categ_id=product_category_5.id,
standard_price=450.0,
list_price=300.0,
type="consu",
uom_id=self.env.ref('product.product_uom_unit').id,
uom_po_id=self.env.ref('product.product_uom_unit').id,
description_sale="""17" LCD Monitor
Processor AMD 8-Core""",
default_code="PCSC234",
invoice_policy="delivery"
))

invoice_line_data = [
(0, 0,
{
'product_id': self.env.ref('product.product_product_1').id,
'product_id': product_product_1.id,
'quantity': 40.0,
'account_id': account_id,
'name': 'product test 1',
Expand All @@ -132,7 +251,7 @@ def test_customer_invoice_tax(self):
),
(0, 0,
{
'product_id': self.env.ref('product.product_product_2').id,
'product_id': product_product_2.id,
'quantity': 21.0,
'account_id': self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_revenue').id)], limit=1).id,
'name': 'product test 2',
Expand All @@ -143,7 +262,7 @@ def test_customer_invoice_tax(self):
),
(0, 0,
{
'product_id': self.env.ref('product.product_product_3').id,
'product_id': product_product_3.id,
'quantity': 21.0,
'account_id': self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_revenue').id)], limit=1).id,
'name': 'product test 3',
Expand Down Expand Up @@ -182,7 +301,28 @@ def test_customer_invoice_tax_refund(self):
})

journalrec = self.env['account.journal'].search([('type', '=', 'sale')])[0]
partner3 = self.env.ref('base.res_partner_3')
res_partner_category_8 = self.env['res.partner.category'].create(dict(
name="Consultancy Services",
color=5
))
res_partner_category_14 = self.env['res.partner.category'].create(dict(
name="Manufacturer",
color=10
))
res_partner_3 = self.env['res.partner'].create(dict(
name="China Export",
supplier=True,
category_id=[(6, 0, [res_partner_category_8.id, res_partner_category_14.id])],
is_company=True,
city="Shanghai",
zip="200000",
country_id=self.env.ref('base.cn').id,
street="52 Chop Suey street",
email="chinaexport@yourcompany.example.com",
phone="+86 21 6484 5671",
website="http://www.chinaexport.com/"
))
partner3 = res_partner_3
account_id = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_revenue').id)], limit=1).id

tax = self.env['account.tax'].create({
Expand All @@ -194,10 +334,26 @@ def test_customer_invoice_tax_refund(self):
'refund_account_id': tax_refund_account.id
})

product_category_3 = self.env['product.category'].create(dict(
parent_id=self.env.ref('product.product_category_1').id,
name="Services"
))
product_product_1 = self.env['product.product'].create(dict(
name="GAP Analysis Service",
categ_id=product_category_3.id,
standard_price=20.5,
list_price=30.75,
type="service",
uom_id=self.env.ref('product.product_uom_hour').id,
uom_po_id=self.env.ref('product.product_uom_hour').id,
description="Example of products to invoice based on delivery.",
invoice_policy="delivery"
))

invoice_line_data = [
(0, 0,
{
'product_id': self.env.ref('product.product_product_1').id,
'product_id': product_product_1.id,
'quantity': 40.0,
'account_id': account_id,
'name': 'product test 1',
Expand Down
68 changes: 66 additions & 2 deletions addons/account/tests/test_account_invoice_rounding.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,34 @@ def create_cash_rounding(self, rounding, method, strategy):

def create_invoice(self, amount, cash_rounding_id, tax_amount=None):
""" Returns an open invoice """
res_partner_category_0 = self.env['res.partner.category'].create(dict(
name="Partner",
color=1,
))
res_partner_category_7 = self.env['res.partner.category'].create(dict(
name="IT Services",
color=5,
parent_id=res_partner_category_0.id
))
res_partner_category_9 = self.env['res.partner.category'].create(dict(
name="Components Buyer",
color=6
))
res_partner_2 = self.env['res.partner'].create(dict(
name="Agrolait",
category_id=[(6, 0, [res_partner_category_7.id, res_partner_category_9.id])],
is_company=True,
city="Wavre",
zip="1300",
country_id=self.env.ref('base.be').id,
street="69 rue de Namur",
email="agrolait@yourcompany.example.com",
phone="+32 10 588 558",
website="http://www.agrolait.com",
property_payment_term_id=self.env.ref('account.account_payment_term_net').id
))
invoice_id = self.env['account.invoice'].create({
'partner_id': self.env.ref("base.res_partner_2").id,
'partner_id': res_partner_2.id,
'reference_type': 'none',
'currency_id': self.env.ref('base.USD').id,
'name': 'invoice test rounding',
Expand All @@ -42,8 +68,46 @@ def create_invoice(self, amount, cash_rounding_id, tax_amount=None):
})
if tax_amount:
self.fixed_tax.amount = tax_amount

product_category_5 = self.env['product.category'].create(dict(
parent_id=self.env.ref("product.product_category_1").id,
name="Physical"
))

product_attribute_1 = self.env['product.attribute'].create(dict(
name="Memory"
))

product_attribute_2 = self.env['product.attribute'].create(dict(
name="Color"
))

product_attribute_value_1 = self.env['product.attribute.value'].create(dict(
name="16 GB",
attribute_id=product_attribute_1.id
))

product_attribute_value_3 = self.env['product.attribute.value'].create(dict(
name="White",
attribute_id=product_attribute_2.id
))

# self.product_4 = self.env.ref('product.product_product_4')
product_product_4 = self.env['product.product'].create(dict(
name="iPad Retina Display",
categ_id=product_category_5.id,
standard_price=500.0,
list_price=750.0,
type="consu",
uom_id=self.env.ref('product.product_uom_unit').id,
uom_po_id=self.env.ref('product.product_uom_unit').id,
description_sale="7.9‑inch (diagonal) LED-backlit, 128Gb
Dual-core A5 with quad-core graphics
FaceTime HD Camera, 1.2 MP Photos",
default_code="E-COM01",
attribute_value_ids=[(6, 0, [product_attribute_value_1.id, product_attribute_value_3.id])]
))

self.env['account.invoice.line'].create({
'product_id': self.env.ref("product.product_product_4").id,
'product_id': product_product_4.id,
'quantity': 1,
'price_unit': amount,
'invoice_id': invoice_id.id,
Expand Down
Loading