Merge lp:~openerp-dev/openobject-addons/6.1-opw-579043-ado into lp:openobject-addons/6.1

Proposed by Amit Dodiya (OpenERP)
Status: Approved
Approved by: Naresh(OpenERP)
Approved revision: no longer in the source branch.
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-579043-ado
Merge into: lp:openobject-addons/6.1
Diff against target: 142 lines (+91/-14)
1 file modified
mrp_subproduct/mrp_subproduct.py (+91/-14)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-579043-ado
Reviewer Review Type Date Requested Status
Naresh(OpenERP) Pending
Review via email: mp+125672@code.launchpad.net

Description of the change

Hello,

[FIX] mrp_subproduct doesnt pull sub products from bill of material when we have type phantom"

Issue :
After adding a suproduct line in Bill of matirial of type=Phantom we hope to see the material asigned in sub product of phantom bill of material when confirming the production order with the parent bill of material that the mrp_subproduct fills in finished product, but it doesn't do it.

Steps:
Check this video : http://youtu.be/Fp4Vj5aNtrw

Regards,
Amit Dodiya

To post a comment you must log in.
6999. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7000. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7001. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7002. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7003. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7004. By Olivier Dony (Odoo)

[FIX] OPW 574637: account_analytic_plans: remove the strange behavior of instance editing - a thing of the past

7005. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7006. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7007. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7008. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7009. By Xavier ALT

[MERGE] OPW 50562: stock: fix picking type for chained picking

  forward port of v6.0 revid: <email address hidden>

7010. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7011. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7012. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7013. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7014. By Olivier Dony (Odoo)

[MERGE] OPW 579232: mrp: better handle partial consumption of raw products that were split in production lots

- System will no longer consume every line of raw product after a split
- If a raw product line with the exact quantity to consume is present,
  only this one will be consumed
- If no raw product line matches the quantity to consume, the system
  will consume the available lines (starting with smallest quantities first)
  until it attains the required quantity, possibly splitting one line
  further if no combination of the existing lines gives the right
  quantity.
- The production lot column and the split button will now be available
  on both sides of the production order form, allowing fine control
  of the production lots that were consumed, in case the defaults
  do not match what was used in reality.

7015. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7016. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7017. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7018. By Xavier ALT

[MERGE] OPW 577045: translations: collective fix of missing translation terms in reports

7019. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7020. By Xavier ALT

[MERGE] OPW 575716: account: force account.financial.report balance of *zero* to be displayed positively

7021. By Xavier ALT

[MERGE] OPW 579553: account: fix traceback when modifing existing journal entry line

7022. By Xavier ALT

[MERGE] OPW 576019: sale/purchase: when changing SO or PO line product, use product's UoM even if current UoM is of the same category

7023. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7024. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7025. By Stephane Wirtel (OpenERP)

[FIX] point_of_sale: remove unused file

7026. By Xavier ALT

[MERGE] OPW 578622: project: duplicating project must reset analytic account code

7027. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7028. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7029. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7030. By Olivier Dony (Odoo)

[FIX] wiki: remove unused 6.0 web addon components - web API was rewritten from scratch in 6.1

7031. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7032. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7033. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7034. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7035. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7036. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7037. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7038. By Xavier ALT

[MERGE] OPW 577723: purchase: add domain on purchase order partner field for autocomplete to search only for suppliers

7039. By Xavier ALT

[MERGE] OPW 577045: account/hr_holidays: fix untranslated string and 'Filter By' display on account reports

7040. By Xavier ALT

[MERGE] OPW 576804: hr_holidays: fix problem with accentuated chars in 'Leaves by Department' report

7041. By Xavier ALT

[MERGE] OPW 579990: account: changing invoice line account should take product taxes or account taxes, not both

  backport of trunk addons revid: <email address hidden>

7042. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7043. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7044. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7045. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7046. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7047. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7048. By Xavier ALT

[MERGE] OPW 579331: base_vat: button check_vat should not return 'None' uppon success - this will cause error for clients using XML-RPC

7049. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7050. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7051. By Xavier ALT

[MERGE] OPW 578792: project_issue/resource: fix calc. of open/close & working hours to open/close on issue + has to be timezone aware

7052. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7053. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7054. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7055. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7056. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7057. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7058. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7059. By Olivier Dony (Odoo)

[FIX] project_issue: fix access rights error when using portal access

Due to the recent change in the computation of the closing duration
for project issues[1], viewing issues now fails for users who do not
have read access to project.project. This is typically the case for
portal users, who can view their own issues but not the project details.
Doing the computation in superuser mode does not cause any security
problem and avoids the access rights error.

7060. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7061. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7062. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7063. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7064. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7065. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7066. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7067. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7068. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7069. By Xavier ALT

