Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/销售订单行新增模型展示
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
pystrich
|
pystrich
|
||||||
|
cpca
|
||||||
|
|||||||
@@ -131,7 +131,7 @@
|
|||||||
<sheet>
|
<sheet>
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="code" readonly="1"/>
|
<field name="code" />
|
||||||
<field name="name" string="参数名"/>
|
<field name="name" string="参数名"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
|
|||||||
@@ -98,9 +98,8 @@ export class CodeField extends Component {
|
|||||||
}]);
|
}]);
|
||||||
console.log(updatetrayRecord)
|
console.log(updatetrayRecord)
|
||||||
});
|
});
|
||||||
this.props.update(records[0].code, records[0].tray_id);
|
this.props.update(records[0].code);
|
||||||
location.replace(location.href)
|
$('.o_form_button_save').click();
|
||||||
// location.reload()
|
|
||||||
} else {
|
} else {
|
||||||
if (records[0].state === '占用') {
|
if (records[0].state === '占用') {
|
||||||
console.log('此托盘已占用,请检查')
|
console.log('此托盘已占用,请检查')
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
aria-label="Scan barcode"
|
aria-label="Scan barcode"
|
||||||
title="Scan barcode"
|
title="Scan barcode"
|
||||||
data-tooltip="Scan barcode"
|
data-tooltip="Scan barcode"
|
||||||
style="position: absolute !important;"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,6 @@
|
|||||||
class="btn-primary" attrs='{"invisible": ["|",
|
class="btn-primary" attrs='{"invisible": ["|",
|
||||||
("state","!=","progress"),("user_permissions","=",False)]}'/>
|
("state","!=","progress"),("user_permissions","=",False)]}'/>
|
||||||
<span> </span>
|
<span> </span>
|
||||||
<!-- <field name="button_up_all_state" attrs='{"invisible": ["|",-->
|
|
||||||
<!-- ("state","!=","progress"),("user_permissions","=",False)]}'/>-->
|
|
||||||
<button string="一键下发" name="up_all" type="object" style="text-align: right;" confirm="是否确认一键下发"
|
<button string="一键下发" name="up_all" type="object" style="text-align: right;" confirm="是否确认一键下发"
|
||||||
class="btn-primary" context="{'default_workorder_id': id}" attrs='{"invisible": ["|",
|
class="btn-primary" context="{'default_workorder_id': id}" attrs='{"invisible": ["|",
|
||||||
("state","!=","progress"),("user_permissions","=",False)]}'/>
|
("state","!=","progress"),("user_permissions","=",False)]}'/>
|
||||||
|
|||||||
@@ -327,9 +327,9 @@ class MrpProduction(models.Model):
|
|||||||
# workorder.duration_expected = workorder._get_duration_expected()
|
# workorder.duration_expected = workorder._get_duration_expected()
|
||||||
|
|
||||||
def _create_workorder2(self, k):
|
def _create_workorder2(self, k):
|
||||||
res = self._create_workorder1(k)
|
self._create_workorder1(k)
|
||||||
self._reset_work_order_sequence1(k)
|
self._reset_work_order_sequence1(k)
|
||||||
return res
|
return True
|
||||||
|
|
||||||
def _reset_work_order_sequence(self):
|
def _reset_work_order_sequence(self):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
@@ -339,11 +339,10 @@ class MrpProduction(models.Model):
|
|||||||
current_sequence += 1
|
current_sequence += 1
|
||||||
if work.name == '获取CNC加工程序':
|
if work.name == '获取CNC加工程序':
|
||||||
work.button_start()
|
work.button_start()
|
||||||
work.button_finish()
|
|
||||||
work.fetchCNC()
|
work.fetchCNC()
|
||||||
|
|
||||||
# 创建工单并进行排序
|
# 创建工单并进行排序
|
||||||
def _create_workorder(self):
|
def _create_workorder(self):
|
||||||
res = self._create_workorder3()
|
self._create_workorder3()
|
||||||
self._reset_work_order_sequence()
|
self._reset_work_order_sequence()
|
||||||
return res
|
return True
|
||||||
|
|||||||
@@ -479,53 +479,38 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
if self.date_planned_finished and self.date_planned_finished < start_date:
|
if self.date_planned_finished and self.date_planned_finished < start_date:
|
||||||
vals['date_planned_finished'] = start_date
|
vals['date_planned_finished'] = start_date
|
||||||
return self.write(vals)
|
return self.write(vals)
|
||||||
|
# 外协出库单,从“正在等待”变为“就绪”状态
|
||||||
|
if self.is_subcontract is True:
|
||||||
|
picking_out = self.env['stock.picking'].search([('id', '=', self.picking_out_id.id)])
|
||||||
|
if picking_out:
|
||||||
|
picking_out.write({'state': 'assigned'})
|
||||||
else:
|
else:
|
||||||
raise UserError(_('请先完成上一步工单'))
|
raise UserError(_('请先完成上一步工单'))
|
||||||
|
|
||||||
def button_finish(self):
|
def button_finish(self):
|
||||||
end_date = datetime.now()
|
if self.picking_out_id:
|
||||||
for workorder in self:
|
picking_out = self.env['stock.picking'].search([('id', '=', self.picking_out_id.id)])
|
||||||
if workorder.state in ('done', 'cancel'):
|
if picking_out.workorder_out_id:
|
||||||
continue
|
|
||||||
workorder.end_all()
|
|
||||||
vals = {
|
|
||||||
'qty_produced': workorder.qty_produced or workorder.qty_producing or workorder.qty_production,
|
|
||||||
'state': 'done',
|
|
||||||
'date_finished': end_date,
|
|
||||||
'date_planned_finished': end_date,
|
|
||||||
'costs_hour': workorder.workcenter_id.costs_hour
|
|
||||||
}
|
|
||||||
if not workorder.date_start:
|
|
||||||
vals['date_start'] = end_date
|
|
||||||
if not workorder.date_planned_start or end_date < workorder.date_planned_start:
|
|
||||||
vals['date_planned_start'] = end_date
|
|
||||||
workorder.with_context(bypass_duration_calculation=True).write(vals)
|
|
||||||
self.env.cr.commit()
|
|
||||||
finish_workorder_count = self.env['mrp.workorder'].search_count(
|
|
||||||
[('production_id', '=', workorder.production_id.id),
|
|
||||||
('is_subcontract', '=', True)])
|
|
||||||
subcontract_workorder_count = self.env['mrp.workorder'].search_count(
|
|
||||||
[('production_id', '=', workorder.production_id.id), ('is_subcontract', '=', True),
|
|
||||||
('state', '=', 'done')])
|
|
||||||
if finish_workorder_count > 0 and subcontract_workorder_count > 0:
|
|
||||||
subcontract_workorder = self.env['mrp.workorder'].search(
|
|
||||||
[('production_id', '=', workorder.production_id.id), ('is_subcontract', '=', True),
|
|
||||||
('state', '=', 'done')])
|
|
||||||
for item in subcontract_workorder:
|
|
||||||
order_line_ids = []
|
order_line_ids = []
|
||||||
|
for item in picking_out.workorder_out_id:
|
||||||
server_product = self.env['product.template'].search(
|
server_product = self.env['product.template'].search(
|
||||||
[('server_product_process_parameters_id', '=', item.surface_technics_parameters_id.id),
|
[('server_product_process_parameters_id', '=', item.surface_technics_parameters_id.id),
|
||||||
('categ_type', '=', '服务'), ('detailed_type', '=', 'service')])
|
('detailed_type', '=', 'service')])
|
||||||
|
if server_product:
|
||||||
order_line_ids.append((0, 0, {
|
order_line_ids.append((0, 0, {
|
||||||
'product_id': server_product.product_variant_id.id,
|
'product_id': server_product.product_variant_id.id,
|
||||||
'product_qty': 1,
|
'product_qty': 1,
|
||||||
'product_uom': server_product.uom_id.id
|
'product_uom': server_product.uom_id.id
|
||||||
}))
|
}))
|
||||||
|
else:
|
||||||
|
raise UserError(
|
||||||
|
'请先在产品中配置表面工艺为%s相关的外协服务产品' % item.surface_technics_parameters_id.name)
|
||||||
self.env['purchase.order'].create({
|
self.env['purchase.order'].create({
|
||||||
'partner_id': server_product.seller_ids.partner_id.id,
|
'partner_id': server_product.seller_ids.partner_id.id,
|
||||||
'state': 'draft',
|
'state': 'draft',
|
||||||
'order_line': order_line_ids,
|
'order_line': order_line_ids,
|
||||||
})
|
})
|
||||||
|
super().button_finish()
|
||||||
|
|
||||||
|
|
||||||
class CNCprocessing(models.Model):
|
class CNCprocessing(models.Model):
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from re import findall as regex_findall
|
|||||||
from re import split as regex_split
|
from re import split as regex_split
|
||||||
from odoo import SUPERUSER_ID, _, api, fields, models
|
from odoo import SUPERUSER_ID, _, api, fields, models
|
||||||
from odoo.tools import float_compare
|
from odoo.tools import float_compare
|
||||||
|
import logging
|
||||||
|
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
|
|
||||||
@@ -238,7 +239,8 @@ class StockPicking(models.Model):
|
|||||||
|
|
||||||
# 设置外协出入单的名称
|
# 设置外协出入单的名称
|
||||||
def _get_name_Res(self, rescode):
|
def _get_name_Res(self, rescode):
|
||||||
count = self.env['ir.sequence'].search_count([('prefix', 'like', rescode)])
|
count = self.env['stock.picking'].search_count([('name', 'like', rescode)])
|
||||||
|
logging.info('count:' + str(count))
|
||||||
if not count:
|
if not count:
|
||||||
num = "%04d" % 1
|
num = "%04d" % 1
|
||||||
else:
|
else:
|
||||||
@@ -246,6 +248,21 @@ class StockPicking(models.Model):
|
|||||||
num = "%04d" % m
|
num = "%04d" % m
|
||||||
return '%s%s' % (rescode, num)
|
return '%s%s' % (rescode, num)
|
||||||
|
|
||||||
|
def button_validate(self):
|
||||||
|
if self.workorder_out_id:
|
||||||
|
workorder_in = self.workorder_out_id.filtered(lambda p: p.state == 'progress' and p.is_subcontract is True)
|
||||||
|
if workorder_in:
|
||||||
|
picking_in = self.env['stock.picking'].search([('id', '=', workorder_in.picking_in_id.id)])
|
||||||
|
if picking_in:
|
||||||
|
picking_in.write({'state': 'assigned'})
|
||||||
|
else:
|
||||||
|
workorder_subcontract = self.workorder_out_id.filtered(
|
||||||
|
lambda p: p.state == 'pending' and p.is_subcontract is True)
|
||||||
|
if workorder_subcontract:
|
||||||
|
raise UserError(_('该出库单对应的工单还未开始,不能进行验证操作!'))
|
||||||
|
res = super().button_validate()
|
||||||
|
return res
|
||||||
|
|
||||||
# 创建 外协出库入单
|
# 创建 外协出库入单
|
||||||
def create_outcontract_picking(self, sorted_workorders_arr, item):
|
def create_outcontract_picking(self, sorted_workorders_arr, item):
|
||||||
m = 0
|
m = 0
|
||||||
@@ -285,6 +302,7 @@ class ReStockMove(models.Model):
|
|||||||
_inherit = 'stock.move'
|
_inherit = 'stock.move'
|
||||||
|
|
||||||
def _get_new_picking_values_Res(self, item, sorted_workorders, rescode):
|
def _get_new_picking_values_Res(self, item, sorted_workorders, rescode):
|
||||||
|
logging.info('new_picking-rescode: %s' % rescode)
|
||||||
return {
|
return {
|
||||||
'name': self.env['stock.picking']._get_name_Res(rescode),
|
'name': self.env['stock.picking']._get_name_Res(rescode),
|
||||||
'origin': item.name,
|
'origin': item.name,
|
||||||
@@ -295,5 +313,6 @@ class ReStockMove(models.Model):
|
|||||||
'picking_type_id': self.mapped('picking_type_id').id,
|
'picking_type_id': self.mapped('picking_type_id').id,
|
||||||
'location_id': self.mapped('location_id').id,
|
'location_id': self.mapped('location_id').id,
|
||||||
'location_dest_id': self.mapped('location_dest_id').id,
|
'location_dest_id': self.mapped('location_dest_id').id,
|
||||||
'state': 'draft',
|
'state': 'confirmed',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
""",
|
""",
|
||||||
'category': 'sf',
|
'category': 'sf',
|
||||||
'website': 'https://www.sf.jikimo.com',
|
'website': 'https://www.sf.jikimo.com',
|
||||||
'depends': ['sale', 'sale_management'],
|
'depends': ['sale', 'sale_management', 'web_widget_model_viewer'],
|
||||||
'data': [
|
'data': [
|
||||||
'views/sale_order_view.xml'
|
'views/sale_order_view.xml'
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from odoo import models, fields
|
from odoo import models, fields
|
||||||
import datetime
|
import datetime
|
||||||
|
import base64
|
||||||
|
|
||||||
|
|
||||||
class ReSaleOrder(models.Model):
|
class ReSaleOrder(models.Model):
|
||||||
@@ -48,7 +49,7 @@ class ReSaleOrder(models.Model):
|
|||||||
product.materials_id.name),
|
product.materials_id.name),
|
||||||
'price_unit': product.list_price,
|
'price_unit': product.list_price,
|
||||||
'product_uom_qty': item['number'],
|
'product_uom_qty': item['number'],
|
||||||
# 'model_glb_file': product.model_file,
|
'model_glb_file': base64.b64decode(item['model_file']),
|
||||||
}
|
}
|
||||||
return self.env['sale.order.line'].create(vals)
|
return self.env['sale.order.line'].create(vals)
|
||||||
|
|
||||||
@@ -56,5 +57,5 @@ class ReSaleOrder(models.Model):
|
|||||||
class ResaleOrderLine(models.Model):
|
class ResaleOrderLine(models.Model):
|
||||||
_inherit = 'sale.order.line'
|
_inherit = 'sale.order.line'
|
||||||
|
|
||||||
model_glb_file = fields.Binary('模型的glb文件', related='product_id.model_file')
|
model_glb_file = fields.Binary('模型的glb文件')
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,10 @@
|
|||||||
<field name="payment_term_id" position="after">
|
<field name="payment_term_id" position="after">
|
||||||
<field name="deadline_of_delivery"/>
|
<field name="deadline_of_delivery"/>
|
||||||
</field>
|
</field>
|
||||||
|
<xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="before">
|
||||||
|
<field name="model_glb_file" widget="Viewer3D" optional="show"
|
||||||
|
string="模型文件"/>
|
||||||
|
</xpath>
|
||||||
<xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="replace">
|
<xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="replace">
|
||||||
<field name="name" widget="section_and_note_text" optional="show"
|
<field name="name" widget="section_and_note_text" optional="show"
|
||||||
string="参数说明(长/宽/高/体积/精度/材质)"/>
|
string="参数说明(长/宽/高/体积/精度/材质)"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user