Skip to content

Commit

Permalink
Merge d8b967b into 90641e1
Browse files Browse the repository at this point in the history
  • Loading branch information
serpentcs-dev1 committed Jul 5, 2017
2 parents 90641e1 + d8b967b commit 87c04d1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
5 changes: 4 additions & 1 deletion account_operating_unit/models/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ class AccountInvoice(models.Model):
operating_unit_id = fields.Many2one('operating.unit', 'Operating Unit',
default=lambda self:
self.env['res.users'].
operating_unit_default_get(self._uid))
operating_unit_default_get(self._uid),
readonly=True,
states={'draft': [('readonly',
False)]})

@api.multi
def finalize_invoice_move_lines(self, move_lines):
Expand Down
9 changes: 9 additions & 0 deletions purchase_operating_unit/models/purchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,24 @@ def _default_picking_type(self):
res = types[:1].id
return res

READONLY_STATES = {
'purchase': [('readonly', True)],
'done': [('readonly', True)],
'cancel': [('readonly', True)],
}

operating_unit_id = fields.Many2one(
comodel_name='operating.unit',
string='Operating Unit',
states=READONLY_STATES,
default=lambda self: (self.env['res.users'].
operating_unit_default_get(self.env.uid))
)

requesting_operating_unit_id = fields.Many2one(
comodel_name='operating.unit',
string='Requesting Operating Unit',
states=READONLY_STATES,
default=lambda self: (self.env['res.users'].
operating_unit_default_get(self.env.uid))
)
Expand Down
5 changes: 4 additions & 1 deletion sale_operating_unit/models/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ def _default_operating_unit(self):
operating_unit_id = fields.Many2one(
comodel_name='operating.unit',
string='Operating Unit',
default=_default_operating_unit
default=_default_operating_unit,
readonly=True,
states={'draft': [('readonly', False)],
'sent': [('readonly', False)]}
)

@api.onchange('team_id')
Expand Down

0 comments on commit 87c04d1

Please sign in to comment.