[MERGE] OPW 576829: pos: fix creation of payment line when pos order have multiple payment methods + return

   partial trunk backport revid: <email address hidden>,
     <email address hidden>

7070. By Xavier ALT

[MERGE] OPW 576495: stock: fix missing 'state' field in view - required for button states evaluation

7071. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7072. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7073. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7074. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7075. By Antony Lesuisse (OpenERP)

[FIX] crm.lead add missing group_by country

7076. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7077. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7078. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7079. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7080. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7081. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7082. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7083. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7084. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7085. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7086. By Xavier ALT

[MERGE] OPW 581296: account_voucher: allow reconciling invoices with partially reconciled credit notes

7087. By Xavier ALT

[MERGE] OPW 577037: account_voucher: 'import entries' wizard should allow selecting credit notes

  cumulative forward-port of v6.0 revids:
  - <email address hidden>
  - <email address hidden>
  - <email address hidden>

7088. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7089. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7090. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7091. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7092. By Xavier ALT

[MERGE] 577037: account_voucher: also allow matching payment line with bank, cash journal for existing 'advanced payment'

7093. By Xavier ALT

[FIX] account_voucher: make sure we do not match move lines that are totally used within partial payment

7094. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7095. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7096. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7097. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7098. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

it seems big changes to incorporate in stable !

Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Hello,

This bug was qualified as Confirmed on Trunk (means still existing and reproducible). A Merge Proposal for trunk was created to fix it. Here is the link to follow the MP on Launchpad https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-579043-port-kbh/+merge/138114 and be informed once it's been merged in trunk: ... If this Merge Proposal could not be merged in v6.1 at the release of v7.0, it will be closed.

Thanks,
Naresh Soni

7099. By Amit Dodiya<email address hidden>

[FIX] mrp_subproduct doesnt pull sub products from bill of material when we have type phantom

Unmerged revisions

7099. By Amit Dodiya<email address hidden>

