Merge lp:~openerp-dev/openobject-addons/trunk-opw-581494-rha into lp:openobject-addons

Proposed by Rifakat Husen (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-opw-581494-rha
Merge into: lp:openobject-addons
Diff against target: 34 lines (+12/-1)
2 files modified
stock/stock.py (+10/-0)
stock/stock_view.xml (+2/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-opw-581494-rha
Reviewer Review Type Date Requested Status
Numérigraphe (community) Needs Fixing
OpenERP Core Team Pending
Review via email: mp+133057@code.launchpad.net

Description of the change

Hello,

It is possible to change product on Production Lot while stock move
is also refers to it. We should not let any user change the product if
stock move is associated.

I have put attrs on product, it becomes readonly when there is any stock move
refers to Production Lot. Also overrided write(), so that it can't be changed
through any webservice.

Thanks for your review.

Regards,
Rifakat Haradwala

To post a comment you must log in.
7955. By Quentin (OpenERP) <email address hidden>

[MERGE] fix in account_voucher (bug spotted by nel)

7956. By Vo Minh Thu

[MERGE] removed a few warnings.

7957. By Thibault Delavallée (OpenERP)

[MERGE] Introducing the Many2Many Email Widget, based on Many2Many Tags. This widget designed for many2many fields on partners checks that partners added in the widget have an email address defined; if not, a popup is opened to enter an email.

Also featuring in a 'by the way' fashion:
- the 'Compose' button now opens a mail.compose.message wizard, without using further Chatter values.

Revision history for this message
Numérigraphe (numerigraphe) wrote :

I think write() should always refuse to change the product, even when no moves exist, because other objects could relate to product_id and we have no way to know.
Lionel

review: Needs Fixing
7958. By Olivier Dony (Odoo)

[FIX] l10n_*: ensure install wizard triggers are in `noupdate` blocks, to avoid spurious wizards at update

7959. By Fabien (Open ERP)

[IMP] Expenses configuration menu simplified

7960. By Fabien (Open ERP)

[IMP] typo

7961. By Fabien (Open ERP)

[IMP] note CSS

7962. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

7963. By Rifakat Husen (OpenERP)

[FIX] stock: remove checking on moves, always product can not be changed

Revision history for this message
Rifakat Husen (OpenERP) (rha-openerp) wrote :

Thanks Lionel, you are right. Corrected!

Revision history for this message
Numérigraphe (numerigraphe) wrote :

Thanks for the change.
Can the field could be readonly when id is not null please?

7964. By Rifakat Husen (OpenERP)

[FIX] stock: improved attrs to be able to make product invisible as soon as we save form

Unmerged revisions

7964. By Rifakat Husen (OpenERP)

[FIX] stock: improved attrs to be able to make product invisible as soon as we save form

7963. By Rifakat Husen (OpenERP)

[FIX] stock: remove checking on moves, always product can not be changed

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/stock.py'
2--- stock/stock.py 2012-11-06 15:04:31 +0000
3+++ stock/stock.py 2012-11-07 10:51:46 +0000
4@@ -1555,6 +1555,16 @@
5 _sql_constraints = [
6 ('name_ref_uniq', 'unique (name, ref)', 'The combination of serial number and internal reference must be unique !'),
7 ]
8+
9+ def write(self, cr, uid, ids, vals, context=None):
10+ if 'product_id' in vals:
11+ for production_lot in self.browse(cr, uid, ids, context=context):
12+ if vals['product_id'] != production_lot.product_id.id:
13+ raise osv.except_osv(_('Warning!'), _('You can not change product in this Serial Number once \
14+any product has been assigned to it. \
15+Please create a new Serial Number for your product!'))
16+ return super(stock_production_lot, self).write(cr, uid, ids, vals, context=context)
17+
18 def action_traceability(self, cr, uid, ids, context=None):
19 """ It traces the information of a product
20 @param self: The object pointer.
21
22=== modified file 'stock/stock_view.xml'
23--- stock/stock_view.xml 2012-10-30 04:49:18 +0000
24+++ stock/stock_view.xml 2012-11-07 10:51:46 +0000
25@@ -348,7 +348,8 @@
26 </div>
27 <group>
28 <group>
29- <field name="product_id"/>
30+ <field name="id" invisible="1"/>
31+ <field name="product_id" attrs="{'readonly': [('id', '!=', False)]}"/>
32 <field name="prefix"/>
33 <field name="ref"/>
34 </group>

Subscribers

People subscribed via source and target branches

to all changes: