Skip to content

Commit

Permalink
Merge d02e611 into cc73f9d
Browse files Browse the repository at this point in the history
  • Loading branch information
MPoch-PlanetaTIC committed Sep 20, 2019
2 parents cc73f9d + d02e611 commit 7d5e1db
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 0 deletions.
5 changes: 5 additions & 0 deletions product_replenishment_cost_default_seller/__init__.py
@@ -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
20 changes: 20 additions & 0 deletions product_replenishment_cost_default_seller/__manifest__.py
@@ -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,
}
5 changes: 5 additions & 0 deletions product_replenishment_cost_default_seller/models/__init__.py
@@ -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
@@ -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()
@@ -0,0 +1 @@
* Marc Poch Mallandrich <mpoch@planetatic.com>
@@ -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.

0 comments on commit 7d5e1db

Please sign in to comment.