Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions product_currency_mrp/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#
##############################################################################
{
<<<<<<< HEAD
"name": "Product Currency MRP",
"version": "18.0.1.0.0",
"category": "Products",
Expand All @@ -30,6 +31,27 @@
"depends": [
"product_currency",
"mrp",
||||||| parent of 2ab32991 (temp)
'name': 'Product Currency MRP',
'version': "17.0.1.1.0",
'category': 'Products',
'sequence': 14,
'summary': '',
'author': 'ADHOC SA',
'website': 'www.adhoc.com.ar',
'license': 'AGPL-3',
'images': [
=======
'name': 'Product Currency MRP',
'version': "17.0.1.2.0",
'category': 'Products',
'sequence': 14,
'summary': '',
'author': 'ADHOC SA',
'website': 'www.adhoc.com.ar',
'license': 'AGPL-3',
'images': [
>>>>>>> 2ab32991 (temp)
],
"data": [],
"demo": [],
Expand Down
62 changes: 62 additions & 0 deletions product_currency_mrp/report/mrp_report_bom_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class ReportReplenishmentBomStructure(models.AbstractModel):
_inherit = "report.mrp.report_bom_structure"

@api.model
<<<<<<< HEAD
def _get_component_data(
self,
parent_bom,
Expand All @@ -21,6 +22,67 @@ def _get_component_data(
parent_bom, parent_product, warehouse, bom_line, line_quantity, level, index, product_info, ignore_stock
)
currency = self.env.context.get("force_currency") or self.env.company.currency_id
||||||| parent of 2ab32991 (temp)
def _get_bom_data(self, bom, warehouse, product=False, line_qty=False, bom_line=False, level=0, parent_bom=False, index=0, product_info=False, ignore_stock=False):
""" Here we use the product forced currency uom unit"""
if not self.env.context.get('force_currency'):
self = self.with_context(force_currency=product.currency_id)
res = super(ReportReplenishmentBomStructure, self)._get_bom_data(bom, warehouse, product, line_qty, bom_line, level, parent_bom, index, product_info, ignore_stock)
currency = self.env.context.get('force_currency') or self.env.company.currency_id
res.update({
'currency': currency,
'currency_id': currency.id
})
is_minimized = self.env.context.get('minimized', False)
current_quantity = line_qty
if bom_line:
current_quantity = bom_line.product_uom_id._compute_quantity(line_qty, bom.product_uom_id) or 0
if not is_minimized:
if product:
price = product.uom_id._compute_price(product.standard_price, bom.product_uom_id) * current_quantity
res['prod_cost'] = product.currency_id._convert(
price, currency, self.env.company, fields.Date.today(), round=True)
else:
price = bom.product_tmpl_id.uom_id._compute_price(bom.product_tmpl_id.standard_price, bom.product_uom_id) * current_quantity
res['prod_cost'] = bom.product_tmpl_id.currency_id._convert(
price, currency, self.env.company, fields.Date.today(), round=True)
return res

@api.model
def _get_component_data(self, parent_bom, parent_product, warehouse, bom_line, line_quantity, level, index, product_info, ignore_stock=False):
res = super()._get_component_data(parent_bom, parent_product, warehouse, bom_line, line_quantity, level, index, product_info, ignore_stock)
currency = self.env.context.get('force_currency') or self.env.company.currency_id
=======
def _get_bom_data(self, bom, warehouse, product=False, line_qty=False, bom_line=False, level=0, parent_bom=False, parent_product=False, index=0, product_info=False, ignore_stock=False):
""" Here we use the product forced currency uom unit"""
if not self.env.context.get('force_currency'):
self = self.with_context(force_currency=product.currency_id)
res = super(ReportReplenishmentBomStructure, self)._get_bom_data(bom, warehouse, product, line_qty, bom_line, level, parent_bom, parent_product, index, product_info, ignore_stock)
currency = self.env.context.get('force_currency') or self.env.company.currency_id
res.update({
'currency': currency,
'currency_id': currency.id
})
is_minimized = self.env.context.get('minimized', False)
current_quantity = line_qty
if bom_line:
current_quantity = bom_line.product_uom_id._compute_quantity(line_qty, bom.product_uom_id) or 0
if not is_minimized:
if product:
price = product.uom_id._compute_price(product.standard_price, bom.product_uom_id) * current_quantity
res['prod_cost'] = product.currency_id._convert(
price, currency, self.env.company, fields.Date.today(), round=True)
else:
price = bom.product_tmpl_id.uom_id._compute_price(bom.product_tmpl_id.standard_price, bom.product_uom_id) * current_quantity
res['prod_cost'] = bom.product_tmpl_id.currency_id._convert(
price, currency, self.env.company, fields.Date.today(), round=True)
return res

@api.model
def _get_component_data(self, parent_bom, parent_product, warehouse, bom_line, line_quantity, level, index, product_info, ignore_stock=False):
res = super()._get_component_data(parent_bom, parent_product, warehouse, bom_line, line_quantity, level, index, product_info, ignore_stock)
currency = self.env.context.get('force_currency') or self.env.company.currency_id
>>>>>>> 2ab32991 (temp)
company = parent_bom.company_id or self.env.company
price = (
bom_line.product_id.uom_id._compute_price(
Expand Down
Loading