Merge lp:~openerp-commiter/openobject-addons/trunk-addons-aag into lp:openobject-addons
- trunk-addons-aag
- Merge into trunk
Proposed by
Atik Agewan(OpenERP)
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Core Team | Pending | ||
Review via email: mp+48776@code.launchpad.net |
Commit message
Description of the change
changes in Read method of osv meme wiz
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'mrp/mrp.py' | |||
2 | --- mrp/mrp.py 2011-02-14 11:45:07 +0000 | |||
3 | +++ mrp/mrp.py 2011-02-16 05:24:17 +0000 | |||
4 | @@ -240,11 +240,29 @@ | |||
5 | 240 | return False | 240 | return False |
6 | 241 | level -= 1 | 241 | level -= 1 |
7 | 242 | return True | 242 | return True |
8 | 243 | |||
9 | 244 | def _check_product(self, cr, uid, ids, context=None): | ||
10 | 245 | all_prod = [] | ||
11 | 246 | bom_obj = self.pool.get('mrp.bom') | ||
12 | 247 | boms = self.browse(cr, uid, ids, context=context) | ||
13 | 248 | def check_bom(boms): | ||
14 | 249 | res = True | ||
15 | 250 | for bom in boms: | ||
16 | 251 | if bom.product_id.id in all_prod: | ||
17 | 252 | res = res and False | ||
18 | 253 | all_prod.append(bom.product_id.id) | ||
19 | 254 | lines = bom.bom_lines | ||
20 | 255 | if lines: | ||
21 | 256 | newboms = [a for a in lines if a not in boms] | ||
22 | 257 | res = res and check_bom(newboms) | ||
23 | 258 | return res | ||
24 | 259 | return check_bom(boms) | ||
25 | 260 | |||
26 | 243 | _constraints = [ | 261 | _constraints = [ |
28 | 244 | (_check_recursion, 'Error ! You can not create recursive BoM.', ['parent_id']) | 262 | (_check_recursion, 'Error ! You can not create recursive BoM.', ['parent_id']), |
29 | 263 | (_check_product, 'BoM line product should not be same as BoM product.', ['product_id']), | ||
30 | 245 | ] | 264 | ] |
31 | 246 | 265 | ||
32 | 247 | |||
33 | 248 | def onchange_product_id(self, cr, uid, ids, product_id, name, context=None): | 266 | def onchange_product_id(self, cr, uid, ids, product_id, name, context=None): |
34 | 249 | """ Changes UoM and name if product_id changes. | 267 | """ Changes UoM and name if product_id changes. |
35 | 250 | @param name: Name of the field | 268 | @param name: Name of the field |
36 | 251 | 269 | ||
37 | === modified file 'mrp_operations/mrp_operations.py' | |||
38 | --- mrp_operations/mrp_operations.py 2011-01-14 00:11:01 +0000 | |||
39 | +++ mrp_operations/mrp_operations.py 2011-02-16 05:24:17 +0000 | |||
40 | @@ -119,11 +119,12 @@ | |||
41 | 119 | @return: Nothing | 119 | @return: Nothing |
42 | 120 | """ | 120 | """ |
43 | 121 | wf_service = netsvc.LocalService("workflow") | 121 | wf_service = netsvc.LocalService("workflow") |
44 | 122 | prod_obj_pool = self.pool.get('mrp.production') | ||
45 | 122 | oper_obj = self.browse(cr, uid, ids)[0] | 123 | oper_obj = self.browse(cr, uid, ids)[0] |
46 | 123 | prod_obj = oper_obj.production_id | 124 | prod_obj = oper_obj.production_id |
47 | 124 | if action == 'start': | 125 | if action == 'start': |
48 | 125 | if prod_obj.state =='confirmed': | 126 | if prod_obj.state =='confirmed': |
50 | 126 | self.pool.get('mrp.production').force_production(cr, uid, [prod_obj.id]) | 127 | prod_obj_pool.force_production(cr, uid, [prod_obj.id]) |
51 | 127 | wf_service.trg_validate(uid, 'mrp.production', prod_obj.id, 'button_produce', cr) | 128 | wf_service.trg_validate(uid, 'mrp.production', prod_obj.id, 'button_produce', cr) |
52 | 128 | elif prod_obj.state =='ready': | 129 | elif prod_obj.state =='ready': |
53 | 129 | wf_service.trg_validate(uid, 'mrp.production', prod_obj.id, 'button_produce', cr) | 130 | wf_service.trg_validate(uid, 'mrp.production', prod_obj.id, 'button_produce', cr) |
54 | @@ -139,6 +140,9 @@ | |||
55 | 139 | if line.state != 'done': | 140 | if line.state != 'done': |
56 | 140 | flag = False | 141 | flag = False |
57 | 141 | if flag: | 142 | if flag: |
58 | 143 | for production in prod_obj_pool.browse(cr, uid, [prod_obj.id], context= None): | ||
59 | 144 | if production.move_lines or production.move_created_ids: | ||
60 | 145 | prod_obj_pool.action_produce(cr,uid, production.id, production.product_qty, 'consume_produce', context = None) | ||
61 | 142 | wf_service.trg_validate(uid, 'mrp.production', oper_obj.production_id.id, 'button_produce_done', cr) | 146 | wf_service.trg_validate(uid, 'mrp.production', oper_obj.production_id.id, 'button_produce_done', cr) |
62 | 143 | return | 147 | return |
63 | 144 | 148 | ||
64 | @@ -244,10 +248,12 @@ | |||
65 | 244 | wf_service.trg_validate(uid, 'mrp.production.workcenter.line', workcenter_line.id, 'button_start_working', cr) | 248 | wf_service.trg_validate(uid, 'mrp.production.workcenter.line', workcenter_line.id, 'button_start_working', cr) |
66 | 245 | return super(mrp_production,self).action_in_production(cr, uid, ids) | 249 | return super(mrp_production,self).action_in_production(cr, uid, ids) |
67 | 246 | 250 | ||
69 | 247 | def action_cancel(self, cr, uid, ids): | 251 | def action_cancel(self, cr, uid, ids, context=None): |
70 | 248 | """ Cancels work order if production order is canceled. | 252 | """ Cancels work order if production order is canceled. |
71 | 249 | @return: Super method | 253 | @return: Super method |
72 | 250 | """ | 254 | """ |
73 | 255 | if context is None: | ||
74 | 256 | context = {} | ||
75 | 251 | obj = self.browse(cr, uid, ids)[0] | 257 | obj = self.browse(cr, uid, ids)[0] |
76 | 252 | wf_service = netsvc.LocalService("workflow") | 258 | wf_service = netsvc.LocalService("workflow") |
77 | 253 | for workcenter_line in obj.workcenter_lines: | 259 | for workcenter_line in obj.workcenter_lines: |
78 | 254 | 260 | ||
79 | === modified file 'procurement/procurement_view.xml' | |||
80 | --- procurement/procurement_view.xml 2011-01-17 13:55:22 +0000 | |||
81 | +++ procurement/procurement_view.xml 2011-02-16 05:24:17 +0000 | |||
82 | @@ -28,6 +28,7 @@ | |||
83 | 28 | <field name="name">procurement.order.tree.board</field> | 28 | <field name="name">procurement.order.tree.board</field> |
84 | 29 | <field name="model">procurement.order</field> | 29 | <field name="model">procurement.order</field> |
85 | 30 | <field name="type">tree</field> | 30 | <field name="type">tree</field> |
86 | 31 | <field eval="20" name="priority"/> | ||
87 | 31 | <field name="arch" type="xml"> | 32 | <field name="arch" type="xml"> |
88 | 32 | <tree string="Procurement Lines" colors="red:date_planned<current_date and state in ('exception');black:state=='running';darkgreen:state=='confirmed';gray:state in ['done','cancel'];blue:state in ('ready')"> | 33 | <tree string="Procurement Lines" colors="red:date_planned<current_date and state in ('exception');black:state=='running';darkgreen:state=='confirmed';gray:state in ['done','cancel'];blue:state in ('ready')"> |
89 | 33 | <field name="date_planned" widget="date"/> | 34 | <field name="date_planned" widget="date"/> |
90 | @@ -246,8 +247,8 @@ | |||
91 | 246 | <act_window | 247 | <act_window |
92 | 247 | context="{'search_default_warehouse_id': active_id}" | 248 | context="{'search_default_warehouse_id': active_id}" |
93 | 248 | id="act_stock_warehouse_2_stock_warehouse_orderpoint" | 249 | id="act_stock_warehouse_2_stock_warehouse_orderpoint" |
96 | 249 | name="Minimum Stock Rules" | 250 | name="Minimum Stock Rules" |
97 | 250 | res_model="stock.warehouse.orderpoint" | 251 | res_model="stock.warehouse.orderpoint" |
98 | 251 | src_model="stock.warehouse" | 252 | src_model="stock.warehouse" |
99 | 252 | groups="stock.group_stock_user"/> | 253 | groups="stock.group_stock_user"/> |
100 | 253 | 254 | ||
101 | 254 | 255 | ||
102 | === modified file 'product/pricelist.py' | |||
103 | --- product/pricelist.py 2011-01-17 08:00:48 +0000 | |||
104 | +++ product/pricelist.py 2011-02-16 05:24:17 +0000 | |||
105 | @@ -262,9 +262,9 @@ | |||
106 | 262 | price = currency_obj.compute(cr, uid, | 262 | price = currency_obj.compute(cr, uid, |
107 | 263 | price_type.currency_id.id, res['currency_id'], | 263 | price_type.currency_id.id, res['currency_id'], |
108 | 264 | product_obj.price_get(cr, uid, [product_id], | 264 | product_obj.price_get(cr, uid, [product_id], |
110 | 265 | price_type.field)[product_id], round=False, context=context) | 265 | price_type.field, context=context)[product_id], round=False, context=context) |
111 | 266 | 266 | ||
113 | 267 | if price: | 267 | if price >= 0.0: |
114 | 268 | price_limit = price | 268 | price_limit = price |
115 | 269 | 269 | ||
116 | 270 | price = price * (1.0+(res['price_discount'] or 0.0)) | 270 | price = price * (1.0+(res['price_discount'] or 0.0)) |
117 | @@ -385,7 +385,7 @@ | |||
118 | 385 | else: | 385 | else: |
119 | 386 | price_tmp = self.price_get(cr, uid, | 386 | price_tmp = self.price_get(cr, uid, |
120 | 387 | [res['base_pricelist_id']], prod_id, | 387 | [res['base_pricelist_id']], prod_id, |
122 | 388 | qty)[res['base_pricelist_id']] | 388 | qty, context=context)[res['base_pricelist_id']] |
123 | 389 | ptype_src = self.browse(cr, uid, | 389 | ptype_src = self.browse(cr, uid, |
124 | 390 | res['base_pricelist_id']).currency_id.id | 390 | res['base_pricelist_id']).currency_id.id |
125 | 391 | price = currency_obj.compute(cr, uid, ptype_src, | 391 | price = currency_obj.compute(cr, uid, ptype_src, |
126 | @@ -413,7 +413,7 @@ | |||
127 | 413 | price = currency_obj.compute(cr, uid, | 413 | price = currency_obj.compute(cr, uid, |
128 | 414 | price_type.currency_id.id, res['currency_id'], | 414 | price_type.currency_id.id, res['currency_id'], |
129 | 415 | product_obj.price_get(cr, uid, [prod_id], | 415 | product_obj.price_get(cr, uid, [prod_id], |
131 | 416 | price_type.field)[prod_id], round=False, context=context) | 416 | price_type.field, context=context)[prod_id], round=False, context=context) |
132 | 417 | 417 | ||
133 | 418 | if price: | 418 | if price: |
134 | 419 | price_limit = price | 419 | price_limit = price |
135 | 420 | 420 | ||
136 | === modified file 'product/product.py' | |||
137 | --- product/product.py 2011-02-01 12:34:28 +0000 | |||
138 | +++ product/product.py 2011-02-16 05:24:17 +0000 | |||
139 | @@ -139,7 +139,7 @@ | |||
140 | 139 | context = {} | 139 | context = {} |
141 | 140 | if from_unit.category_id.id <> to_unit.category_id.id: | 140 | if from_unit.category_id.id <> to_unit.category_id.id: |
142 | 141 | if context.get('raise-exception', True): | 141 | if context.get('raise-exception', True): |
144 | 142 | raise osv.except_osv(_('Error !'), _('Conversion from Product UoM m to Default UoM PCE is not possible as they both belong to different Category!.')) | 142 | raise osv.except_osv(_('Error !'), _('Conversion from Product UoM %s to Default UoM %s is not possible as they both belong to different Category!.') % (from_unit.name,to_unit.name,)) |
145 | 143 | else: | 143 | else: |
146 | 144 | return qty | 144 | return qty |
147 | 145 | amount = qty / from_unit.factor | 145 | amount = qty / from_unit.factor |
148 | @@ -766,12 +766,12 @@ | |||
149 | 766 | currency_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id | 766 | currency_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id |
150 | 767 | for supplier in partner_pool.browse(cr, uid, supplier_ids, context=context): | 767 | for supplier in partner_pool.browse(cr, uid, supplier_ids, context=context): |
151 | 768 | # Compute price from standard price of product | 768 | # Compute price from standard price of product |
153 | 769 | price = product_pool.price_get(cr, uid, [product_id], 'standard_price')[product_id] | 769 | price = product_pool.price_get(cr, uid, [product_id], 'standard_price', context=context)[product_id] |
154 | 770 | 770 | ||
155 | 771 | # Compute price from Purchase pricelist of supplier | 771 | # Compute price from Purchase pricelist of supplier |
156 | 772 | pricelist_id = supplier.property_product_pricelist_purchase.id | 772 | pricelist_id = supplier.property_product_pricelist_purchase.id |
157 | 773 | if pricelist_id: | 773 | if pricelist_id: |
159 | 774 | price = pricelist_pool.price_get(cr, uid, [pricelist_id], product_id, product_qty).setdefault(pricelist_id, 0) | 774 | price = pricelist_pool.price_get(cr, uid, [pricelist_id], product_id, product_qty, context=context).setdefault(pricelist_id, 0) |
160 | 775 | price = currency_pool.compute(cr, uid, pricelist_pool.browse(cr, uid, pricelist_id).currency_id.id, currency_id, price) | 775 | price = currency_pool.compute(cr, uid, pricelist_pool.browse(cr, uid, pricelist_id).currency_id.id, currency_id, price) |
161 | 776 | 776 | ||
162 | 777 | # Compute price from supplier pricelist which are in Supplier Information | 777 | # Compute price from supplier pricelist which are in Supplier Information |
163 | 778 | 778 | ||
164 | === modified file 'product/report/pricelist.py' | |||
165 | --- product/report/pricelist.py 2011-01-14 00:11:01 +0000 | |||
166 | +++ product/report/pricelist.py 2011-02-16 05:24:17 +0000 | |||
167 | @@ -90,7 +90,7 @@ | |||
168 | 90 | pro.append('<pro name="%s" >' % (x['name'])) | 90 | pro.append('<pro name="%s" >' % (x['name'])) |
169 | 91 | temp = [] | 91 | temp = [] |
170 | 92 | for q in qty: | 92 | for q in qty: |
172 | 93 | price_dict = pool.get('product.pricelist').price_get(cr, uid, [price_list_id], x['id'], q) | 93 | price_dict = pool.get('product.pricelist').price_get(cr, uid, [price_list_id], x['id'], q, context=context) |
173 | 94 | if price_dict[price_list_id]: | 94 | if price_dict[price_list_id]: |
174 | 95 | price = price_dict[price_list_id] | 95 | price = price_dict[price_list_id] |
175 | 96 | else: | 96 | else: |
176 | 97 | 97 | ||
177 | === modified file 'product_margin/product_margin_view.xml' | |||
178 | --- product_margin/product_margin_view.xml 2011-01-14 00:11:01 +0000 | |||
179 | +++ product_margin/product_margin_view.xml 2011-02-16 05:24:17 +0000 | |||
180 | @@ -80,6 +80,9 @@ | |||
181 | 80 | <field name="expected_margin"/> | 80 | <field name="expected_margin"/> |
182 | 81 | <field name="total_margin_rate" widget="progressbar"/> | 81 | <field name="total_margin_rate" widget="progressbar"/> |
183 | 82 | <field name="expected_margin_rate" widget="progressbar"/> | 82 | <field name="expected_margin_rate" widget="progressbar"/> |
184 | 83 | <field name="categ_id" invisible="1"/> | ||
185 | 84 | <field name="uom_id" invisible="1"/> | ||
186 | 85 | <field name="type" invisible="1"/> | ||
187 | 83 | </tree> | 86 | </tree> |
188 | 84 | </field> | 87 | </field> |
189 | 85 | </record> | 88 | </record> |
190 | 86 | 89 | ||
191 | === modified file 'project_mrp/project_procurement.py' | |||
192 | --- project_mrp/project_procurement.py 2011-01-14 00:11:01 +0000 | |||
193 | +++ project_mrp/project_procurement.py 2011-02-16 05:24:17 +0000 | |||
194 | @@ -37,7 +37,7 @@ | |||
195 | 37 | self.write(cr, uid, [procurement.id], {'state': 'running'}) | 37 | self.write(cr, uid, [procurement.id], {'state': 'running'}) |
196 | 38 | planned_hours = procurement.product_qty | 38 | planned_hours = procurement.product_qty |
197 | 39 | task_id = self.pool.get('project.task').create(cr, uid, { | 39 | task_id = self.pool.get('project.task').create(cr, uid, { |
199 | 40 | 'name': '%s:%s' % (procurement.origin or '', procurement.name), | 40 | 'name': '%s:%s' % (procurement.origin or '', procurement.product_id.name), |
200 | 41 | 'date_deadline': procurement.date_planned, | 41 | 'date_deadline': procurement.date_planned, |
201 | 42 | 'planned_hours':planned_hours, | 42 | 'planned_hours':planned_hours, |
202 | 43 | 'remaining_hours': planned_hours, | 43 | 'remaining_hours': planned_hours, |
203 | 44 | 44 | ||
204 | === modified file 'purchase/purchase.py' | |||
205 | --- purchase/purchase.py 2011-02-14 11:45:07 +0000 | |||
206 | +++ purchase/purchase.py 2011-02-16 05:24:17 +0000 | |||
207 | @@ -170,7 +170,7 @@ | |||
208 | 170 | 'partner_id':fields.many2one('res.partner', 'Supplier', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, change_default=True), | 170 | 'partner_id':fields.many2one('res.partner', 'Supplier', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, change_default=True), |
209 | 171 | 'partner_address_id':fields.many2one('res.partner.address', 'Address', required=True, | 171 | 'partner_address_id':fields.many2one('res.partner.address', 'Address', required=True, |
210 | 172 | states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]},domain="[('partner_id', '=', partner_id)]"), | 172 | states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]},domain="[('partner_id', '=', partner_id)]"), |
212 | 173 | 'dest_address_id':fields.many2one('res.partner.address', 'Destination Address', | 173 | 'dest_address_id':fields.many2one('res.partner.address', 'Destination Address', domain="[('partner_id', '!=', False)]", |
213 | 174 | states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, | 174 | states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, |
214 | 175 | help="Put an address if you want to deliver directly from the supplier to the customer." \ | 175 | help="Put an address if you want to deliver directly from the supplier to the customer." \ |
215 | 176 | "In this case, it will remove the warehouse link and set the customer location." | 176 | "In this case, it will remove the warehouse link and set the customer location." |
216 | @@ -665,7 +665,6 @@ | |||
217 | 665 | 'notes': notes or'', 'product_uom' : uom or False}, 'domain':{'product_uom':[]}} | 665 | 'notes': notes or'', 'product_uom' : uom or False}, 'domain':{'product_uom':[]}} |
218 | 666 | res = {} | 666 | res = {} |
219 | 667 | prod= self.pool.get('product.product').browse(cr, uid, product) | 667 | prod= self.pool.get('product.product').browse(cr, uid, product) |
220 | 668 | |||
221 | 669 | product_uom_pool = self.pool.get('product.uom') | 668 | product_uom_pool = self.pool.get('product.uom') |
222 | 670 | lang=False | 669 | lang=False |
223 | 671 | if partner_id: | 670 | if partner_id: |
224 | @@ -681,6 +680,11 @@ | |||
225 | 681 | date_order = time.strftime('%Y-%m-%d') | 680 | date_order = time.strftime('%Y-%m-%d') |
226 | 682 | qty = qty or 1.0 | 681 | qty = qty or 1.0 |
227 | 683 | seller_delay = 0 | 682 | seller_delay = 0 |
228 | 683 | if uom: | ||
229 | 684 | uom1_cat = prod.uom_id.category_id.id | ||
230 | 685 | uom2_cat = product_uom_pool.browse(cr, uid, uom).category_id.id | ||
231 | 686 | if uom1_cat != uom2_cat: | ||
232 | 687 | uom = False | ||
233 | 684 | 688 | ||
234 | 685 | prod_name = self.pool.get('product.product').name_get(cr, uid, [prod.id], context=context)[0][1] | 689 | prod_name = self.pool.get('product.product').name_get(cr, uid, [prod.id], context=context)[0][1] |
235 | 686 | res = {} | 690 | res = {} |
236 | @@ -707,14 +711,13 @@ | |||
237 | 707 | 'taxes_id':map(lambda x: x.id, prod.supplier_taxes_id), | 711 | 'taxes_id':map(lambda x: x.id, prod.supplier_taxes_id), |
238 | 708 | 'date_planned': date_planned or dt,'notes': notes or prod.description_purchase, | 712 | 'date_planned': date_planned or dt,'notes': notes or prod.description_purchase, |
239 | 709 | 'product_qty': qty, | 713 | 'product_qty': qty, |
241 | 710 | 'product_uom': uom}}) | 714 | 'product_uom': prod.uom_id.id}}) |
242 | 711 | domain = {} | 715 | domain = {} |
243 | 712 | 716 | ||
244 | 713 | taxes = self.pool.get('account.tax').browse(cr, uid,map(lambda x: x.id, prod.supplier_taxes_id)) | 717 | taxes = self.pool.get('account.tax').browse(cr, uid,map(lambda x: x.id, prod.supplier_taxes_id)) |
245 | 714 | fpos = fiscal_position and self.pool.get('account.fiscal.position').browse(cr, uid, fiscal_position) or False | 718 | fpos = fiscal_position and self.pool.get('account.fiscal.position').browse(cr, uid, fiscal_position) or False |
246 | 715 | res['value']['taxes_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes) | 719 | res['value']['taxes_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, taxes) |
249 | 716 | 720 | res2 = self.pool.get('product.uom').read(cr, uid, [prod.uom_id.id], ['category_id']) | |
248 | 717 | res2 = self.pool.get('product.uom').read(cr, uid, [uom], ['category_id']) | ||
250 | 718 | res3 = prod.uom_id.category_id.id | 721 | res3 = prod.uom_id.category_id.id |
251 | 719 | domain = {'product_uom':[('category_id','=',res2[0]['category_id'][0])]} | 722 | domain = {'product_uom':[('category_id','=',res2[0]['category_id'][0])]} |
252 | 720 | if res2[0]['category_id'][0] != res3: | 723 | if res2[0]['category_id'][0] != res3: |
253 | 721 | 724 | ||
254 | === modified file 'purchase/purchase_view.xml' | |||
255 | --- purchase/purchase_view.xml 2011-01-18 13:33:35 +0000 | |||
256 | +++ purchase/purchase_view.xml 2011-02-16 05:24:17 +0000 | |||
257 | @@ -12,7 +12,7 @@ | |||
258 | 12 | groups="group_purchase_manager" | 12 | groups="group_purchase_manager" |
259 | 13 | parent="base.menu_purchase_root" sequence="100"/> | 13 | parent="base.menu_purchase_root" sequence="100"/> |
260 | 14 | 14 | ||
262 | 15 | <menuitem | 15 | <menuitem |
263 | 16 | id="menu_purchase_config_pricelist" name="Pricelists" | 16 | id="menu_purchase_config_pricelist" name="Pricelists" |
264 | 17 | parent="menu_purchase_config_purchase" sequence="50"/> | 17 | parent="menu_purchase_config_purchase" sequence="50"/> |
265 | 18 | 18 | ||
266 | @@ -29,22 +29,22 @@ | |||
267 | 29 | parent="menu_purchase_config_pricelist" sequence="2" | 29 | parent="menu_purchase_config_pricelist" sequence="2" |
268 | 30 | groups="base.group_extended"/> | 30 | groups="base.group_extended"/> |
269 | 31 | 31 | ||
271 | 32 | <menuitem | 32 | <menuitem |
272 | 33 | id="menu_product_in_config_purchase" name="Product" | 33 | id="menu_product_in_config_purchase" name="Product" |
273 | 34 | parent="menu_purchase_config_purchase" sequence="30"/> | 34 | parent="menu_purchase_config_purchase" sequence="30"/> |
274 | 35 | 35 | ||
275 | 36 | <menuitem | 36 | <menuitem |
276 | 37 | action="product.product_category_action_form" id="menu_product_category_config_purchase" | 37 | action="product.product_category_action_form" id="menu_product_category_config_purchase" |
277 | 38 | parent="purchase.menu_product_in_config_purchase" sequence="10"/> | 38 | parent="purchase.menu_product_in_config_purchase" sequence="10"/> |
280 | 39 | 39 | ||
281 | 40 | <menuitem | 40 | <menuitem |
282 | 41 | id="menu_purchase_unit_measure_purchase" name="Units of Measure" | 41 | id="menu_purchase_unit_measure_purchase" name="Units of Measure" |
283 | 42 | parent="purchase.menu_product_in_config_purchase" sequence="20"/> | 42 | parent="purchase.menu_product_in_config_purchase" sequence="20"/> |
284 | 43 | 43 | ||
285 | 44 | <menuitem | 44 | <menuitem |
286 | 45 | action="product.product_uom_categ_form_action" id="menu_purchase_uom_categ_form_action" | 45 | action="product.product_uom_categ_form_action" id="menu_purchase_uom_categ_form_action" |
287 | 46 | parent="menu_purchase_unit_measure_purchase" sequence="30"/> | 46 | parent="menu_purchase_unit_measure_purchase" sequence="30"/> |
289 | 47 | 47 | ||
290 | 48 | <menuitem | 48 | <menuitem |
291 | 49 | action="product.product_uom_form_action" id="menu_purchase_uom_form_action" | 49 | action="product.product_uom_form_action" id="menu_purchase_uom_form_action" |
292 | 50 | parent="menu_purchase_unit_measure_purchase" sequence="30"/> | 50 | parent="menu_purchase_unit_measure_purchase" sequence="30"/> |
293 | @@ -216,7 +216,7 @@ | |||
294 | 216 | <field name="date_approve"/> | 216 | <field name="date_approve"/> |
295 | 217 | <separator string="Invoices" colspan="4"/> | 217 | <separator string="Invoices" colspan="4"/> |
296 | 218 | <newline/> | 218 | <newline/> |
298 | 219 | <field name="invoice_ids" groups="base.group_extended" nolabel="1" colspan="4"/> | 219 | <field name="invoice_ids" groups="base.group_extended" nolabel="1" colspan="4" context="{'type':'in_invoice'}"/> |
299 | 220 | </page> | 220 | </page> |
300 | 221 | <page string="Notes"> | 221 | <page string="Notes"> |
301 | 222 | <field colspan="4" name="notes" nolabel="1"/> | 222 | <field colspan="4" name="notes" nolabel="1"/> |
302 | 223 | 223 | ||
303 | === modified file 'stock/stock.py' | |||
304 | --- stock/stock.py 2011-01-24 16:13:46 +0000 | |||
305 | +++ stock/stock.py 2011-02-16 05:24:17 +0000 | |||
306 | @@ -1166,8 +1166,7 @@ | |||
307 | 1166 | for move in pick.move_lines: | 1166 | for move in pick.move_lines: |
308 | 1167 | if move.state in ('done', 'cancel'): | 1167 | if move.state in ('done', 'cancel'): |
309 | 1168 | continue | 1168 | continue |
312 | 1169 | partial_data = partial_datas.get('move%s'%(move.id), False) | 1169 | partial_data = partial_datas.get('move%s'%(move.id), {}) |
311 | 1170 | assert partial_data, _('Missing partial picking data for move #%s') % (move.id) | ||
313 | 1171 | product_qty = partial_data.get('product_qty',0.0) | 1170 | product_qty = partial_data.get('product_qty',0.0) |
314 | 1172 | move_product_qty[move.id] = product_qty | 1171 | move_product_qty[move.id] = product_qty |
315 | 1173 | product_uom = partial_data.get('product_uom',False) | 1172 | product_uom = partial_data.get('product_uom',False) |
316 | @@ -1248,9 +1247,9 @@ | |||
317 | 1248 | 1247 | ||
318 | 1249 | if new_picking: | 1248 | if new_picking: |
319 | 1250 | move_obj.write(cr, uid, [c.id for c in complete], {'picking_id': new_picking}) | 1249 | move_obj.write(cr, uid, [c.id for c in complete], {'picking_id': new_picking}) |
323 | 1251 | for move in complete: | 1250 | for move in complete: |
324 | 1252 | if prodlot_ids.get(move.id): | 1251 | if prodlot_ids.get(move.id): |
325 | 1253 | move_obj.write(cr, uid, move.id, {'prodlot_id': prodlot_ids[move.id]}) | 1252 | move_obj.write(cr, uid, move.id, {'prodlot_id': prodlot_ids[move.id]}) |
326 | 1254 | for move in too_many: | 1253 | for move in too_many: |
327 | 1255 | product_qty = move_product_qty[move.id] | 1254 | product_qty = move_product_qty[move.id] |
328 | 1256 | defaults = { | 1255 | defaults = { |
329 | @@ -1463,7 +1462,7 @@ | |||
330 | 1463 | _description = "Stock Move" | 1462 | _description = "Stock Move" |
331 | 1464 | _order = 'date_expected desc, id' | 1463 | _order = 'date_expected desc, id' |
332 | 1465 | _log_create = False | 1464 | _log_create = False |
334 | 1466 | 1465 | ||
335 | 1467 | def action_partial_move(self, cr, uid, ids, context=None): | 1466 | def action_partial_move(self, cr, uid, ids, context=None): |
336 | 1468 | if context is None: context = {} | 1467 | if context is None: context = {} |
337 | 1469 | partial_id = self.pool.get("stock.partial.move").create( | 1468 | partial_id = self.pool.get("stock.partial.move").create( |
338 | @@ -1481,7 +1480,7 @@ | |||
339 | 1481 | 'domain': '[]', | 1480 | 'domain': '[]', |
340 | 1482 | 'context': context | 1481 | 'context': context |
341 | 1483 | } | 1482 | } |
343 | 1484 | 1483 | ||
344 | 1485 | 1484 | ||
345 | 1486 | def name_get(self, cr, uid, ids, context=None): | 1485 | def name_get(self, cr, uid, ids, context=None): |
346 | 1487 | res = [] | 1486 | res = [] |
347 | @@ -1855,11 +1854,6 @@ | |||
348 | 1855 | """ | 1854 | """ |
349 | 1856 | moves = self.browse(cr, uid, ids, context=context) | 1855 | moves = self.browse(cr, uid, ids, context=context) |
350 | 1857 | self.write(cr, uid, ids, {'state': 'confirmed'}) | 1856 | self.write(cr, uid, ids, {'state': 'confirmed'}) |
351 | 1858 | res_obj = self.pool.get('res.company') | ||
352 | 1859 | location_obj = self.pool.get('stock.location') | ||
353 | 1860 | move_obj = self.pool.get('stock.move') | ||
354 | 1861 | wf_service = netsvc.LocalService("workflow") | ||
355 | 1862 | |||
356 | 1863 | self.create_chained_picking(cr, uid, moves, context) | 1857 | self.create_chained_picking(cr, uid, moves, context) |
357 | 1864 | return [] | 1858 | return [] |
358 | 1865 | 1859 | ||
359 | @@ -1886,6 +1880,14 @@ | |||
360 | 1886 | @return: True | 1880 | @return: True |
361 | 1887 | """ | 1881 | """ |
362 | 1888 | self.write(cr, uid, ids, {'state': 'confirmed'}) | 1882 | self.write(cr, uid, ids, {'state': 'confirmed'}) |
363 | 1883 | |||
364 | 1884 | # fix for bug lp:707031 | ||
365 | 1885 | # called write of related picking because changing move availability does | ||
366 | 1886 | # not trigger workflow of picking in order to change the state of picking | ||
367 | 1887 | wf_service = netsvc.LocalService('workflow') | ||
368 | 1888 | for move in self.browse(cr, uid, ids, context): | ||
369 | 1889 | if move.picking_id: | ||
370 | 1890 | wf_service.trg_write(uid, 'stock.picking', move.picking_id.id, cr) | ||
371 | 1889 | return True | 1891 | return True |
372 | 1890 | 1892 | ||
373 | 1891 | # | 1893 | # |
374 | @@ -2135,7 +2137,7 @@ | |||
375 | 2135 | prodlot_id = partial_datas and partial_datas.get('move%s_prodlot_id' % (move.id), False) | 2137 | prodlot_id = partial_datas and partial_datas.get('move%s_prodlot_id' % (move.id), False) |
376 | 2136 | if prodlot_id: | 2138 | if prodlot_id: |
377 | 2137 | self.write(cr, uid, [move.id], {'prodlot_id': prodlot_id}, context=context) | 2139 | self.write(cr, uid, [move.id], {'prodlot_id': prodlot_id}, context=context) |
379 | 2138 | if move.state not in ('confirmed','done'): | 2140 | if move.state not in ('confirmed','done','assigned'): |
380 | 2139 | self.action_confirm(cr, uid, move_ids, context=context) | 2141 | self.action_confirm(cr, uid, move_ids, context=context) |
381 | 2140 | 2142 | ||
382 | 2141 | self.write(cr, uid, move_ids, {'state': 'done', 'date_planned': time.strftime('%Y-%m-%d %H:%M:%S')}, context=context) | 2143 | self.write(cr, uid, move_ids, {'state': 'done', 'date_planned': time.strftime('%Y-%m-%d %H:%M:%S')}, context=context) |
383 | 2142 | 2144 | ||
384 | === modified file 'stock/wizard/stock_invoice_onshipping.py' | |||
385 | --- stock/wizard/stock_invoice_onshipping.py 2011-01-17 08:00:48 +0000 | |||
386 | +++ stock/wizard/stock_invoice_onshipping.py 2011-02-16 05:24:17 +0000 | |||
387 | @@ -115,7 +115,7 @@ | |||
388 | 115 | if context is None: | 115 | if context is None: |
389 | 116 | context = {} | 116 | context = {} |
390 | 117 | picking_pool = self.pool.get('stock.picking') | 117 | picking_pool = self.pool.get('stock.picking') |
392 | 118 | onshipdata_obj = self.read(cr, uid, ids, ['journal_id', 'group', 'invoice_date']) | 118 | onshipdata_obj = self.read(cr, uid, ids, ['journal_id', 'group', 'invoice_date'], context=context) |
393 | 119 | if context.get('new_picking', False): | 119 | if context.get('new_picking', False): |
394 | 120 | onshipdata_obj['id'] = onshipdata_obj.new_picking | 120 | onshipdata_obj['id'] = onshipdata_obj.new_picking |
395 | 121 | onshipdata_obj[ids] = onshipdata_obj.new_picking | 121 | onshipdata_obj[ids] = onshipdata_obj.new_picking |
396 | @@ -127,7 +127,7 @@ | |||
397 | 127 | res = picking_pool.action_invoice_create(cr, uid, active_ids, | 127 | res = picking_pool.action_invoice_create(cr, uid, active_ids, |
398 | 128 | journal_id = onshipdata_obj[0]['journal_id'], | 128 | journal_id = onshipdata_obj[0]['journal_id'], |
399 | 129 | group = onshipdata_obj[0]['group'], | 129 | group = onshipdata_obj[0]['group'], |
401 | 130 | type = None, | 130 | type = context.get('inv_type'), |
402 | 131 | context=context) | 131 | context=context) |
403 | 132 | return res | 132 | return res |
404 | 133 | 133 | ||
405 | 134 | 134 | ||
406 | === modified file 'stock/wizard/stock_location_product.py' | |||
407 | --- stock/wizard/stock_location_product.py 2011-01-14 00:11:01 +0000 | |||
408 | +++ stock/wizard/stock_location_product.py 2011-02-16 05:24:17 +0000 | |||
409 | @@ -39,7 +39,7 @@ | |||
410 | 39 | @return: Invoice type | 39 | @return: Invoice type |
411 | 40 | """ | 40 | """ |
412 | 41 | mod_obj = self.pool.get('ir.model.data') | 41 | mod_obj = self.pool.get('ir.model.data') |
414 | 42 | for location_obj in self.read(cr, uid, ids, ['from_date', 'to_date']): | 42 | for location_obj in self.read(cr, uid, ids, ['from_date', 'to_date'], context=context): |
415 | 43 | return { | 43 | return { |
416 | 44 | 'name': False, | 44 | 'name': False, |
417 | 45 | 'view_type': 'form', | 45 | 'view_type': 'form', |
418 | 46 | 46 | ||
419 | === modified file 'stock/wizard/stock_move.py' | |||
420 | --- stock/wizard/stock_move.py 2011-01-14 00:11:01 +0000 | |||
421 | +++ stock/wizard/stock_move.py 2011-02-16 05:24:17 +0000 | |||
422 | @@ -21,34 +21,6 @@ | |||
423 | 21 | 21 | ||
424 | 22 | from osv import fields, osv | 22 | from osv import fields, osv |
425 | 23 | 23 | ||
426 | 24 | class stock_move_track(osv.osv_memory): | ||
427 | 25 | _name = "stock.move.track" | ||
428 | 26 | _description = "Track moves" | ||
429 | 27 | |||
430 | 28 | _columns = { | ||
431 | 29 | 'tracking_prefix': fields.char('Tracking prefix', size=64), | ||
432 | 30 | 'quantity': fields.float("Quantity per lot") | ||
433 | 31 | } | ||
434 | 32 | |||
435 | 33 | _defaults = { | ||
436 | 34 | 'quantity': lambda *x: 1 | ||
437 | 35 | } | ||
438 | 36 | |||
439 | 37 | def track_lines(self, cr, uid, ids, context=None): | ||
440 | 38 | """ To track stock moves lines | ||
441 | 39 | @param self: The object pointer. | ||
442 | 40 | @param cr: A database cursor | ||
443 | 41 | @param uid: ID of the user currently logged in | ||
444 | 42 | @param ids: An ID or list of IDs if we want more than one | ||
445 | 43 | @param context: A standard dictionary | ||
446 | 44 | @return: | ||
447 | 45 | """ | ||
448 | 46 | datas = self.read(cr, uid, ids)[0] | ||
449 | 47 | move_obj = self.pool.get('stock.move') | ||
450 | 48 | move_obj._track_lines(cr, uid, context['active_id'], datas, context=context) | ||
451 | 49 | return {'type': 'ir.actions.act_window_close'} | ||
452 | 50 | |||
453 | 51 | stock_move_track() | ||
454 | 52 | 24 | ||
455 | 53 | class stock_move_consume(osv.osv_memory): | 25 | class stock_move_consume(osv.osv_memory): |
456 | 54 | _name = "stock.move.consume" | 26 | _name = "stock.move.consume" |
457 | 55 | 27 | ||
458 | === modified file 'stock/wizard/stock_partial_picking.py' | |||
459 | --- stock/wizard/stock_partial_picking.py 2011-01-27 10:53:33 +0000 | |||
460 | +++ stock/wizard/stock_partial_picking.py 2011-02-16 05:24:17 +0000 | |||
461 | @@ -67,8 +67,9 @@ | |||
462 | 67 | for m in pick.move_lines: | 67 | for m in pick.move_lines: |
463 | 68 | if m.state in ('done', 'cancel'): | 68 | if m.state in ('done', 'cancel'): |
464 | 69 | continue | 69 | continue |
467 | 70 | result.append(self.__create_partial_picking_memory(m, pick_type)) | 70 | move_memory = self.__create_partial_picking_memory(m, pick_type) |
468 | 71 | 71 | if move_memory: | |
469 | 72 | result.append(move_memory) | ||
470 | 72 | if 'product_moves_in' in fields: | 73 | if 'product_moves_in' in fields: |
471 | 73 | res.update({'product_moves_in': result}) | 74 | res.update({'product_moves_in': result}) |
472 | 74 | if 'product_moves_out' in fields: | 75 | if 'product_moves_out' in fields: |
473 | @@ -124,12 +125,27 @@ | |||
474 | 124 | 'prodlot_id' : picking.prodlot_id.id, | 125 | 'prodlot_id' : picking.prodlot_id.id, |
475 | 125 | 'move_id' : picking.id, | 126 | 'move_id' : picking.id, |
476 | 126 | } | 127 | } |
478 | 127 | 128 | ||
479 | 128 | if pick_type == 'in': | 129 | if pick_type == 'in': |
480 | 129 | move_memory.update({ | 130 | move_memory.update({ |
481 | 130 | 'cost' : picking.product_id.standard_price, | 131 | 'cost' : picking.product_id.standard_price, |
482 | 131 | 'currency' : picking.product_id.company_id and picking.product_id.company_id.currency_id and picking.product_id.company_id.currency_id.id or False, | 132 | 'currency' : picking.product_id.company_id and picking.product_id.company_id.currency_id and picking.product_id.company_id.currency_id.id or False, |
483 | 132 | }) | 133 | }) |
484 | 134 | |||
485 | 135 | if pick_type == 'out': | ||
486 | 136 | type = picking.picking_id.move_type | ||
487 | 137 | qty_avl = picking.product_id.qty_available | ||
488 | 138 | if type == 'direct' : | ||
489 | 139 | if qty_avl <= 0.0 and picking.state != 'assigned': | ||
490 | 140 | move_memory = {} | ||
491 | 141 | if picking.product_qty > qty_avl and qty_avl > 0.0: | ||
492 | 142 | move_memory.update({ | ||
493 | 143 | 'quantity' : qty_avl, | ||
494 | 144 | }) | ||
495 | 145 | if picking.state == 'assigned': | ||
496 | 146 | move_memory.update({ | ||
497 | 147 | 'quantity' : picking.product_qty, | ||
498 | 148 | }) | ||
499 | 133 | return move_memory | 149 | return move_memory |
500 | 134 | 150 | ||
501 | 135 | def do_partial(self, cr, uid, ids, context=None): | 151 | def do_partial(self, cr, uid, ids, context=None): |
502 | 136 | 152 | ||
503 | === modified file 'stock/wizard/stock_return_picking.py' | |||
504 | --- stock/wizard/stock_return_picking.py 2011-01-18 13:41:41 +0000 | |||
505 | +++ stock/wizard/stock_return_picking.py 2011-02-16 05:24:17 +0000 | |||
506 | @@ -151,7 +151,7 @@ | |||
507 | 151 | wf_service = netsvc.LocalService("workflow") | 151 | wf_service = netsvc.LocalService("workflow") |
508 | 152 | 152 | ||
509 | 153 | pick = pick_obj.browse(cr, uid, record_id, context=context) | 153 | pick = pick_obj.browse(cr, uid, record_id, context=context) |
511 | 154 | data = self.read(cr, uid, ids[0]) | 154 | data = self.read(cr, uid, ids[0], context=context) |
512 | 155 | new_picking = None | 155 | new_picking = None |
513 | 156 | date_cur = time.strftime('%Y-%m-%d %H:%M:%S') | 156 | date_cur = time.strftime('%Y-%m-%d %H:%M:%S') |
514 | 157 | 157 |