Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

11.0 mig account invoice fiscal position update #381

Merged
merged 6 commits into from
Sep 17, 2018
Merged

11.0 mig account invoice fiscal position update #381

merged 6 commits into from
Sep 17, 2018

Conversation

ghost
Copy link

@ghost ghost commented May 4, 2018

Migrate to 11.0

CLA Bot will probably give a warning, because my github acocunt is not known, mailed cla@ about this.
@RoelAdriaans-B-informed is me with signed cla, but company account.

@ghost ghost mentioned this pull request May 4, 2018
36 tasks
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


{
'name': 'Invoice Fiscal Position Update',
'version': '10.0.1.0.1',
'version': '11.0.1.0.1',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

11.0.1.0.0

@@ -38,10 +41,13 @@ Credits
Contributors
------------

* Roel Adriaans <roel@road-support.nl>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put you in last position, as this history is supposed to be from beginning to recent contributions

@RoelAdriaans
Copy link
Contributor

@pedrobaeza Changes Done.

Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please squash your 3 migration commits in one.

Copy link
Member

@etobella etobella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some comments in order to make it usable in multicompany environments.

product = line.product_id
if inv_type in ('out_invoice', 'out_refund'):
account = (
product.property_account_income_id or
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should ensure the company of the property for multicompany environments
with_context(force_company=self.company_id.id)

lambda tax: tax.company_id == self.company_id)
else:
account = (
product.property_account_expense_id or
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same

@JordiBForgeFlow
Copy link
Sponsor Member

@RoelAdriaans-old are you planning to consider the latest changes? Or should we better make a pull request that supersedes this one?

@RoelAdriaans
Copy link
Contributor

@jbeficent Sorry forgot about it..
I'll apply the changes suggested by @etobella , can you validate that this is correct?

Copy link
Member

@etobella etobella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@HviorForgeFlow
Copy link
Member

I noticed test_inv_fiscal_pos_update is failing in my CI. I think, it is because I run test after install l10n location.

2018-08-20 16:18:27,215 48 INFO test odoo.modules.module: odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update running tests.
2018-08-20 16:18:27,215 48 INFO test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: test_fiscal_position_id_change (odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update.TestProductIdChange)
2018-08-20 16:18:27,479 48 ERROR test odoo.sql_db: bad query: b'INSERT INTO "account_account" ("id", "deprecated", "user_type_id", "company_id", "reconcile", "code", "name", "centralized", "create_uid", "write_uid", "create_date", "write_date") VALUES(nextval(\'account_account_id_seq\'), false, 14, 1, true, \'710000\', \'customer export account\', false, 1, 1, (now() at time zone \'UTC\'), (now() at time zone \'UTC\')) RETURNING id'
ERROR: duplicate key value violates unique constraint "account_account_code_company_uniq"
DETAIL:  Key (code, company_id)=(710000, 1) already exists.

2018-08-20 16:18:27,487 48 ERROR test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: ERROR
2018-08-20 16:18:27,487 48 INFO test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: ======================================================================
2018-08-20 16:18:27,487 48 ERROR test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: ERROR: test_fiscal_position_id_change (odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update.TestProductIdChange)
2018-08-20 16:18:27,487 48 ERROR test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: Traceback (most recent call last):
2018-08-20 16:18:27,487 48 ERROR test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: `   File "/opt/odoo/auto/addons/account_invoice_fiscal_position_update/tests/test_inv_fiscal_pos_update.py", line 47, in test_fiscal_position_id_change
2018-08-20 16:18:27,488 48 ERROR test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: `     'reconcile': True,
2018-08-20 16:18:27,488 48 ERROR test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: `   File "/opt/odoo/custom/src/odoo/odoo/models.py", line 3373, in create
2018-08-20 16:18:27,488 48 ERROR test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: `     record = self.browse(self._create(old_vals))
2018-08-20 16:18:27,488 48 ERROR test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: `   File "/opt/odoo/custom/src/odoo/odoo/models.py", line 3466, in _create
2018-08-20 16:18:27,488 48 ERROR test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: `     cr.execute(query, tuple(u[2] for u in updates if len(u) > 2))
2018-08-20 16:18:27,488 48 ERROR test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: `   File "/opt/odoo/custom/src/odoo/odoo/sql_db.py", line 155, in wrapper
2018-08-20 16:18:27,488 48 ERROR test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: `     return f(self, *args, **kwargs)
2018-08-20 16:18:27,488 48 ERROR test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: `   File "/opt/odoo/custom/src/odoo/odoo/sql_db.py", line 232, in execute
2018-08-20 16:18:27,488 48 ERROR test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: `     res = self._obj.execute(query, params)
2018-08-20 16:18:27,488 48 ERROR test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: ` psycopg2.IntegrityError: duplicate key value violates unique constraint "account_account_code_company_uniq"
2018-08-20 16:18:27,488 48 ERROR test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: ` DETAIL:  Key (code, company_id)=(710000, 1) already exists.
2018-08-20 16:18:27,488 48 ERROR test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: ` 
2018-08-20 16:18:27,489 48 INFO test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: Ran 1 test in 0.272s
2018-08-20 16:18:27,489 48 ERROR test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update: FAILED
2018-08-20 16:18:27,489 48 INFO test odoo.addons.account_invoice_fiscal_position_update.tests.test_inv_fiscal_pos_update:  (errors=1)
2018-08-20 16:18:27,489 48 ERROR test odoo.modules.module: Module account_invoice_fiscal_position_update: 0 failures, 1 errors

@pedrobaeza
Copy link
Member

Tests should search for an existing account first instead of creating it, or use it a weird code that is not going to choke (example: account_invoice_fiscal_position_update_710000)


def test_fiscal_position_id_change(self):
partner = self.res_partner_model.create(dict(name="George"))
account_export_id = self.account_model.sudo().create({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

account_export_id = self.account_model.sudo().search(
[('code', '=', '710000')], limit=1
)
if not account_export_id:
account_export_id = self.account_model.sudo().create({
'code': "710000",
'name': "customer export account",
'user_type_id': self.account_user_type.id,
'reconcile': True,
})

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I'll try to make the changes this weekend

Copy link
Contributor

@CasVissers-360ERP CasVissers-360ERP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional test done. LGTM

@pedrobaeza
Copy link
Member

@RoelAdriaans can you please finish this?

@pedrobaeza pedrobaeza added this to the 11.0 milestone Sep 16, 2018
@pedrobaeza
Copy link
Member

I have fixed the test creating an unique account code, so I merge.

@pedrobaeza pedrobaeza merged commit 61571d4 into OCA:11.0 Sep 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants