Accept Merge Request #338: (feature/修改机床参数bug -> develop)

Merge Request: 刀把类型新增bt50 处理品牌图片同步报错问题

Created By: @龚启豪
Accepted By: @龚启豪
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/338?initial=true
This commit is contained in:
龚启豪
2023-08-23 14:40:10 +08:00
committed by Coding
4 changed files with 9 additions and 3 deletions

View File

@@ -256,7 +256,7 @@ class MachineToolType(models.Model):
name = fields.Char('名称')
brand_id = fields.Many2one('sf.machine.brand', string='品牌')
knife_type = fields.Selection(
[("BT40", "BT40"), ("BT30", "BT30")],
[("BT40", "BT40"), ("BT30", "BT30"), ("BT50", "BT50")],
default="", string="刀把类型")
number_of_knife_library = fields.Integer('刀库数量')
rotate_speed = fields.Integer('转速')

View File

@@ -30,6 +30,7 @@
<field name="name"/>
<field name="tag_ids" widget="many2many_tags" optional="hide"/>
<field name="remark"/>
<field name="image_brand" widget="image"/>
</tree>
</field>
</record>

View File

@@ -21,7 +21,7 @@
<notebook>
<page string="维保标准" attrs="{'invisible': [('equipment_maintenance_id', '=', False)]}">
<field name="maintenance_standards" widget="ony2many">
<tree create="False">
<tree editable="bottom">
<field name="name"/>
<field name="maintenance_standards"/>
</tree>

View File

@@ -569,15 +569,20 @@ class MachineBrand(models.Model):
result = json.loads(r['result'])
if result['status'] == 1:
for item in result['machine_brand_all_list']:
brand = self.env['sf.machine.brand'].search(
[("code", '=', item['code'])])
if not brand:
if item.get('image_brand'):
image = base64.b64decode(item['image_brand'])
else:
image = ''
self.env['sf.machine.brand'].create({
"id": item['id'],
"name": item['name'],
"code": item['code'],
"remark": item['remark'],
"image_brand": '' if not item['image_brand'] else base64.b64encode(item.image_brand),
"image_brand": image,
"tag_ids": self.env['sf.machine.brand.tags'].search(
[("name", 'in', item['tag_ids'])]).ids
})