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

[IMP] sale_management: company wise quotation template. #34342

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
7 participants

@robodoo robodoo added the CI 🤖 label Jun 25, 2019

@C3POdoo C3POdoo added the RD label Jun 25, 2019

@robodoo robodoo removed the CI 🤖 label Jun 25, 2019

@mba-odoo mba-odoo force-pushed the odoo-dev:master-sale-quotation-template-companywise-hch branch to 6b34cc3 Jun 25, 2019

mba-odoo added a commit to odoo-dev/odoo that referenced this pull request Jun 25, 2019

[IMP] sale_management: add company on quotation template.
Purpose of the commit is to ensures that a user can choose
sale templates of his/her own company or the templates which
are common.

currently when the product sharing is disbled for multi company
and selecting the quotation template which contains the product of
another company it gives Error because adding a product from another
company into current quotation.

Also added company on demo data as the demo quotation template contains
the product of main company.

task-2025168
Closes: odoo#34342

@robodoo robodoo added the CI 🤖 label Jun 25, 2019

@hch-odoo hch-odoo force-pushed the odoo-dev:master-sale-quotation-template-companywise-hch branch from 6b34cc3 Jun 27, 2019

@robodoo robodoo removed the CI 🤖 label Jun 27, 2019

@hch-odoo hch-odoo force-pushed the odoo-dev:master-sale-quotation-template-companywise-hch branch Jun 27, 2019

@hch-odoo hch-odoo force-pushed the odoo-dev:master-sale-quotation-template-companywise-hch branch to 9c49fbf Jun 27, 2019

hch-odoo added a commit to odoo-dev/odoo that referenced this pull request Jun 27, 2019

[IMP] sale_management: add company on quotation template.
Purpose of the commit is to ensures that a user can choose
sale templates of his/her own company or the templates which
are common.

currently when the product sharing is disbled for multi company
and selecting the quotation template which contains the product of
another company it gives Error because adding a product from another
company into current quotation.

Also added company on demo data as the demo quotation template contains
the product of main company.

task-2025168
Closes: odoo#34342

hch-odoo added a commit to odoo-dev/odoo that referenced this pull request Jun 27, 2019

[IMP] sale: select product companywise
Purpose of the commit is to ensure that a user can choose
products of his/her own company or the products which
are common.
Let user restrict from choosing products from a different company,
and throws a warning message.

task-2025168
closes: odoo#34342

hch-odoo added a commit to odoo-dev/odoo that referenced this pull request Jun 27, 2019

[REM] product, delivery: remove shared product option
Purpose of the commit is to remove the facility of shared products
among companies.
When a user chooses a shared product option, multi-company rules
for products get disabled, and products can be shared among companies.
In this commit, we remove this option, so that from now,
user can choose products from his/her own company only.

task-2025168
closes: odoo#34342

@robodoo robodoo added CI 🤖 and removed CI 🤖 labels Jun 27, 2019

Show resolved Hide resolved addons/sale/models/sale.py Outdated
Show resolved Hide resolved addons/sale/models/sale.py Outdated
Show resolved Hide resolved addons/sale/models/sale.py Outdated
Show resolved Hide resolved addons/sale/models/sale.py Outdated

@mba-odoo mba-odoo force-pushed the odoo-dev:master-sale-quotation-template-companywise-hch branch 2 times, most recently Jun 28, 2019

@robodoo robodoo added the CI 🤖 label Jun 28, 2019

@mba-odoo mba-odoo force-pushed the odoo-dev:master-sale-quotation-template-companywise-hch branch to 0b69091 Jun 28, 2019

mba-odoo added a commit to odoo-dev/odoo that referenced this pull request Jun 28, 2019

[IMP] delivery, product, sale(_management): make company consistence
Purpose of the commit is to make the multi company consistence with product,
sale order and order template.

So the Common Product Catalog setting is removed from generel settings
because its behavior wasn't really clean from a technical point of view
(disabling the rule on products access) and wouldn't work as well with
new multi-company logic.
The default logic of sharing products will be kept, but when someone
wants to limit products sharing, he will do so product by product, by
setting the company_id.

