Merge branch 'develop' into feature/sf品牌页面表格样式的修改
This commit is contained in:
@@ -339,7 +339,7 @@ class MrpProduction(models.Model):
|
||||
current_sequence += 1
|
||||
if work.name == '获取CNC加工程序':
|
||||
work.button_start()
|
||||
#work.fetchCNC()
|
||||
# work.fetchCNC()
|
||||
|
||||
# 创建工单并进行排序
|
||||
def _create_workorder(self):
|
||||
|
||||
@@ -7,7 +7,7 @@ from odoo.exceptions import ValidationError, UserError
|
||||
import requests
|
||||
import json
|
||||
from re import findall as regex_findall
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
from re import split as regex_split
|
||||
from odoo import SUPERUSER_ID, _, api, fields, models
|
||||
from odoo.tools import float_compare
|
||||
@@ -154,6 +154,7 @@ class StockRule(models.Model):
|
||||
'''创建制造订单'''
|
||||
productions = self.env['mrp.production'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create(
|
||||
productions_values)
|
||||
|
||||
self.env['stock.move'].sudo().create(productions._get_moves_raw_values())
|
||||
self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
|
||||
'''
|
||||
@@ -188,6 +189,30 @@ class StockRule(models.Model):
|
||||
'mail.message_origin_link',
|
||||
values={'self': production, 'origin': origin_production},
|
||||
subtype_id=self.env.ref('mail.mt_note').id)
|
||||
'''
|
||||
创建生产计划
|
||||
'''
|
||||
# 工单耗时
|
||||
workorder_duration = 0
|
||||
for workorder in production.workorder_ids:
|
||||
workorder_duration += workorder.duration_expected
|
||||
|
||||
|
||||
sale_order = self.env['sale.order'].sudo().search([('name', '=', production.origin)])
|
||||
if sale_order:
|
||||
bb = sale_order.deadline_of_delivery
|
||||
productions = self.env['sf.production.plan'].with_user(SUPERUSER_ID).sudo().with_company(company_id).\
|
||||
create({
|
||||
'name': production.name,
|
||||
'production_id': production.id,
|
||||
'date_planned_start': production.date_planned_start,
|
||||
'origin': production.origin,
|
||||
'product_qty': production.product_qty,
|
||||
'product_id': production.product_id.id,
|
||||
'state': 'draft',
|
||||
})
|
||||
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@@ -472,3 +497,22 @@ class ReStockMove(models.Model):
|
||||
item.product_id.write({'register_state': '注册失败'})
|
||||
except Exception as e:
|
||||
raise UserError("注册刀具到云端失败,请联系管理员!")
|
||||
|
||||
|
||||
class ReStockQuant(models.Model):
|
||||
_inherit = 'stock.quant'
|
||||
|
||||
def action_apply_inventory(self):
|
||||
inventory_diff_quantity = self.inventory_diff_quantity
|
||||
super(ReStockQuant, self).action_apply_inventory()
|
||||
if inventory_diff_quantity >= 1:
|
||||
stock = self.env['stock.move'].search([('product_id', '=', self.product_id.id), ('is_inventory', '=', True),
|
||||
('reference', '=', '更新的产品数量'), ('state', '=', 'done')],
|
||||
limit=1, order='id desc')
|
||||
if self.product_id.categ_type == '夹具':
|
||||
stock._register_fixture()
|
||||
elif self.product_id.categ_type == '刀具':
|
||||
stock._register_cutting_tool()
|
||||
return True
|
||||
|
||||
|
||||
|
||||
@@ -20,8 +20,10 @@
|
||||
<xpath expr="//field[@name='product_qty']" position="after">
|
||||
<field name="product_uom_id" string="计量单位" options="{'no_open':True,'no_create':True}" groups="uom.group_uom" optional="show"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='date_planned_start']" position="after">
|
||||
<field name="date_deadline" widget="remaining_days" attrs="{'invisible': [('state', 'in', ['done', 'cancel'])]}" optional="show"/>
|
||||
<xpath expr="//field[@name='date_planned_start']" position="replace">
|
||||
<field name="date_planned_start" optional="show"/>
|
||||
<field name="date_planned_finished" string="计划结束时间"/>
|
||||
<!-- <field name="date_deadline" widget="remaining_days" attrs="{'invisible': [('state', 'in', ['done', 'cancel'])]}" optional="show"/> -->
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='production_real_duration']" position="after">
|
||||
<field name="reservation_state" optional="hide" decoration-danger="reservation_state == 'confirmed'" decoration-success="reservation_state == 'assigned'"/>
|
||||
@@ -40,7 +42,64 @@
|
||||
decoration-warning="reservation_state != 'assigned' and components_availability_state in ('expected', 'available')"
|
||||
decoration-danger="reservation_state != 'assigned' and components_availability_state == 'late'"/>
|
||||
</xpath>
|
||||
<!-- <xpath expr="//field[@name='state']" position="after"> -->
|
||||
<!-- <button name="action_view_production_schedule" string="生产排程" type="object" attrs="{'invisible': [('state', 'in', ['draft', 'cancel','已排程','progress','done','to_close'])]}"/> -->
|
||||
<!-- <button name="cancel_plan" string="取消排程" type="object" attrs="{'invisible': [('state', 'in', ['draft', 'cancel','progress','done','to_close','confirmed'])]}"/> -->
|
||||
<!-- </xpath> -->
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- <record id="custom_mrp_production_form_view" model="ir.ui.view"> -->
|
||||
<!-- <field name="name">custom.mrp.production.form</field> -->
|
||||
<!-- <field name="model">mrp.production</field> -->
|
||||
<!-- <field name="inherit_id" ref="mrp.mrp_production_form_view"/> -->
|
||||
<!-- <field name="arch" type="xml"> -->
|
||||
<!-- <xpath expr="//header//field[@name='state']" position="replace"> -->
|
||||
<!-- <field name="state" widget="statusbar" statusbar_visible="draft,confirmed,已排程,progress,done"/> -->
|
||||
<!-- </xpath> -->
|
||||
<!-- <xpath expr="//header" position="inside"> -->
|
||||
<!-- <button name="action_view_production_schedule" string="生产排程" type="object" attrs="{'invisible': [('state', 'in', ['draft', 'cancel','已排程','progress','done','to_close'])]}"/> -->
|
||||
<!-- <button name="cancel_plan" string="取消排程" type="object" attrs="{'invisible': [('state', 'in', ['draft', 'cancel','progress','done','to_close','confirmed'])]}"/> -->
|
||||
<!-- </xpath> -->
|
||||
<!-- <xpath expr="//sheet//group//group//field[@name='product_id']" position="after"> -->
|
||||
<!-- <field name="production_line_id"/> -->
|
||||
<!-- <field name="date_planned_finished" string="计划结束时间"/> -->
|
||||
<!-- </xpath> -->
|
||||
<!-- <xpath expr="//sheet//group//group//field[@name='date_planned_start']" position="after"> -->
|
||||
<!-- <field name="date_planned_finished"/> -->
|
||||
<!-- </xpath> -->
|
||||
<!-- </field> -->
|
||||
<!-- </record> -->
|
||||
|
||||
<record id="custom_view_mrp_production_filter" model="ir.ui.view">
|
||||
<field name="name">custom.mrp.production.select</field>
|
||||
<field name="model">mrp.production</field>
|
||||
<field name="inherit_id" ref="mrp.view_mrp_production_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//search" position="inside">
|
||||
<searchpanel class="account_root">
|
||||
<field name="state" icon="fa-filter"/>
|
||||
</searchpanel>
|
||||
</xpath>
|
||||
<filter name='todo' position="replace"/>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- <xpath expr="//filter[@name='filter_draft']" position="after"> -->
|
||||
<!-- <filter string="已完成" name="filter_done" domain="[('state', '=', 'done')]"/> -->
|
||||
<!-- </xpath> -->
|
||||
<!-- <xpath expr="//filter[@name='filter_draft']" position="after"> -->
|
||||
<!-- <filter string="已取消" name="filter_cancel" domain="[('state', '=', 'cancel')]"/> -->
|
||||
<!-- </xpath> -->
|
||||
<!-- <xpath expr="//filter[@name='filter_draft']" position="after"> -->
|
||||
<!-- <filter string="进行中" name="filter_progress" domain="[('state', '=', 'progress')]"/> -->
|
||||
<!-- </xpath> -->
|
||||
<!-- <xpath expr="//filter[@name='filter_draft']" position="after"> -->
|
||||
<!-- <filter string="已确认" name="filter_confirmed" domain="[('state', '=', 'confirmed')]"/> -->
|
||||
<!-- </xpath> -->
|
||||
<!-- <xpath expr="//filter[@name='filter_draft']" position="after"> -->
|
||||
<!-- <filter string="草稿" name="filter_draft" domain="[('state', '=', 'draft')]"/> -->
|
||||
<!-- </xpath> -->
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user