Skip to content

Commit

Permalink
[8.0.1.6.0] l10n_id_djbc_app
Browse files Browse the repository at this point in the history
  • Loading branch information
andhit-r committed Dec 6, 2018
1 parent 309bf3e commit b8ca495
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion l10n_id_djbc_app/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# pylint: disable=locally-disabled, manifest-required-author
{
"name": "Indonesia - IT Inventory for DJBC Reporting",
"version": "8.0.1.5.0",
"version": "8.0.1.6.0",
"category": "localization",
"website": "https://opensynergy-indonesia.com",
"author": "OpenSynergy Indonesia",
Expand Down
21 changes: 21 additions & 0 deletions l10n_id_djbc_app/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ def _compute_djbc(self):
if not quant.djbc_custom:
move.djbc_custom = False

@api.depends(
"picking_type_id",
"picking_type_id.allowed_document_type_ids")
def _compute_all_allowed_document_type_ids(self):
obj_document_type =\
self.env["l10n_id.djbc_document_type"]
for move in self:
if move.picking_type_id and \
move.picking_type_id.allowed_document_type_ids:
move.all_allowed_document_type_ids = \
move.picking_type_id.allowed_document_type_ids
else:
move.all_allowed_document_type_ids = \
obj_document_type.search([])

djbc_custom_document_id = fields.Many2one(
string="DJBC Custom Document",
comodel_name="l10n_id.djbc_custom_document",
Expand All @@ -32,3 +47,9 @@ def _compute_djbc(self):
store=True,
readonly=True,
)
all_allowed_document_type_ids = fields.Many2many(
string="All Allowed Document Type",
comodel_name="l10n_id.djbc_document_type",
compute="_compute_all_allowed_document_type_ids",
store=False,
)
12 changes: 7 additions & 5 deletions l10n_id_djbc_app/views/stock_move_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
<field name="arch" type="xml">
<xpath expr="//group[@name='quants_grp']" position="before">
<group name="grp_djbc" string="DJBC Info" colspan="4">
<field name="djbc_custom_document_id" domain="[('type_id', 'in', parent.all_allowed_document_type_ids[0][2])]"/>
<field name="djbc_custom"/>
<field name="all_allowed_document_type_ids" invisible="1"/>
<field name="djbc_custom_document_id" domain="[('type_id', 'in', all_allowed_document_type_ids[0][2])]"/>
<field name="djbc_custom"/>
</group>
</xpath>
</field>
Expand All @@ -25,8 +26,9 @@
<field name="arch" type="xml">
<xpath expr="//group[@name='quants_grp']" position="before">
<group name="grp_djbc" string="DJBC Info" colspan="4">
<field name="djbc_custom_document_id" domain="[('type_id', 'in', parent.all_allowed_document_type_ids[0][2])]"/>
<field name="djbc_custom"/>
<field name="all_allowed_document_type_ids" invisible="1"/>
<field name="djbc_custom_document_id" domain="[('type_id', 'in', all_allowed_document_type_ids[0][2])]"/>
<field name="djbc_custom"/>
</group>
</xpath>
</field>
Expand All @@ -39,7 +41,7 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='picking_type_id']" position="after">
<field name="djbc_custom_document_id"/>
<field name="djbc_custom"/>
<field name="djbc_custom"/>
</xpath>
</field>
</record>
Expand Down

0 comments on commit b8ca495

Please sign in to comment.