Also the default company_id on product will be blank so default product
will be a sharable by multi company.
and added company_id on sale templates so user can select his/her own
company or the templates which are common.

task-2025168
Closes: odoo#34342

mba-odoo added a commit to odoo-dev/odoo that referenced this pull request Jul 3, 2019

[IMP] purchase: make products company consistence.
Purpose of the commit is to let user select only those
products which are being shared among companies or belongs to own company.

On purchase order user will only able to select those products
which are belongs to same company as purchase order or products
which are sharable by default.

task-2025168
closes: odoo#34342

@robodoo robodoo removed the CI 🤖 label Jul 3, 2019

@mba-odoo

This comment has been minimized.

Copy link
Contributor

commented Jul 3, 2019

@Feyensv Done the changes. thanks

@robodoo robodoo added the CI 🤖 label Jul 3, 2019

@hch-odoo hch-odoo force-pushed the odoo-dev:master-sale-quotation-template-companywise-hch branch from e9ba07c to 601d00d Jul 5, 2019

hch-odoo added a commit to odoo-dev/odoo that referenced this pull request Jul 5, 2019

[IMP] delivery, product, sale(_management): make company consistence
Purpose of the commit is to make the multi company consistence with product,
sale order and order template.

So the Common Product Catalog setting is removed from generel settings
because its behavior wasn't really clean from a technical point of view
(disabling the rule on products access) and wouldn't work as well with
new multi-company logic.
The default logic of sharing products will be kept, but when someone
wants to limit products sharing, he will do so product by product, by
setting the company_id.

Also the default company_id on product will be blank so default product
will be a sharable by multi company.
and added company_id on sale templates so user can select his/her own
company or the templates which are common.

task-2025168
Closes: odoo#34342

hch-odoo added a commit to odoo-dev/odoo that referenced this pull request Jul 5, 2019

[IMP] purchase: make products company consistence.
Purpose of the commit is to let user select only those
products which are being shared among companies or belongs to own company.

On purchase order user will only able to select those products
which are belongs to same company as purchase order or products
which are sharable by default.

task-2025168
closes: odoo#34342

@robodoo robodoo removed the CI 🤖 label Jul 5, 2019

@mba-odoo mba-odoo force-pushed the odoo-dev:master-sale-quotation-template-companywise-hch branch from 601d00d to 0eea69e Jul 10, 2019

mba-odoo added a commit to odoo-dev/odoo that referenced this pull request Jul 10, 2019

[IMP] delivery, product, sale(_management): make company consistence
Purpose of the commit is to make the multi company consistence with product,
sale order and order template.

So the Common Product Catalog setting is removed from generel settings
because its behavior wasn't really clean from a technical point of view
(disabling the rule on products access) and wouldn't work as well with
new multi-company logic.
The default logic of sharing products will be kept, but when someone
wants to limit products sharing, he will do so product by product, by
setting the company_id.

Also the default company_id on product will be blank so default product
will be a sharable by multi company.
and added company_id on sale templates so user can select his/her own
company or the templates which are common.

task-2025168
Closes: odoo#34342

mba-odoo added a commit to odoo-dev/odoo that referenced this pull request Jul 10, 2019

[IMP] purchase: make products company consistence.
Purpose of the commit is to let user select only those
products which are being shared among companies or belongs to own company.

On purchase order user will only able to select those products
which are belongs to same company as purchase order or products
which are sharable by default.

task-2025168
closes: odoo#34342

@hch-odoo hch-odoo force-pushed the odoo-dev:master-sale-quotation-template-companywise-hch branch from 0eea69e to 273b479 Jul 10, 2019

hch-odoo added a commit to odoo-dev/odoo that referenced this pull request Jul 10, 2019

[IMP] delivery, product, sale(_management): make company consistence.
Purpose of the commit is to make the multi company consistence with product,
sale order and order template.

So the Common Product Catalog setting is removed from generel settings
because its behavior wasn't really clean from a technical point of view
(disabling the rule on products access) and wouldn't work as well with
new multi-company logic.
The default logic of sharing products will be kept, but when someone
wants to limit products sharing, he will do so product by product, by
setting the company_id.

Also the default company_id on product will be blank so default product
will be a sharable by multi company.
and added company_id on sale templates so user can select his/her own
company or the templates which are common.

task-2025168
Closes: odoo#34342

hch-odoo added a commit to odoo-dev/odoo that referenced this pull request Jul 10, 2019

[IMP] purchase: make products company consistence.
Purpose of the commit is to let user select only those
products which are being shared among companies or belongs to own company.

On purchase order user will only able to select those products
which are belongs to same company as purchase order or products
which are sharable by default.

task-2025168
closes: odoo#34342

@hch-odoo hch-odoo force-pushed the odoo-dev:master-sale-quotation-template-companywise-hch branch from 273b479 to a04396b Jul 10, 2019

hch-odoo added a commit to odoo-dev/odoo that referenced this pull request Jul 10, 2019

[IMP] delivery, product, sale(_management): make company consistence
Purpose of the commit is to make the multi company consistence with product,
sale order and order template.

So the Common Product Catalog setting is removed from generel settings
because its behavior wasn't really clean from a technical point of view
(disabling the rule on products access) and wouldn't work as well with
new multi-company logic.
The default logic of sharing products will be kept, but when someone
wants to limit products sharing, he will do so product by product, by
setting the company_id.

Also the default company_id on product will be blank so default product
will be a sharable by multi company.
and added company_id on sale templates so user can select his/her own
company or the templates which are common.

task-2025168
Closes: odoo#34342

hch-odoo added a commit to odoo-dev/odoo that referenced this pull request Jul 10, 2019

[IMP] purchase: make products company consistence.
Purpose of the commit is to let user select only those
products which are being shared among companies or belongs to own company.

On purchase order user will only able to select those products
which are belongs to same company as purchase order or products
which are sharable by default.

task-2025168
closes: odoo#34342

@hch-odoo hch-odoo force-pushed the odoo-dev:master-sale-quotation-template-companywise-hch branch from a04396b to cfe5f7e Jul 18, 2019

hch-odoo added a commit to odoo-dev/odoo that referenced this pull request Jul 18, 2019

[IMP] delivery, product, sale(_management): make company consistence
Purpose of the commit is to make the multi company consistence with product,
sale order and order template.

So the Common Product Catalog setting is removed from generel settings
because its behavior wasn't really clean from a technical point of view
(disabling the rule on products access) and wouldn't work as well with
new multi-company logic.
The default logic of sharing products will be kept, but when someone
wants to limit products sharing, he will do so product by product, by
setting the company_id.

Also the default company_id on product will be blank so default product
will be a sharable by multi company.
and added company_id on sale templates so user can select his/her own
company or the templates which are common.

task-2025168
Closes: odoo#34342

hch-odoo added a commit to odoo-dev/odoo that referenced this pull request Jul 18, 2019

[IMP] purchase: make products company consistence.
Purpose of the commit is to let user select only those
products which are being shared among companies or belongs to own company.

On purchase order user will only able to select those products
which are belongs to same company as purchase order or products
which are sharable by default.

task-2025168
closes: odoo#34342

@hch-odoo hch-odoo force-pushed the odoo-dev:master-sale-quotation-template-companywise-hch branch from cfe5f7e to 64ff1f4 Jul 18, 2019

hch-odoo added a commit to odoo-dev/odoo that referenced this pull request Jul 18, 2019

[IMP] purchase: make products company consistence.
Purpose of the commit is to let user select only those
products which are being shared among companies or belongs to own company.

On purchase order user will only able to select those products
which are belongs to same company as purchase order or products
which are sharable by default.

task-2025168
closes: odoo#34342
@dbo-odoo
Copy link
Contributor

left a comment

Hi @hch-odoo
Some changes:

  • remove mapped for relational fields
  • improve error message by listing faulty products

thx :)

@api.constrains('company_id', 'order_line')
def _check_order_line_company_id(self):
for order in self:
companies = order.mapped('order_line.product_id.company_id')

