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

[9.0][MIG] inter_company_rules: Migrate v8.0 to v9.0 #30

Closed
wants to merge 28 commits into
base: 9.0
from

Conversation

Projects
None yet
8 participants
@carlosdauden
Contributor

carlosdauden commented Nov 17, 2016

Based in #13

@Tecnativa

chafique-delli and others added some commits May 19, 2015

Block use of admin as inter-company user to avoid a very bad issue wi…
…th taxes on products (explained in details in README.rst)

Use auto-validation option also for invoices
Raise nice error when invoice doesn't have a product (to avoid a crash)
Don't copy the account_analytic_id of the source invoice lines to destination invoices lines (account_analytic_account is a per-company object !)
Write field supplier_invoice_number and check_total on the invoice in target company
Add README following OCA template
Code clean-up
FIX make a new browse otherwise line._uid keeps the purchasing compan…
…y's user and can't see the selling company's taxes
multi-company/issues/new?body=module:%20
inter_company_rules%0Aversion:%20
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

This comment has been minimized.

# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>
#
##############################################################################

This comment has been minimized.

@cubells
# create the SO and generate its lines from the PO lines
SaleOrderLine = self.env['sale.order.line']
# read it as sudo, because inter-compagny user

This comment has been minimized.

@cubells

cubells Nov 18, 2016

Member

Typo here

# create the PO and generate its lines from the SO
PurchaseOrderLine = self.env['purchase.order.line']
# read it as sudo,
# because inter-compagny user can not have the access right on PO

This comment has been minimized.

@cubells

cubells Nov 18, 2016

Member

Typo here

@pedrobaeza

This comment has been minimized.

Contributor

pedrobaeza commented Nov 22, 2016

You have to rename the module to singular.

Inter Company Rules
===================
This module is usefull if there are multiple companies in the same Odoo database and those companies sell goods or services among themselves.

This comment has been minimized.

@pedrobaeza

pedrobaeza Nov 22, 2016

Contributor

s/usefull/useful

Inter Company Rules
===================
This module is usefull if there are multiple companies in the same Odoo database and those companies sell goods or services among themselves.

This comment has been minimized.

@pedrobaeza

pedrobaeza Nov 22, 2016

Contributor

Introduce here line breaks for respecting 80 cols limit

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/133/8.0

This comment has been minimized.

@pedrobaeza

pedrobaeza Nov 22, 2016

Contributor

s/8.0/9.0

* Odoo S.A.
* Chafique Delli <chafique.delli@akretion.com>
* Alexis de Lattre <alexis.delattre@akretion.com>
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>

This comment has been minimized.

@pedrobaeza

pedrobaeza Nov 22, 2016

Contributor

Put yourself here

'name': 'Inter Company Module for Sale/Purchase Orders and Invoices',
'version': '9.0.1.0.0',
'summary': 'Intercompany SO/PO/INV rules',
'author': 'Odoo SA, Odoo Community Association (OCA)',

This comment has been minimized.

@pedrobaeza

pedrobaeza Nov 22, 2016

Contributor

Include our company here.

if (company and company.auto_generate_invoices and
not invoice.auto_generated):
if invoice.type == 'out_invoice':
invoice.inter_company_create_invoice(company,

This comment has been minimized.

@pedrobaeza

pedrobaeza Nov 22, 2016

Contributor

Better to use another indentation style to save lines.

@@ -0,0 +1,230 @@
# -*- coding: utf-8 -*-
from openerp import api, fields, models, _
from openerp.exceptions import Warning as UserError

This comment has been minimized.

@pedrobaeza

pedrobaeza Nov 22, 2016

Contributor

In v9 now UserError is the main exception

:param line : the invoice line object
:rtype line : account.invoice.line record
"""
vals = {

This comment has been minimized.

@pedrobaeza

pedrobaeza Nov 22, 2016

Contributor

Better to call the corresponding onchange method. The only concern here is if it will be correctly called in multi-company context.

SaleOrder = self.env['sale.order']
# find user for creating and validation SO/PO from partner company
intercompany_uid = (company.intercompany_user_id and

This comment has been minimized.

@pedrobaeza

pedrobaeza Nov 22, 2016

Contributor

This can be simplify in this version: intercompany_uid = company.intercompany_user_id.id

@@ -0,0 +1,153 @@
-

This comment has been minimized.

@pedrobaeza

pedrobaeza Nov 22, 2016

Contributor

Change tests to Python.

@chafique-delli

This comment has been minimized.

Contributor

chafique-delli commented Nov 22, 2016

hi, @carlosdauden
Note that the 'inter_company_rules' module (#13) has been splitted in two modules(purchase_sale_inter_company and account_invoice_inter_company).
View PR for purchase_sale_inter_company: #31
View PR for account_invoice_inter_company: #32

@pedrobaeza

This comment has been minimized.

Contributor

pedrobaeza commented Nov 22, 2016

What is the advantage of splitting them?

@chafique-delli

This comment has been minimized.

Contributor

chafique-delli commented Nov 22, 2016

@pedrobaeza , see @alexis-via's comment of January 12 on the PR: #13

@pedrobaeza

This comment has been minimized.

Contributor

pedrobaeza commented Nov 22, 2016

OK, I see the reasoning here: #13 (comment)

@carlosdauden, what do you think?

@carlosdauden carlosdauden force-pushed the Tecnativa:9.0-mig-inter_company_rules branch 3 times, most recently from 9f0ea98 to c44450a Nov 23, 2016

@carlosdauden carlosdauden force-pushed the Tecnativa:9.0-mig-inter_company_rules branch from c44450a to c1067eb Nov 24, 2016

@carlosdauden carlosdauden force-pushed the Tecnativa:9.0-mig-inter_company_rules branch from e1702a6 to 8efc1d9 Jan 3, 2017

@pedrobaeza

This comment has been minimized.

Contributor

pedrobaeza commented on inter_company_rules/models/purchase_order.py in ddf0296 Jan 17, 2017

Take into account company_id.sale_delay for this

@lasley lasley added the needs fixing label Aug 17, 2017

@lasley lasley added this to the 9.0 milestone Aug 17, 2017

@lasley

This comment has been minimized.

Member

lasley commented Aug 17, 2017

Hi @carlosdauden - any update on this?

@pedrobaeza

This comment has been minimized.

Contributor

pedrobaeza commented Jun 22, 2018

Closing as moving to v11

@pedrobaeza pedrobaeza closed this Jun 22, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment