Merge lp:~mallorymarcot/unifield-server/us-5025 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 5134
Proposed branch: lp:~mallorymarcot/unifield-server/us-5025
Merge into: lp:unifield-server
Diff against target: 40 lines (+16/-1)
2 files modified
bin/addons/specific_rules/specific_rules.py (+14/-0)
bin/addons/specific_rules/specific_rules_view.xml (+2/-1)
To merge this branch: bzr merge lp:~mallorymarcot/unifield-server/us-5025
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+356382@code.launchpad.net
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 'bin/addons/specific_rules/specific_rules.py'
2--- bin/addons/specific_rules/specific_rules.py 2018-08-17 15:15:35 +0000
3+++ bin/addons/specific_rules/specific_rules.py 2018-10-10 07:25:25 +0000
4@@ -1273,8 +1273,22 @@
5
6 return res
7
8+ def _get_has_stock_move(self, cr, uid, ids, field_name, arg, context=None):
9+ if isinstance(ids,(long, int)):
10+ ids = [ids]
11+ if context is None:
12+ context = {}
13+
14+ res = {}
15+ for _id in ids:
16+ res[_id] = self.pool.get('stock.move').search(cr, uid, [('prodlot_id', '=', _id)], limit=1, context=context) and True or False
17+
18+ return res
19+
20+
21 _columns = {
22 'check_type': fields.function(_get_false, fnct_search=search_check_type, string='Check Type', type="boolean", readonly=True, method=True),
23+ 'has_stock_move': fields.function(_get_has_stock_move, string='Has stock move', type="boolean", readonly=True, method=True),
24 # readonly is True, the user is only allowed to create standard lots - internal lots are system-created
25 'type': fields.selection([('standard', 'Standard'),('internal', 'Internal'),], string="Type", readonly=True),
26 #'expiry_date': fields.date('Expiry Date'),
27
28=== modified file 'bin/addons/specific_rules/specific_rules_view.xml'
29--- bin/addons/specific_rules/specific_rules_view.xml 2018-08-10 15:54:25 +0000
30+++ bin/addons/specific_rules/specific_rules_view.xml 2018-10-10 07:25:25 +0000
31@@ -123,7 +123,8 @@
32 </xpath>
33
34 <xpath expr="/form//field[@name='product_id']" position="replace">
35- <field name="product_id" colspan="4" domain="[('batch_management', '=', True)]" />
36+ <field name="has_stock_move" invisible="1"/>
37+ <field name="product_id" colspan="4" domain="[('batch_management', '=', True)]" attrs="{'readonly': [('has_stock_move', '=', True)]}" />
38 </xpath>
39
40 <xpath expr="/form/group/separator" position="replace">

Subscribers

People subscribed via source and target branches