This comment has been minimized.

Copy link
@dbo-odoo

dbo-odoo Jul 18, 2019

Contributor

mapped no longer needed since 63bc601

companies = order.order_line.product_id.company_id
Show resolved Hide resolved addons/purchase/models/purchase.py
Show resolved Hide resolved addons/sale/models/sale.py
@api.constrains('company_id', 'sale_order_option_ids')
def _check_optional_product_company_id(self):
for order in self:
companies = order.mapped('sale_order_option_ids.product_id.company_id')

This comment has been minimized.

Copy link
@dbo-odoo

dbo-odoo Jul 18, 2019

Contributor

same as above

@hch-odoo hch-odoo force-pushed the odoo-dev:master-sale-quotation-template-companywise-hch branch from 64ff1f4 to 74335d2 Jul 18, 2019

hch-odoo added a commit to odoo-dev/odoo that referenced this pull request Jul 18, 2019

[IMP] delivery, product, sale(_management): make company consistence
Purpose of the commit is to make the multi company consistence with product,
sale order and order template.

So the Common Product Catalog setting is removed from generel settings
because its behavior wasn't really clean from a technical point of view
(disabling the rule on products access) and wouldn't work as well with
new multi-company logic.
The default logic of sharing products will be kept, but when someone
wants to limit products sharing, he will do so product by product, by
setting the company_id.

Also the default company_id on product will be blank so default product
will be a sharable by multi company.
and added company_id on sale templates so user can select his/her own
company or the templates which are common.

task-2025168
Closes: odoo#34342

hch-odoo added a commit to odoo-dev/odoo that referenced this pull request Jul 18, 2019

[IMP] purchase: make products company consistence.
Purpose of the commit is to let user select only those
products which are being shared among companies or belongs to own company.

On purchase order user will only able to select those products
which are belongs to same company as purchase order or products
which are sharable by default.

task-2025168
closes: odoo#34342

hch-odoo added some commits Jun 25, 2019

[IMP] delivery, product, sale(_management): make company consistence
Purpose of the commit is to make the multi company consistence with product,
sale order and order template.

So the Common Product Catalog setting is removed from generel settings
because its behavior wasn't really clean from a technical point of view
(disabling the rule on products access) and wouldn't work as well with
new multi-company logic.
The default logic of sharing products will be kept, but when someone
wants to limit products sharing, he will do so product by product, by
setting the company_id.

Also the default company_id on product will be blank so default product
will be a sharable by multi company.
and added company_id on sale templates so user can select his/her own
company or the templates which are common.

task-2025168
Closes: #34342
[IMP] purchase: make products company consistence.
Purpose of the commit is to let user select only those
products which are being shared among companies or belongs to own company.

On purchase order user will only able to select those products
which are belongs to same company as purchase order or products
which are sharable by default.

task-2025168
closes: #34342

@hch-odoo hch-odoo force-pushed the odoo-dev:master-sale-quotation-template-companywise-hch branch from 74335d2 to f2ed64f Jul 18, 2019

@dbo-odoo
Copy link
Contributor

left a comment

import issue, rest seems ok


def set_values(self):
super(ResConfigSettings, self).set_values()
rule = self.env.ref('delivery.delivery_carrier_comp_rule', False)

This comment has been minimized.

Copy link
@dbo-odoo

dbo-odoo Jul 19, 2019

Contributor

note to myself: check this, make sure no regression

@@ -4,7 +4,8 @@
from datetime import datetime, timedelta

from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.addons import decimal_precision as dp

This comment has been minimized.

Copy link
@dbo-odoo

dbo-odoo Jul 19, 2019

Contributor

bad import, probably a rebase issue (decimal_precision is part of base now, no import needed)

from odoo import api, fields, models
from odoo.exceptions import UserError
from odoo import api, fields, models, _
from odoo.addons import decimal_precision as dp

This comment has been minimized.

Copy link
@dbo-odoo

dbo-odoo Jul 19, 2019

Contributor

bad import, probably a rebase issue (decimal_precision is part of base now, no import needed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.