How to do it...

Perform the following steps to capture a picture from a camera through the IoT Box:

  1. Add a dependency in the manifest file:
... 
'depends': ['base', 'mail', 'quality_mrp_iot'],
...
  1. Add new fields in the library.book.rent model:
...
device_id = fields.Many2one('iot.device', string='IoT Device',
domain="[('type', '=', 'camera')]")
ip = fields.Char(related="device_id.iot_id.ip")
identifier = fields.Char(related='device_id.identifier')
picture = fields.Binary()
...
  1. Add these fields into the form view of the library.book.rent model:
<group>
<field name="book_id" domain="[('state', '=', 'available')]"/>
<field name="borrower_id"/>
<field name="ip" invisible="1"/>
<field name="identifier" invisible="1"/>
<field name="device_id" required="1"/>
<field name="picture" widget="iot_picture"
options="{'ip_field': 'ip', 'identifier': 'identifier'}"/>
</group>

Update the my_library module to apply the changes. After the update, you will have a button to capture pictures:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset