Giter VIP home page Giter VIP logo

multi-company's Introduction

Runboat Pre-commit Status Build Status codecov Translation Status

Multi company modules

Addons for the management of multi company instances as well as

Available addons

addon version maintainers summary
account_invoice_consolidated 14.0.1.0.4 max3903 swapnesh-serpentcs Consolidate your invoices across companies
account_invoice_inter_company 14.0.1.4.2 Intercompany invoice rules
account_invoice_inter_company_queued 14.0.1.0.1 Generate invoices using jobs
account_invoice_inter_company_sale 14.0.1.0.0 Show sale related fields
account_move_change_company 14.0.1.0.2 Allow to change company of account moves
account_multicompany_easy_creation 14.0.1.0.2 This module adds a wizard to create companies easily
account_payment_other_company 14.0.1.0.2 max3903 osi-scampbell Create Payments for Other Companies
base_multi_company 14.0.2.0.0 pedrobaeza Provides a base for adding multi-company support to models.
company_dependent_attribute 14.0.1.0.0 Display company dependent attribute on fields
company_dependent_flag 14.0.1.0.1 Apply css style to company dependent fields
intercompany_shared_contact 14.0.1.1.3 sebastienbeau User of each company are contact of a company partner. All child address of a company are automatically shared
ir_config_parameter_multi_company 14.0.1.0.1 deniscraciungabriel eLBati Add res company field in ir config parameter
login_all_company 14.0.1.0.1 Access all your companies when you log in
mail_multicompany 14.0.0.1.0 Email Gateway Multi company
mail_template_multi_company 14.0.1.0.0 Olivier-LAURENT Mail Template Multi Company
multicompany_configuration 14.0.1.0.0 Simplify the configuration on multicompany environments
partner_contact_company_propagation 14.0.1.0.0 Propagate company info to children contacts
partner_multi_company 14.0.1.1.0 aleuffre PicchiSeba renda-dev Select individually the partner visibility on each company
partner_multi_company_pos 14.0.1.0.0 aleuffre renda-dev PicchiSeba Partner Multi Company POS
product_category_inter_company 14.0.1.1.0 Product categories as company dependent
product_multi_company 14.0.1.1.1 Select individually the product template visibility on each company
product_supplierinfo_group_intercompany 14.0.1.1.3 Add sequence field on grouped pricelist items
product_supplierinfo_intercompany 14.0.1.1.1 PierrickBrun sebastienbeau kevinkhao Product SupplierInfo Intercompany
product_supplierinfo_intercompany_multi_company 14.0.1.1.0 Compatibility of product_multi_company and product_supplierinfo_intercompany
product_tax_multicompany_default 14.0.1.2.0 Shide Product Tax Multi Company Default
purchase_quick_intercompany 14.0.0.1.1 Purchase Quick Intercompany
purchase_sale_inter_company 14.0.2.2.2 aleuffre renda-dev Intercompany PO/SO rules
res_company_code 14.0.1.0.1 Add 'code' field on company model
stock_intercompany 14.0.1.1.1 Stock Intercompany Delivery-Reception

Licenses

This repository is licensed under AGPL-3.0.

However, each module can have a totally different license, as long as they adhere to Odoo Community Association (OCA) policy. Consult each module's __manifest__.py file, which contains a license key that explains its license.


OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

multi-company's People

Contributors

aaronhforgeflow avatar anasuarez1 avatar astirpe avatar bealdav avatar carlosdauden avatar chafique-delli avatar chienandalu avatar elbati avatar etobella avatar florian-dacosta avatar francesco-ooops avatar ibuioli avatar ilyasprogrammer avatar ivorra78 avatar joansforgeflow avatar kev-roche avatar kevinkhao avatar max3903 avatar mourad-ehm avatar mymage avatar oca-git-bot avatar oca-transbot avatar oca-travis avatar osi-scampbell avatar pedrobaeza avatar renda-dev avatar rousseldenis avatar sebastienbeau avatar weblate avatar yajo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

multi-company's Issues

[10] base_multi_company _compute_company_id improvement suggestion

Hi, can you make some changes to _compute_company_id in base_multi_company? It can fix some potential issues... it will definitely fix the current issue we are having inheriting from this module.

Replace:

@api.multi
    def _compute_company_id(self):
        for record in self:
            for company in record.company_ids:
                    if company.id in self.env.user.company_ids.ids:
                        record.company_id = company.id
                        break

With this:

@api.multi
    def _compute_company_id(self):
        for record in self:
            if self.env.user.company_id.id in record.company_ids.ids:
                record.company_id = self.env.user.company_id
            else:
                for company in record.company_ids:
                    if company.id in self.env.user.company_ids.ids:
                        record.company_id = company.id
                        break

So now, it will take the logged user's current company instead of taking the first company allowed of that logged user. I left the original code in "else", in case it's a special user that can access that record even if his current company is not in the allowed company of that record.

If this suggestion is no good, please let us know why to help us understand.
Thank you!

purchase_sale_intercompany

Hi,
I want to try purchase_sale_inter_company in V10, but it is seem not listed as addon to be ported into v9 or v10. Is this addon not needed in v10 or not suitable anymore?

Please help with info

Thanks,

[RFC] account_move_multi_company

Depends: account_invoice_consolidated
License: AGPL-3

Odoo allows a journal entry to be posted in the same company. In a multi-company environment, it allows to have inter-company transactions at the sale order and purchase order level.

Some group/holding have setup a company structure where an employee is paid by a company of the group but is working part-time for another company of the group.

When the accounting team is loading the accounting entry for the payroll, the amount dedicated to the other companies needs to be transferred to those companies.

Configuration

  • Go to Settings > Users & Companies > Companies
  • Review all the companies to make sure they have:
    • a Due to account
    • a Due From account
    • a Due To/Due From journal
  • Go to Accounting > Configuration > Chart of Accounts
  • Review the accounts to make sure they share the same code across different companies

Usage

  • Go to Accounting > Accounting > Journal Entries
  • Create or select a journal entry
  • On the line, set the field "Transfer to" to another company
  • Post the entry
    • A new journal entry is created and posted to transfer the amount to the "Due From" account
    • In the other company, a journal entry is created and posted to credit the "Due To" account and debit the account with the same code

Technical Specifications

account.move.line

  • Add a new many2one field "Transfer to" (transfer_to_company_id) to res.company.
  • The list is filtered with all the companies in the database except the current one.

account.move

  • Extend the post method to:
call super()
For all account move lines where "Transfer to" is set
  create a journal entry in the current company to transfer the amount to the Due From account (set on the company) using the Due To/Due From journal (set on the company) and post it (Entry A)
  Reconcile the journal item with the original one (A1, A2, etc...)
  for each other company involved,
    create a journal entry in the other company to transfer the amount to the Due To account (set on the other company) using the Due To/Due From journal (set on the other company) and post it (Entry B). For the expense account, select the account with the same code

In Company 1

Journal entry is posted in the payroll journal:

Account Transfer to Partner Debit Credit Reconcile
Payroll Clearing       1000  
Payroll Expense   Employee A 800    
Payroll Expense Company 2 Employee A 200   A1
Payroll Expense   Employee B 600    
Payroll Expense Company 3 Employee B 400   A2
Payroll Expense   Employee C 1000    

Entry A is created, posted and reconciled in the Due To/Due From journal of the company:

Account Transfer to Partner Debit Credit Reconcile
Payroll Expense   Employee A   200 A1
Payroll Expense   Employee B   400 A2
Due From   Company 2 200    
Due From   Company 3 400    

In Company 2

Entry B is created and posted:

Account Transfer to Partner Debit Credit Reconcile
Due To   Company 1   200  
Payroll Expense   Employee A 200    

In Company 3

Entry B is created and posted:

Account Transfer to Partner Debit Credit Reconcile
Due To   Company 1   400  
Payroll Expense   Employee B 400    

Tests

Default behavior

  • Create a journal entry with 2 lines and no "Transfer to" company.
  • Check that the journal entry get posted without generating new entry in the Due To/Due From journal and in the other company

New behavior

  • Create a journal entry with 6 lines, including
  • 2 lines that needs to be transferred to Company 2 and
  • 1 lines to Company 3
  • Check that you have a new journal entry in Company 1 in the Due To/Due From journal with the correct account, partner and amount
  • Check the reconciliation
  • Check that you have a new journal entry in Company 2 in the Due To/Due From journal with the correct account, partner and amount
  • Check that you have a new journal entry in Company 3 in the Due To/Due From journal with the correct account, partner and amount

Odoo 11 multi company Seperate Product Catalogues error

Company A has stock A1
Company B has Stock B1

Company A can transfer stock B1 even though "Common Product Catalog" is not selected and stock is assigned to Company B

may relate to rule "product.product_comp_rule"

Any fixes?

Migration to version 13.0

Todo

https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-13.0

Modules to migrate

Missing module? Check https://github.com/OCA/maintainer-tools/wiki/%5BFAQ%5D-Missing-modules-in-migration-issue-list

[13.0] product_multi_company - access rule error.

Steps to Reproduce

  • Create 3 companies - Company A, Company B, Company C
  • Create a Product A and assign it Company A and Company B
  • Create an user A and his allowed companies be Company B and Company C
  • Login with User A and Go to Sales -> Products -> Products Variants and open the Product A

It will raise the below error.
image

It is working fine with the Product Template (only shows Company B in Companies fields).

[12] purchase_sale_inter_company. Error when validating purchase oder

When a RFQ is created on the moment to be validated this message appears.
01

The reason is that the company changes automatically. But Odoo continues showing the company that mades the purchase order.
02
But if you refresh the screen it changes to the vendor's company.

03
The purchase order is done and the quotation/sale order too. But I think that this error shouldn't be showed. What do you think?

Migration to version 11.0

Todo

https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-11.0

Modules to migrate

[10.0] production lot with same name and product gets blocked

Maybe I am misunderstanding the purpose of stock_production_lot_multi_company, but I have installed the module and here is my issue.

Steps to reproduce the issue in runbot:

  1. With admin: Create a product product_lot with company_ids empty, stockable and tracked by lots
  2. With admin: Give to usera and userb Inventory / Manager
  3. With usera: Create a purchase for 1 product_lot and confirm the incoming shipment assigning the lot lot
  4. With userb: Create a purchase for 1 product_lot and confirm the incoming shipment assigning the lot lot

Current behavior:
Error:

The combination of serial number and product must be unique !

I know where this message comes from and why it is raised, but my question is, what should I do?

  1. Make a PR to edit the SQL-constraint (is it possible?) in stock_production_lot_multi_company to check uniqueness of company_id too
  2. This is not the purpose of the module, so create a fix on my own/in another module

[RFC] account_payment_other_company

Depends: account_invoice_consolidated
License: AGPL-3
Estimation: 12 hours

Description

Odoo Accounting allows each company in a multi-company environment to register payments for their own invoices. Some holding companies needs to be able to register a payment to a vendor bill of another company and automatically create due to's and to from's based on these transactions.

This module allows you to register a payment using the Due To / Due From journal and select the journal of another company to create the journal entries there.

Configuration

  • On each company, set the Due To/Due From Account and Journal

Usage

  • Go to Accounting > Vendors > Bills
  • Create or select an open bill
  • Client on Register Payment
  • Select the Due TO/Due From journal. The field "Paid By" should show up.
  • Select the bank or cash journal of the other company
  • Validate

The vendor bill is paid and if you check the other company, you should find a new journal entry in the journal you selected in "Paid By".

Technical Specifications

account.payment

  • Add a many2one field "Paid By" (other_journal_id) to account.journal.
  • Display the field only if journal_id = company_id.due_fromto_payment_journal_id.id
  • If the field is displayed, it is required.
  • The field filters the journals with:
  • type = bank or cash
  • company_id != self.env.user.company_id.id

screenshot from 2019-10-31 09-59-15

  • Extend the method action_validate_invoice_payment to:
  • call super() and then
  • create and post the journal entry in the other journal and in the other company:
Account Partner Credit Debit
other_journal_id.company_id.due_from_account_id.id company_id.partner_id.id amount  
other_journal_id.default_debit_account_id.id partner_id   amount

[RFC] performances issues on product_multi_company used on huge database

Hi,

I am using product_multi_company on a very big database containing more than 110.000 products spread over 5 companies.

The problem I am facing is bad performance when accessing product.product model.
The record rule is based on a many2many field but when reading through an inherits relation it is not well optimized. We get huge subqueries with expression id in.

We are planning to add a technical field on product template as a string expression of the many2many content.

For exemple= companies_technical = "-1-, -3-, -13-"

The goal is to have the record rule like :

[('companies_technical', 'ilike', str('-' + user.company_id.id + '-')]

The childof in the current record rule will be managed by a search method on the technical field.

We tested this patch and it reduced response time by 6 on some processes.

Does anyone has an opinion on that ? A better idea ?

I am currently preparing a PR with what we did.

Validating SO triggered by PO is not possible

image

When trying to validate a SO created from a PO from another company, the above notification appears. The product pulled from the stock of the selling company by the SO does not seem to have a line on the same SO.

Steps to replicate error:

  1. In a multi company database (Odoo 13.0 Enterprise) with two companies, Company A and Company B, create and confirm a Purchase Order in Company A for a product (Product X) the vendor of which is Company B such that the vendor in the PO is Company B
  2. In Company B, fill the corresponding Sales Order for the same product by purchasing it / manufacturing / taking it from stock, depending on the procurement routes on the same product
  3. Once the required quantity of Product X is available in Company B, validate the warehouse transfer (WHB/OUT/…) for the SO

Expected behaviour

The warehouse transfer (WHB/OUT/…) should be validated successfully

Observed behaviour

The warehouse transfer (WHB/OUT/…) cannot be validated and, instead, the following notification is given: “There’s no corresponding line in PO… for assigning qty from WHB/OUT/… for product Product X”

Migration to version 14.0

Todo

https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-14.0

Modules to migrate

Missing module? Check https://github.com/OCA/maintainer-tools/wiki/%5BFAQ%5D-Missing-modules-in-migration-issue-list

12.0 account_invoice_inter_company, unproper behavior of company_share_product = False

What's wrong

In v12 we have this code and an equivalent in v11
https://github.com/OCA/multi-company/blob/12.0/account_invoice_inter_company/models/account_invoice.py#L232-L234

Analysis:
if dest_company.company_share_product is True : whatever company_id field, all products are shared (weird odoo settings https://github.com/odoo/odoo/blob/12.0/addons/product/models/res_config_settings.py#L10)

if dest_company.company_share_product is False : we return self.env['product.product'] aka False whatever security rule

IMHO in this case it's completely wrong: it should depends on product.product_comp_rule security rule (['|',('company_id','=',user.company_id.id),('company_id','=',False)])

If product pass the rule, product_id must be used not instead of False

I'm in fault because I ported the module to v12

Are you ok with me ?

How it could be better

Apply security rule

PR ...

cc @pedrobaeza @astirpe @florian-dacosta @sebastienbeau Please confirm if I'm OK or not

[RFC] Product Variants by Company

The intent behind these modules will be to provide a product.template that is usable for multiple companies, isolated at the variant level. Paired with website_sale_product, this will allow for multiple companies to share the same product template but still provide a differentiation between them.

The easy side of this will be covered in product_variant_company, which will basically just add a company_id field to product.product. A domain_force will be added to the product.product record in order to limit the view & edit of those variants to users of the proper company (or parent company).

The next piece of this puzzle will be in sale_product_company, which will provide the logic for handling sales orders that contain products from multiple companies.

My thought on this is that if an order is placed that contains products belonging from multiple companies, it will be immediately split into multiple orders (one per relevant company) in the action_confirm method of sale.order.

This means that the order will be one during the quotation phase - which is specifically relevant during website_sale processes. As soon as the order is confirmed, it is then split and sent to the relevant parties for processing. This is a strategy very similar the one Amazon.com uses for Marketplace purchases/payments.

From there, each of the sales will take their standard workflow path as defined by the relevant company.

Does anyone have any thoughts on this, or some code that might be useful?

[13.0] partner_multi_company child contact is visible

Impacted version: 13.0 (I didn't test other versions)
Child contact of parent company (ACME) gets listed although the parent company (ACME) is set to be hidden for the current company (MyCompanyC).

Steps to reproduce:
1- Create a company (ACME), assign ACME to MyCompanyA and MyCompanyB.
2- Add new contact to company ACME (Roadrunner) of type contact
3- back to contact list, from the company dropdown select MyCompanyC and search for ACME, the main company is not listed but so does the contact Roadrunner.

Child contact does not allow editing company_ids, so I assume this value is propagated from parent, right?

Can not create Sales order in Compnay A while Creating Purchase order in Compnay B

Greetings,

The system showing error :

(1) Purchase order created in Company B
(2) At the time of confirming the Purchase order in Company B, it shows error, instead of Creating Sales Order in Company A
(3) Also notice that Company B showing the Company A as vendor, but in Company A contact list Company B is not listed

Thanking you for perusals. Please put your valuable suggestions.
Following is the error in detail at the code :

Odoo Server Error
Traceback (most recent call last):
File "/myho/myho-serverf1/odoo/http.py", line 624, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/myho/myho-serverf1/odoo/http.py", line 310, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/myho/myho-serverf1/odoo/tools/pycompat.py", line 14, in reraise
raise value
File "/myho/myho-serverf1/odoo/http.py", line 669, in dispatch
result = self._call_function(**self.params)
File "/myho/myho-serverf1/odoo/http.py", line 350, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/myho/myho-serverf1/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/myho/myho-serverf1/odoo/http.py", line 339, in checked_call
result = self.endpoint(*a, **kw)
File "/myho/myho-serverf1/odoo/http.py", line 915, in call
return self.method(*args, **kw)
File "/myho/myho-serverf1/odoo/http.py", line 515, in response_wrap
response = f(*args, **kw)
File "/myho/myho-serverf1/addons/web/controllers/main.py", line 1326, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/myho/myho-serverf1/addons/web/controllers/main.py", line 1314, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/myho/myho-serverf1/odoo/api.py", line 387, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/myho/myho-serverf1/odoo/api.py", line 374, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/myho/myho-serverf1/addons/purchase/models/purchase.py", line 361, in button_confirm
order.button_approve()
File "/myho/myho-serverf1/addons/purchase_sale_inter_company/models/purchase_order.py", line 15, in button_approve
res = super().button_approve(force)
File "/myho/enterprise/addons/inter_company_rules/models/purchase_order.py", line 20, in button_approve
order.inter_company_create_sale_order(company_rec)
File "/myho/enterprise/addons/inter_company_rules/models/purchase_order.py", line 67, in inter_company_create_sale_order
so_line_vals = rec._prepare_sale_order_line_data(line, company, sale_order.id)
File "/myho/myho-serverf1/addons/purchase_sale_inter_company/models/purchase_order.py", line 160, in _prepare_sale_order_line_data
"order_id": sale_order.id,
AttributeError: 'int' object has no attribute 'id'

[11]

i configure this module:

i go to the menu Settings > Users & Companies > Companies, select one of the companies

BUT

tab Inter-Company IS NOT

I´ve try in runbot 2minutes ago

WHERE IS THE inter-company tab?????????

captura
.

product_name_unique_per_company could be moved to product_attributes

I think product_name_unique_per_company is useful even with a single company, and actually I have a PR for an almost identical but inferior module in the product attributes project.
Would you consider moving this module to the product attribute project to avoid duplicate features and increase visibility?

When a user switches from one company to another the companies of the related partner are rewritten in stead of amended (partner_multi_company)

Hi,

I'm experiencing some issues with partner_multi_company when a user switches from one company to another.

Use case:

  • User 1 has access to both company A and B.
  • The related partner of this user also has access to both company A and B.
  • This user switches from company A to company B.

This results in a res_users write action (because res_users.company_id is changed). The companies (company_ids) of the related partner are now overwritten, containing company B only.
This may lead to unexpected results such as user 1 not showing up anymore in the list of users in the UI when this list is shown for user 2 with active company A.

Odoo version:
Tested with Odoo v12 CE, partner_multi_company v12.0.1.0.0, base_multi_company v12.0.1.0.1

Proposed solution:
Adapt write(self, vals) in res_users.py

  • Append to user.partner_id.company_ids in stead of replacing the list of linked records.
  • Take new visible_for_all_companies into account.
  • It would probably also be better to keep the companies for the related partner synchronized with res_users.company_ids.

Something like:

    @api.multi
    def write(self, vals):
        res = super(ResUsers, self).write(vals)
        if 'company_id' in vals:
            for user in self.sudo():
                if user.partner_id and not(user.partner_id.visible_for_all_companies) and user.partner_id.company_ids:
                    user.partner_id.company_ids = [(4, vals['company_id'])]       
        if 'company_ids' in vals:
            for user in self.sudo():
                if user.partner_id and not(user.partner_id.visible_for_all_companies) and user.partner_id.company_ids:
                    user.partner_id.company_ids = [(6, 0, vals['company_ids'][0][2])]
        return res

[RFC] account_bill_line_distribution

Depends on: account_invoice_consolidated

Description

Odoo Accounting allows to create vendor bills and 100% of the expense is accounted in the current company. Some holding needs to be able to distribute some vendor bills (like rent) across multiple children companies.

Configuration

  • On each company, set the Due To/Due From Account and Journal
  • Make sure the companies share the same chart of account (the Rent Account must have the same number in each company)

Usage

  • Create a Vendor Bill
  • When adding a line, create a new distribution line to spread the expense to the other company. Make sure the percentages on a vendor line sums to 100%.
  • Validate the vendor bill
  • Check the accounting entries in the companies

Technical Specifications

account.invoice.line.distribution

  • Create the object
  • Set the record name as the company_id field
  • Add a many2one field "Company" (company_id) to res.company
  • Add a float field "Percentage" (percent)
  • Add a many2one field "Bill Line" (invoice_line_id) to account.invoice.line
  • When a distribution is added, update the percentage of the main one

account.invoice.line

  • Add a one2many field "Distribution" (distribution_ids)
  • When an invoice line is created for a vendor bill, create a distribution with the current company and 100.
  • When an invoice line is created or updated, verify that the sum of its percentages equals to 100.

Screenshot from 2019-10-30 16-17-36

account.invoice

Screenshot from 2019-10-30 16-17-51

  • Extend the invoice_validate method to create the following journal entries:

In the current company, additional journal entry in the Due To/Due From Journal set on res.company

Account Partner Credit Debit
Rent Company 2 180  
Due From Company 2   180

In the other company, create journal entry in the Due To/Due From Journal set on res.company of the other company
Use the Due To account set on the company
Use the Expense account with the same number as in the original bill

Account Partner Credit Debit
Due To YourCompany 180  
Rent Vendor   180

Permission rule not applied using base_multi_company module

Hi,
I have a problem with the module base_multi_company, I started the migration of module stock_production_lot_multi_company that inherit the base module (WIP here)
I apply a rule to prevent the user to create or read lot data of other companies (security/stock_production_lot_security.xml) but the rule is not working as expected, the user is able to create lots for other companies and can also read these records after creation (test_03_error_lot_creation assertRaises fails).

Have i misunderstood the usage of the module (i.e. the reference to 'res.company.assignment' model in the abstract class ('multi.company.abstract'))?

Thanks
cc @pedrobaeza @lasley

[8.0] product multi company - question

Hello,

why company_id is not a related on company_ids ? (is it possible ?!)
And, why in the case there is many companies define on the product, company_id is set with the first value ?

Last question, why record rules is set with in and not child_of ?

Thank you

[FIX] account_invoice_consolidated

Background

This module only allows to consolidate invoices that the user has read access to (invoices of children companies).

Requirements

  • Holdging need to be able to consolidate all invoices from all companies regardless of the hierarchy of companies.
  • This invoice should show all the line items from all of the invoices in the same format as the individual invoice. The invoice the customer receives (the consolidated one) should show the items that they purchased.
  • The journal entries currently created are incorrect. Below is an example of the correct ones:

In the current company:

Account Partner Credit Debit
Due From Other Company   200
Account Receivable Customer XYZ 200  

In the other company:

Account Partner Credit Debit
Due To Current Company   200
Account Receivable Customer XYZ 200  

Technical Specifications

account.invoice.line

  • Add a many2one field "Consolidated By" (consolidated_by_id) to account.invoice.consolidated

account.invoice.consolidated

  • Add a one2many field "Invoice Lines" (invoice_line_ids) to account.invoice.line using consolidated_by_id. Make the tab invisible (to avoid access rights errors or confusion).
  • Make the invoice_ids field invisible (to avoid access rights errors or confusion)
  • Update the onchange on partner to search for the invoices using sudo and add all the open invoices from all the other companies (not just the children)
  • Add an onchange to update the invoice_line_ids based on invoice_ids (set the consolidated_by_id on the account.invoice.line)
  • Update the consolidated invoice report to:
  • show the original invoices. Use sudo to avoid the multi-company record rules.
  • show the original invoice lines. Use sudo to avoid the multi-company record rules
  • Add a method prepare_consolidated_invoice_line_values to return a dictionary of the invoice line values
  • Keep the product, analytic account and analytic tags empty (to avoid the generation of the COGS journal items) --> @max3903: Waiting for @serenacyr to confirm
  • Keep the same description but append "(Company Name)"
  • Force the account to the Due From account from the company
  • Set the taxes to the ones with the same name --> @max3903: Waiting for @serenacyr to confirm
  • Keep the other fields the same as the original invoice line
  • Update the action_confirm_invoice method to
  • call prepare_consolidated_invoice_line_values
  • create one invoice line on the consolidated invoice per invoice line of the original invoices
  • update the journal items:
    • for each journal items where the account is the Due From account:
      • Get the company name from the end of the name of the journal item "(Company Name)" (it is a copy from the invoice line description)
      • Find the partner related to that company name
      • Set it as the partner of the journal item (instead of the customer)
  • Make sure we get the correct journal entries when we consolidate (based on the tables provided above)

[RFC] partner_multi_company_active: Active per Company

This module will allow for a partner to be assigned to multiple companies, but only active in a few of them. It could also easily be added directly into partner_multi_company, but I'm not sure if the functionality would be wanted by all.

Currently if a partner is assigned to two companies (C-A & C-B), is deactivated by C-A, it is also deactivated for C-B. This is not ideal, and could cause for partners to drop out of disparate company systems without notice.

This feature will be accomplished by overriding the active field on res.partner to be computed. We will add a new model res.partner.deactivate which will be used to store the activity flag.

It will also add a deactivated_company_ids o2m to res.partner, which will inverse to company_id on res.partner.deactivate.

The compute method of the active field will return False if there are records in deactivated_company_ids for the partner and the company that the user is logged in under. Otherwise, True.

It would be nice if we could somehow store this computation, or maybe just use the cache. This will be a major performance hit without, I think.

The inverse method of the active field will add a new new record into res.partner.deactivate if active is set to False and there is not already an existing, active res.partner.deactivate record for the partner and current company. If active is True, any active res.partner.deactivate record for the partner and the current company will be deactivated.

Note that the above plan is utilizing deactivation of associated records, instead of unlink, because this will create an audit log of partner activations/deactivations that could be potentially useful.

The plan looks pretty simple I think. My main question here is whether we should make the independent module partner_multi_company_active, or just add into partner_multi_company? I personally think that the toggle_active feature is inconsistent with intent while partner_multi_company is installed, but who am I to judge? Anyone have thoughts on this?

cc @pedrobaeza

product_tax_multicompany_default : Search for taxes by tax_group_id instead of name

If you change the name of the taxes like this for example:

  • TVA collectée 20,0% (Company A)
  • TVA collectée 20,0% (Company B)
  • TVA collectée 20,0% (Company C)

The "Propagate Taxes" button does not work.

Instead, I changed "taxes_by_company" function from "ProductTemplate" class to search by taxes group.
Like this : (product.py : line 22)

    def taxes_by_company(self, field, company_id, match_tax_ids=None):
        taxes_ids = []
        if match_tax_ids is None:
            taxes_ids = self.env['ir.default'].get(
                'product.template', field, company_id=company_id)
        # If None: return default taxes if []: return empty list
        if not match_tax_ids:
            return isinstance(taxes_ids, list) and taxes_ids or []
        AccountTax = self.env['account.tax']
        for tax in AccountTax.browse(match_tax_ids):
            taxes_ids.extend(AccountTax.search([
                ('tax_group_id', '=', tax.tax_group_id.name),
                ('company_id', '=', company_id)
            ]).ids)
        return taxes_ids

[10.0] account_invoice_inter_company : changes in onchange_helper (play_onchanges method) result in empty invoice

Changes introduced in OCA/server-tools#1510 are modifying the result of the "play_onchanges" method.

Steps to reproduce :

  • Create a supplier invoice from company S (supplier) for company C (customer)
  • Add an invoice line for 120.0 (100 + 20% VAT)
  • Validate the invoice

Expected result :

  • The supplier invoice is validated with one line of 120.0
  • A customer invoice is generated for company S to company C with one line

Current behaviour :

  • The supplier invoice is validated with one line
  • An empty customer invoice is generated with the message "WARNING!!!!! Failure in the inter-company invoice creation process: the total amount of this invoice is 0.0 but the total amount of the invoice XXX in the company Company S is 120.0"

The problem comes from

dest_line_data = self.env['account.invoice.line'].play_onchanges(
dest_line_data, ['product_id'])

Before september 12th, play_onchanges called with initial values :

{
  'product_id': 87918,
  'invoice_id': 79606,
  'company_id': 13,
  'name': '',
  'uom_id': 1,
  'partner_id': 1,
  'quantity': 1.0
}

was returning :

{
  'product_id': 87918,
  'invoice_id': 79606,
  'name': '',
  'uom_id': 1,
  'invoice_line_tax_ids': [
    (5,),
    (4, 892)
  ],
  'quantity': 1.0,
  'account_id': 3915
}

Now, play_onchanges returns :

{
  'invoice_line_tax_ids': [
    (5,),
    (1, 892, {
      'amount_type': u'percent',
      'legal_mention': False,
      'description': u'VAT 20%',
      'name': u'Standard rate sales (20%)',
      'sequence': 1,
      'tax_adjustment': False,
      'company_id': 13,
      'type_tax_use': u'sale',
      'refund_account_id': 3898,
      'analytic': False,
      'amount': 20.0,
      'include_base_amount': False,
      'tax_group_id': 238,
      'active': True,
      'price_include': False,
      'account_id': 3898
    })
  ],
  'name': u'',
  'account_id': 3606
}

Only changed values are returned (to mimic the UI behaviour), so product_id, invoice_id, etc. are lost, breaking the link between invoice and lines.

Same thing should happen for play_onchanges call with partner_id on invoice in

dest_partner_data = self.env['account.invoice'].play_onchanges(
dest_partner_data, ['partner_id'])

I don't know how to fix this, I see two ways :

  • Modify play_onchanges to get the same result as before
  • Modify these two calls to make an update of the dicts instead of an assignment

display_name becomes non searchable once this module is installed

this module makes the partner display_name field to be non-stored and thus the search function of partner on the display_name becomes invalid resulting in following error:

ERROR database odoo.osv.expression: Non-stored field res.partner.display_name cannot be searched.

Isolate company's objects

At least in version 9.0 all journals, invoices, entries etc are visible during the work with a particular company.
In my opinion each company must have its own 'space'. Only company's objects must be visible until other behavior is not chosen in settings.

[product_multi_company] Unable to export res.company.assignment

Module: product_multi_company
Odoo: v10

I'm testing this module, on latest v10.
When trying to export the table res_company_assignment for the products using the product_multi_company module, I'm getting.

Exception: You can not export the column ID of model res.company.assignment, because the table res_company_assignment is not an ordinary table.

Is this normal behavior?
or am I hitting a bug somewhere?

product_tax_multicompany_default enhancement: adding a new company

I use product_tax_multicompany_default and currently have 5 companies (thanks to the contributers, it works nicely).
I now need to add a new company: what's the easiest way to get the database correct so that all products are also usable in the new company?
It doesn't need to be an enhancement in the module, possibly an example query in the doc of the module could do the trick, although it might be nice to have it in code.

Improvements in Property Fields UI

Hello,

I've been strugling with Property Fields for a while, they work nicely and they sure add a good option for multi-company environments, however I believe the way they show on the UI could be improved.

Today a user needs to be set to use an specific company, only that way we can see the specific field value, if it's a property. However in a true multi-company environment it is possible that some or maybe a lot of users can access more than 1 company, in those cases they have special functions like creating products that can be used into 1 or more companies, anyway, the problem is that for that user to be able to set each different company information for a propery field, he/she needs to change to every single one of them, navigate to the model & record to modify that information.

I think it would be greate if we could improve the UI for property fields where, if a user has access to more than 1 company, he could see a small table with each company name and be capable to change the data for that property field in only 1 screen.

I tried to find any existing module that could add this functionality, so far no success, and I've not too familiar to do a UI change module yet.

Do you guys agree with this plan of action and is this the correct forum ?

Thanks.
Wagner Pereira

Migration to version 12.0

Todo

https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-12.0

Modules to migrate

[13] mail_multicompany: Emails do not reach destination without any reason

I have two companies with two websites.

  • Company A with Website A
  • Company B with Website B

I defined two outgoing mail servers:

  • Server A
  • Server B

Thanks to the mail_multicompany I assigned them to the corresponding companies. When Odoo sends emails it seems like correct mail server is assigned (for example when creating sale order form the Website A it assigns Server A and from Website B assigns Server B). Furthermore Odoo does not throw any error and it looks like emails went through. But they never reach the destination.

And when I leave company field inside mail server empty it is working fine (emails reach the destination) but it is always using the server without company assigned. When both servers do not have company assigned it still working and it is choosing server with higher priority.

I’m also using another OCA addon mail_outbound_static but it does not seem to play any role here.

Any ideas how to track down the reason why emails do not reach the destination?

[12]purchase_sale_inter_company: Purchase order is not set as billed when vendor bills is created autotically

Hello,
I have detected a stange behaviour and i don't know if it's correct or not. It happens when:

  1. A purchase order is made on C1. OK
  2. A sale order is generated on C2. OK
  3. Sale invoice is generated on C2. OK
  4. Automatically in C1 a purchase invoice is created. But this invoice:
  • Don't have products.
  • Is not related to origin purchase order. So the purchase order stays as not billed or if the purchase invoice is created from the purchase order, the purchase invoice is duplicated.
    I leave a video with this behaviour tested on runbot.
    https://drive.google.com/file/d/1SuBXmv9JIOuHlMZLDNoQ1bhTgRHljL-b/view
    Is this the expected behaviour?

Migration to version 15.0

Todo

https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-15.0

Modules to migrate

Missing module? Check https://github.com/OCA/maintainer-tools/wiki/%5BFAQ%5D-Missing-modules-in-migration-issue-list

[RFC] account_bill_line_distribution

We need to add the possibility for the user to enter the amount instead of the percentage.

Technical Specifications

  • Display the field amount on the form view of the vendor bill line
  • Remove the compute of the "amount" field
  • Rename the "_compute_amount" method "onchange_amount" and update the decorator
  • Add an onchange_percent method on the amount field
  • Compute the percentage based on the amount
  • Add a method "check_amount_percent" method to verify the percent and amount always matches

Expected Results / Derived Outputs

screenshot from 2020-04-13 16-05-34

Test Scenarios

  • Create a bill
  • Create a bill line with 3 distribution lines
  • Set the amount on the first one and check that the percentage is computed correctly
  • Set the percentage on the second and check that the amount is computed correctly
  • Set an amount and percentage that do not match on the third and check that you get the validation error of the constraint
  • Validate the bill and check that the journal entries are created correctly

base_multi_company - question

I just discover this module and wonder what will be the advantages of use it like foundation for a new multi_company objects besides the traditional odoo method?

Thanks in advance for your answers!

Multi Company Hooks - Inactive Records

All of our multi company hooks are susceptible to one simple issue - domains are implicitly forced to only include active=True items. This is a problem when it comes to pre-existing, yet deactivated items.

I have a quick fix, but am still in console on a production database. Didn't want to forget this, so please ping me if I do (week or twoish)

Module product_autocompany breaks travis ci test

The module: product_autocompany makes company_id on model(product_template) required
however the demo data in sale/sale_demo.xml:326 have one record of product with empty company_id.

This actually is quite normal in a real project, some customized modules might change the standard workflow which make the standard tests fail.

Product category multi-company

Hi,

Expected result :
When we use product multi-company can we use separate product category for each company

Current behaviour :
When we change a product category in Company 1 on the product it also changes it in Company 2

partner_multi_company: user's partner random existence

Hi,
I found a weird bug on the partner_multicompany module: a user's partner is only visible to its Current Company users. Steps to reproduce:

  1. Create User 1 and User 2 and set Company A and Company B on Allowed Companies for both. As partners for these users are automatically created, you may as well associate them to Company A and B on the partner form.
  2. Log in as User 2, select Company B and navigate to the partners list. You should see a partner named User 1, right? Wrong, it's not there!
  3. On a different browser log in as User 1 and select Company B as well. Guess what: if you refresh the browser you used on step 2 you will now see User 1.

Can you please confirm? I may be missing something here. FYI I've tested on both my system and the last runbot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.