Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2019 PlanetaTIC - Marc Poch <mpoch@planetatic.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2019 PlanetaTIC - Marc Poch <mpoch@planetatic.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
'name': 'Replenishment cost default seller', | ||
'version': '10.0.1.0.0', | ||
'author': "PlanetaTIC,Odoo Community Association (OCA)", | ||
'category': 'Products', | ||
'depends': [ | ||
'product_replenishment_cost', | ||
], | ||
'description': """Replenishment cost default seller""", | ||
'website': 'https://github.com/OCA/margin-analysis', | ||
'data': [ | ||
], | ||
'test': [], | ||
'license': 'AGPL-3', | ||
'installable': True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2019 PlanetaTIC - Marc Poch <mpoch@planetatic.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import product_product |
22 changes: 22 additions & 0 deletions
22
product_replenishment_cost_default_seller/models/product_product.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2019 PlanetaTIC - Marc Poch <mpoch@planetatic.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, api | ||
from odoo.models import Model | ||
|
||
import odoo.addons.decimal_precision as dp | ||
|
||
|
||
class ProductProduct(Model): | ||
_inherit = 'product.product' | ||
|
||
@api.multi | ||
@api.depends('product_tmpl_id.standard_price', 'standard_price', | ||
'product_tmpl_id.seller_ids.price') | ||
def _get_replenishment_cost(self): | ||
for product in self: | ||
if product.seller_ids: | ||
product.replenishment_cost = product.seller_ids[0].price | ||
else: | ||
super(ProductProduct, product)._get_replenishment_cost() |
1 change: 1 addition & 0 deletions
1
product_replenishment_cost_default_seller/readme/CONTRIBUTORS.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Marc Poch Mallandrich <mpoch@planetatic.com> |
3 changes: 3 additions & 0 deletions
3
product_replenishment_cost_default_seller/readme/DESCRIPTION.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Modules product_replenishment_cost_default_seller and del product_supplierinfo_discount are required. | ||
|
||
This module recomputes replenishment_cost using supplierinfo's price and supplierinfo's discount. |