Compare commits
6 Commits
feature/新增
...
feature/优化
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba955ca658 | ||
|
|
ccbe311c58 | ||
|
|
4c58f4d7f3 | ||
|
|
b5a3815f1f | ||
|
|
988c4a460d | ||
|
|
c050e2f11a |
@@ -79,6 +79,7 @@
|
||||
<field name="name" string="日常机床保养"/>
|
||||
<field name="created_user_id" string="创建人"/>
|
||||
<field name="maintenance_equipment_category_id" string="设备类别"/>
|
||||
<filter name="filter_active" string="已归档" domain="[('active','=',False)]"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -222,7 +222,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
material_width = fields.Float(string='宽')
|
||||
material_height = fields.Float(string='高')
|
||||
# 零件图号
|
||||
part_number = fields.Char(string='零件图号')
|
||||
part_number = fields.Char(related='production_id.part_number', string='零件图号')
|
||||
# 工序状态
|
||||
process_state = fields.Selection([
|
||||
('待装夹', '待装夹'),
|
||||
|
||||
@@ -267,6 +267,11 @@ class StockRule(models.Model):
|
||||
workorder_duration += workorder.duration_expected
|
||||
|
||||
sale_order = self.env['sale.order'].sudo().search([('name', '=', production.origin)])
|
||||
# 根据销售订单号查询快速订单
|
||||
quick_easy_order = self.env['quick.easy.order'].sudo().search([('sale_order_id', '=', sale_order.id)])
|
||||
if quick_easy_order:
|
||||
production.write({'part_number': quick_easy_order.part_drawing_number,
|
||||
'part_drawing': quick_easy_order.machining_drawings})
|
||||
if sale_order:
|
||||
# sale_order.write({'schedule_status': 'to schedule'})
|
||||
self.env['sf.production.plan'].sudo().with_company(company_id).create({
|
||||
@@ -288,6 +293,7 @@ class StockRule(models.Model):
|
||||
# 为同一个product_id创建一个生产订单名称列表
|
||||
product_id_to_production_names[product_id] = [production.name for production in all_production]
|
||||
for production_item in productions:
|
||||
|
||||
production_programming = self.env['mrp.production'].search(
|
||||
[('product_id.id', '=', production_item.product_id.id),
|
||||
('origin', '=', production_item.origin)],
|
||||
|
||||
@@ -58,6 +58,15 @@ class QuickEasyOrder(models.Model):
|
||||
|
||||
part_drawing_number = fields.Char('零件图号')
|
||||
machining_drawings = fields.Binary('2D加工图纸')
|
||||
machining_drawings_name = fields.Char('2D加工图纸名')
|
||||
|
||||
@api.onchange('machining_drawings_name')
|
||||
def _onchange_machining_drawings_name(self):
|
||||
for item in self:
|
||||
if item.machining_drawings_name:
|
||||
if not item.machining_drawings_name.lower().endswith(
|
||||
'.pdf'):
|
||||
raise ValidationError('文件格式上传有误,请检查文件后缀(不区分大小写)是否为pdf')
|
||||
|
||||
@api.onchange('parameter_ids')
|
||||
def _compute_parameter_ids(self):
|
||||
@@ -128,6 +137,10 @@ class QuickEasyOrder(models.Model):
|
||||
if len(item.upload_model_file) > 1:
|
||||
raise ValidationError('只允许上传一个文件')
|
||||
if item.upload_model_file:
|
||||
if not item.upload_model_file.name.lower().endswith(
|
||||
'.step') and not item.upload_model_file.name.lower().endswith(
|
||||
'.stp'):
|
||||
raise ValidationError('文件格式上传有误,请检查文件后缀(不区分大小写)是否为step、stp')
|
||||
file_attachment_id = item.upload_model_file[0]
|
||||
# 附件路径
|
||||
report_path = file_attachment_id._full_path(file_attachment_id.store_fname)
|
||||
|
||||
@@ -80,7 +80,8 @@
|
||||
<field name="unit_price"/>
|
||||
<field name="price" options="{'format': false}"/>
|
||||
<field name="part_drawing_number"/>
|
||||
<field name="machining_drawings" widget="image"/>
|
||||
<field name="machining_drawings" filename="machining_drawings_name" widget="pdf_viewer"/>
|
||||
<field name="machining_drawings_name" invisible="1"/>
|
||||
<field name="sale_order_id"
|
||||
attrs='{"invisible": [("sale_order_id","=",False)],"readonly": [("sale_order_id","!=",False)]}'/>
|
||||
</group>
|
||||
|
||||
@@ -100,8 +100,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<field name="property_supplier_payment_term_id" position="before">
|
||||
<field name="purchase_user_id" context="{'supplier_rank': supplier_rank }"
|
||||
widget="many2one_avatar_user"
|
||||
attrs="{'required' : [('supplier_rank','>', 0)]}"/>
|
||||
widget="many2one_avatar_user"/>
|
||||
</field>
|
||||
<xpath expr="//field[@name='property_account_position_id']" position="attributes">
|
||||
<attribute name="attrs">{'readonly': [('id','!=', False)]}</attribute>
|
||||
|
||||
Reference in New Issue
Block a user