[FIX] mrp_subproduct doesnt pull sub products from bill of material when we have type phantom

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'mrp_subproduct/mrp_subproduct.py'
--- mrp_subproduct/mrp_subproduct.py 2012-02-14 15:57:46 +0000
+++ mrp_subproduct/mrp_subproduct.py 2012-12-10 08:57:21 +0000
@@ -22,6 +22,7 @@
22from osv import fields22from osv import fields
23from osv import osv23from osv import osv
24import decimal_precision as dp24import decimal_precision as dp
25import tools
2526
26class mrp_subproduct(osv.osv):27class mrp_subproduct(osv.osv):
27 _name = 'mrp.subproduct'28 _name = 'mrp.subproduct'
@@ -61,6 +62,79 @@
61 _columns={62 _columns={
62 'sub_products':fields.one2many('mrp.subproduct', 'bom_id', 'sub_products'),63 'sub_products':fields.one2many('mrp.subproduct', 'bom_id', 'sub_products'),
63 }64 }
65
66 def _bom_explode(self, cr, uid, bom, factor, properties=[], addthis=False, level=0, routing_id=False, result_subproducts=False):
67 """ Finds sub products and work centers for related bom lines which has several sub products defined in it.
68 @param bom: BoM of particular product.
69 @param factor: Factor of product UoM.
70 @param properties: A List of properties Ids.
71 @param addthis: If BoM found then True else False.
72 @param level: Depth level to find BoM lines starts from 10.
73 @return: result: List of dictionaries containing product details.
74 result2: List of dictionaries containing Work Center details.
75 """
76 if result_subproducts is False:
77 result_subproducts = []
78 if self._columns.has_key('sub_products'):#if module mrp_subproduct is installed
79 for sub_product in bom.sub_products:
80 qty1 = sub_product.product_qty
81 if sub_product.subproduct_type == 'variable':
82 qty1 = factor*qty1/bom.product_uom.factor_inv
83 result_subproducts.append({
84 'product_id': sub_product.product_id.id,
85 'product_qty': qty1,
86 'product_uom': sub_product.product_uom.id,
87 })
88 routing_obj = self.pool.get('mrp.routing')
89 factor = factor / (bom.product_efficiency or 1.0)
90 factor = rounding(factor, bom.product_rounding)
91 if factor < bom.product_rounding:
92 factor = bom.product_rounding
93 result = []
94 result2 = []
95 phantom = False
96 if bom.type == 'phantom' and not bom.bom_lines:
97 newbom = self._bom_find(cr, uid, bom.product_id.id, bom.product_uom.id, properties)
98
99 if newbom:
100 newbom_pool = self.browse(cr, uid, newbom)
101 res = self._bom_explode(cr, uid, self.browse(cr, uid, [newbom])[0], factor*bom.product_qty/(newbom_pool.product_qty*newbom_pool.product_uom.factor_inv), properties, addthis=True, level=level+10, result_subproducts=result_subproducts)
102 result = result + res[0]
103 result2 = result2 + res[1]
104 phantom = True
105 else:
106 phantom = False
107 if not phantom:
108 if addthis and not bom.bom_lines:
109 result.append(
110 {
111 'name': bom.product_id.name,
112 'product_id': bom.product_id.id,
113 'product_qty': bom.product_qty * factor,
114 'product_uom': bom.product_uom.id,
115 'product_uos_qty': bom.product_uos and bom.product_uos_qty * factor or False,
116 'product_uos': bom.product_uos and bom.product_uos.id or False,
117 })
118 routing = (routing_id and routing_obj.browse(cr, uid, routing_id)) or bom.routing_id or False
119 if routing:
120 for wc_use in routing.workcenter_lines:
121 wc = wc_use.workcenter_id
122 d, m = divmod(factor, wc_use.workcenter_id.capacity_per_cycle)
123 mult = (d + (m and 1.0 or 0.0))
124 cycle = mult * wc_use.cycle_nbr
125 result2.append({
126 'name': tools.ustr(wc_use.name) + ' - ' + tools.ustr(bom.product_id.name),
127 'workcenter_id': wc.id,
128 'sequence': level+(wc_use.sequence or 0),
129 'cycle': cycle,
130 'hour': float(wc_use.hour_nbr*mult + ((wc.time_start or 0.0)+(wc.time_stop or 0.0)+cycle*(wc.time_cycle or 0.0)) * (wc.time_efficiency or 1.0)),
131 })
132 for bom2 in bom.bom_lines:
133 res = self._bom_explode(cr, uid, bom2, factor, properties, addthis=True, level=level+10, result_subproducts=result_subproducts)
134 result = result + res[0]
135 result2 = result2 + res[1]
136 return result, result2
137
64138
65mrp_bom()139mrp_bom()
66140
@@ -73,27 +147,24 @@
73 """ Confirms production order and calculates quantity based on subproduct_type.147 """ Confirms production order and calculates quantity based on subproduct_type.
74 @return: Newly generated picking Id.148 @return: Newly generated picking Id.
75 """149 """
150 bom_obj = self.pool.get('mrp.bom')
151 uom_obj = self.pool.get('product.uom')
76 picking_id = super(mrp_production,self).action_confirm(cr, uid, ids)152 picking_id = super(mrp_production,self).action_confirm(cr, uid, ids)
77 for production in self.browse(cr, uid, ids):153 for production in self.browse(cr, uid, ids):
78 source = production.product_id.product_tmpl_id.property_stock_production.id154 source = production.product_id.product_tmpl_id.property_stock_production.id
79 if not production.bom_id:155 bom_id = production.bom_id
156 if not bom_id:
80 continue157 continue
81 for sub_product in production.bom_id.sub_products:158 factor = uom_obj._compute_qty(cr, uid, production.product_uom.id, production.product_qty, bom_id.product_uom.id)
82 qty1 = sub_product.product_qty159 result_subproducts =[]
83 qty2 = production.product_uos and production.product_uos_qty or False160 res = bom_obj._bom_explode(cr, uid, bom_id, factor / bom_id.product_qty, properties=False, routing_id=False, result_subproducts=result_subproducts)
84 if sub_product.subproduct_type == 'variable':161 for sub_product in result_subproducts:
85 if production.product_qty:
86 qty1 *= production.product_qty / (production.bom_id.product_qty or 1.0)
87 if production.product_uos_qty:
88 qty2 *= production.product_uos_qty / (production.bom_id.product_uos_qty or 1.0)
89 data = {162 data = {
90 'name': 'PROD:'+production.name,163 'name': 'PROD:'+production.name,
91 'date': production.date_planned,164 'date': production.date_planned,
92 'product_id': sub_product.product_id.id,165 'product_id': sub_product['product_id'],
93 'product_qty': qty1,166 'product_qty': sub_product['product_qty'],
94 'product_uom': sub_product.product_uom.id,167 'product_uom': sub_product['product_uom'],
95 'product_uos_qty': qty2,
96 'product_uos': production.product_uos and production.product_uos.id or False,
97 'location_id': source,168 'location_id': source,
98 'location_dest_id': production.location_dest_id.id,169 'location_dest_id': production.location_dest_id.id,
99 'move_dest_id': production.move_prod_id.id,170 'move_dest_id': production.move_prod_id.id,
@@ -127,6 +198,12 @@
127198
128mrp_production()199mrp_production()
129200
201def rounding(f, r):
202 import math
203 if not r:
204 return f
205 return math.ceil(f / r) * r
206
130class change_production_qty(osv.osv_memory):207class change_production_qty(osv.osv_memory):
131 _inherit = 'change.production.qty'208 _inherit = 'change.production.qty'
132209