Skip to content

Commit

Permalink
[IMP] stock: add is_signed boolean computed field
Browse files Browse the repository at this point in the history
signaature field was used in listview and it was displaying size of the
signature file, it has been done in commit: 4bdbb9b
but as discussed on PR: odoo#72276
we added is_signed computed boolean field to display it like boolean as boolean
widget is supported only on boolean type field.

task-2580117
  • Loading branch information
msh-odoo committed Jun 23, 2021
1 parent 441baf5 commit 843c1d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions addons/stock/models/stock_picking.py
Expand Up @@ -369,6 +369,7 @@ class Picking(models.Model):
help="When validating the transfer, the products will be assigned to this owner.")
printed = fields.Boolean('Printed', copy=False)
signature = fields.Image('Signature', help='Signature', copy=False, attachment=True)
is_signed = fields.Boolean('Is Signed', compute="_compute_is_signed")
is_locked = fields.Boolean(default=True, help='When the picking is not done this allows changing the '
'initial demand. When the picking is done this allows '
'changing the done quantities.')
Expand Down Expand Up @@ -411,6 +412,11 @@ def _compute_delay_alert_date(self):
for picking in self:
picking.delay_alert_date = delay_alert_date_data.get(picking.id, False)

@api.depends('signature')
def _compute_is_signed(self):
for picking in self:
picking.is_signed = picking.signature

@api.depends('move_lines', 'state', 'picking_type_code', 'move_lines.forecast_availability', 'move_lines.forecast_expected_date')
def _compute_products_availability(self):
self.products_availability = False
Expand Down
2 changes: 1 addition & 1 deletion addons/stock/views/stock_picking_views.xml
Expand Up @@ -189,7 +189,7 @@
<field name="location_id" options="{'no_create': True}" string="From" groups="stock.group_stock_multi_locations" optional="show"/>
<field name="location_dest_id" options="{'no_create': True}" string="To" groups="stock.group_stock_multi_locations" optional="show"/>
<field name="partner_id" optional="show"/>
<field name="signature" string="Signed" optional="hide" groups="stock.group_stock_sign_delivery"/>
<field name="is_signed" string="Signed" optional="hide" groups="stock.group_stock_sign_delivery"/>
<field name="user_id" optional="hide" widget="many2one_avatar_user"/>
<field name="scheduled_date" optional="show" widget="remaining_days" attrs="{'invisible':[('state', 'in', ('done', 'cancel'))]}"/>
<field name="date_deadline" optional="hide" widget="remaining_days" attrs="{'invisible':[('state', 'in', ('done', 'cancel'))]}"/>
Expand Down

0 comments on commit 843c1d1

Please sign in to comment.