Compare commits
130 Commits
feature/零件
...
feature/mr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80f259651c | ||
|
|
1c57ee0be1 | ||
|
|
c732bbad62 | ||
|
|
5285fcd066 | ||
|
|
d318d8cb32 | ||
|
|
5b9dc05653 | ||
|
|
a513592b21 | ||
|
|
e686ea9469 | ||
|
|
651918c51c | ||
|
|
7b13dfcc0e | ||
|
|
60e139d5e0 | ||
|
|
8d5ea0ae19 | ||
|
|
d7597359ba | ||
|
|
f8309bfaba | ||
|
|
7ed756f922 | ||
|
|
e837b84a50 | ||
|
|
e7cb100ab1 | ||
|
|
d00c9dd38c | ||
|
|
1d857be16a | ||
|
|
5914e4ca6e | ||
|
|
d96970fb96 | ||
|
|
0af9064fce | ||
|
|
21148ae74b | ||
|
|
1a3590b6b6 | ||
|
|
b55c6c1fe7 | ||
|
|
8c61dcac29 | ||
|
|
41d4e9785f | ||
|
|
5bf86930e9 | ||
|
|
7ad9885377 | ||
|
|
71433c18b7 | ||
|
|
4b60ad307b | ||
|
|
1a5c8e5f56 | ||
|
|
8b1e12eb9f | ||
|
|
dbf2257a88 | ||
|
|
f34c01d1b0 | ||
|
|
9c73062593 | ||
|
|
878fef18df | ||
|
|
8348c4fc48 | ||
|
|
8643fb2385 | ||
|
|
77744e75d7 | ||
|
|
4cbcf08da8 | ||
|
|
af2a589679 | ||
|
|
4b6f04aa9d | ||
|
|
4634d43012 | ||
|
|
dd6e8b6707 | ||
|
|
55337815c7 | ||
|
|
0ccb7cb3d1 | ||
|
|
d2155b17b4 | ||
|
|
11a5217430 | ||
|
|
855e0eb1c2 | ||
|
|
6312bb988a | ||
|
|
fe9548a0d1 | ||
|
|
0347eb48e4 | ||
|
|
0aae15cbce | ||
|
|
5a7d70fb6b | ||
|
|
8ea8bf1f48 | ||
|
|
df78019226 | ||
|
|
6ad945b720 | ||
|
|
3285d4da57 | ||
|
|
60539462a0 | ||
|
|
81b425ae0c | ||
|
|
33fabc068a | ||
|
|
db4dd33709 | ||
|
|
4acb0fa0ba | ||
|
|
c5ad94c5f3 | ||
|
|
43c6686240 | ||
|
|
5c35eae859 | ||
|
|
fde28bed8a | ||
|
|
16ae845ad9 | ||
|
|
e10648ad07 | ||
|
|
d2b02bb6f7 | ||
|
|
0e1c44c3ac | ||
|
|
5ffbe4c6fc | ||
|
|
5ae167c133 | ||
|
|
0702e1dd51 | ||
|
|
e861897527 | ||
|
|
3bb909c2ee | ||
|
|
da19b86bf5 | ||
|
|
dc318769af | ||
|
|
311b95bca5 | ||
|
|
80118b61c2 | ||
|
|
94d0c14e1f | ||
|
|
3f6f9bb709 | ||
|
|
49a1ec353a | ||
|
|
b89cfb899b | ||
|
|
0ff0cc5fbd | ||
|
|
37173968fd | ||
|
|
470482b7e2 | ||
|
|
5b51cc3de4 | ||
|
|
9e939467e5 | ||
|
|
b05492615f | ||
|
|
32ed0e9693 | ||
|
|
623ebe3ec3 | ||
|
|
da06688571 | ||
|
|
c01451336d | ||
|
|
2db5068e85 | ||
|
|
c955953335 | ||
|
|
9220c4b7c4 | ||
|
|
70b21c607e | ||
|
|
4fe7300ec0 | ||
|
|
282458c945 | ||
|
|
f6e87493d3 | ||
|
|
e141f0af2c | ||
|
|
4618c83b2f | ||
|
|
e89400f04e | ||
|
|
051f8128e9 | ||
|
|
8f61f258b1 | ||
|
|
a864845d2b | ||
|
|
a6a2e53111 | ||
|
|
a11329eaf8 | ||
|
|
d571b77915 | ||
|
|
24897f07f8 | ||
|
|
53779b89a7 | ||
|
|
a1a94867f0 | ||
|
|
0a666f568d | ||
|
|
ad8ec770b6 | ||
|
|
3cc3c48ab3 | ||
|
|
f5da36a82c | ||
|
|
da489555b0 | ||
|
|
29337bfceb | ||
|
|
ef0d05a29d | ||
|
|
b8bec37e15 | ||
|
|
dedc820b50 | ||
|
|
2ccedc95f2 | ||
|
|
b276f616e5 | ||
|
|
cb645aa1b9 | ||
|
|
2409dab8b0 | ||
|
|
e8fc38e6ed | ||
|
|
52e585e637 | ||
|
|
05dac9fb0c |
@@ -1,6 +1,6 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * purchase_request
|
||||
# * jikimo_purchase_request
|
||||
#
|
||||
# Translators:
|
||||
# Jeffery Chen Fan <jeffery9@gmail.com>, 2016
|
||||
@@ -614,7 +614,7 @@ msgstr "手动开票"
|
||||
#. module: purchase_request
|
||||
#: model:ir.model.fields,field_description:purchase_request.field_purchase_request_line_make_purchase_order__sync_data_planned
|
||||
msgid "Match existing PO lines by Scheduled Date"
|
||||
msgstr ""
|
||||
msgstr "仅匹配计划日期相同的采购订单行"
|
||||
|
||||
#. module: purchase_request
|
||||
#: model:ir.model.fields,field_description:purchase_request.field_purchase_request__message_has_error
|
||||
@@ -862,7 +862,7 @@ msgstr "采购申请 %s 已完成"
|
||||
#: code:addons/purchase_request/wizard/purchase_request_line_make_purchase_order.py:0
|
||||
#, python-format
|
||||
msgid "Purchase Request %s is not approved or in progress"
|
||||
msgstr "采购申请 %s 未获批准或在进行中"
|
||||
msgstr "采购申请 %s 状态非已批准或进行中"
|
||||
|
||||
#. module: purchase_request
|
||||
#: model:ir.model,name:purchase_request.model_purchase_request_allocation
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<record id="view_purchase_request_form_sf" model="ir.ui.view">
|
||||
<field name="name">purchase.request.sf.form</field>
|
||||
<field name="model">purchase.request</field>
|
||||
<field name="inherit_id" ref="purchase_request.view_purchase_request_form" />
|
||||
<field name="inherit_id" ref="purchase_request.view_purchase_request_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//button[@name='button_draft']" position="attributes">
|
||||
<attribute name="string">重置草稿</attribute>
|
||||
@@ -21,19 +21,20 @@
|
||||
<record id="view_purchase_request_line_tree_sf" model="ir.ui.view">
|
||||
<field name="name">purchase.request.line.sf.tree</field>
|
||||
<field name="model">purchase.request.line</field>
|
||||
<field name="inherit_id" ref="purchase_request.purchase_request_line_tree" />
|
||||
<field name="inherit_id" ref="purchase_request.purchase_request_line_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='requested_by']" position="replace">
|
||||
<field name="supply_method"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='assigned_to']" position="replace">
|
||||
<xpath expr="//field[@name='assigned_to']" position="attributes">
|
||||
<attribute name="invisible">True</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='name']" position="attributes">
|
||||
<attribute name="invisible">True</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='supplier_id']" position="after">
|
||||
<field name="requested_by" widget="many2one_avatar_user"/>
|
||||
<field name="assigned_to" widget="many2one_avatar_user"/>
|
||||
<field name="assigned_to" widget="many2one_avatar_user" invisible="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='purchased_qty']" position="attributes">
|
||||
<attribute name="string">采购数量</attribute>
|
||||
@@ -44,7 +45,7 @@
|
||||
<xpath expr="//field[@name='product_id']" position="after">
|
||||
<field name="related_product"/>
|
||||
<field name="part_number"/>
|
||||
<field name="part_name"/>
|
||||
<field name="part_name" invisible="1"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
@@ -52,7 +53,7 @@
|
||||
<record id="view_purchase_request_line_search_sf" model="ir.ui.view">
|
||||
<field name="name">purchase.request.line.sf.search</field>
|
||||
<field name="model">purchase.request.line</field>
|
||||
<field name="inherit_id" ref="purchase_request.purchase_request_line_search" />
|
||||
<field name="inherit_id" ref="purchase_request.purchase_request_line_search"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='product_id']" position="after">
|
||||
<field name="supply_method"/>
|
||||
|
||||
@@ -86,7 +86,21 @@ class PurchaseRequestLineMakePurchaseOrder(models.TransientModel):
|
||||
"context": False,
|
||||
"type": "ir.actions.act_window",
|
||||
}
|
||||
|
||||
|
||||
def _check_valid_request_line(self, request_line_ids):
|
||||
for line in self.env["purchase.request.line"].browse(request_line_ids):
|
||||
if line.request_id.state not in ["approved", "in_progress"]:
|
||||
raise UserError(
|
||||
_("采购申请 %s 未审批或未进行中")
|
||||
% line.request_id.name
|
||||
)
|
||||
super(PurchaseRequestLineMakePurchaseOrder, self)._check_valid_request_line(request_line_ids)
|
||||
|
||||
@api.model
|
||||
def check_group(self, request_lines):
|
||||
# 去掉合并必须同一采购组的限制
|
||||
pass
|
||||
|
||||
|
||||
class PurchaseRequestLineMakePurchaseOrderItem(models.TransientModel):
|
||||
_inherit = "purchase.request.line.make.purchase.order.item"
|
||||
|
||||
17472
jikimo_purchase_tier_validation/i18n/zh_CN.po
Normal file
17472
jikimo_purchase_tier_validation/i18n/zh_CN.po
Normal file
File diff suppressed because it is too large
Load Diff
@@ -9,5 +9,6 @@ class MrpBom(models.Model):
|
||||
|
||||
# 成品的供应商从模板中获取
|
||||
if product_type == 'product':
|
||||
bom_id.subcontractor_id = product.product_tmpl_id.seller_ids.partner_id.id
|
||||
if product.product_tmpl_id.seller_ids:
|
||||
bom_id.subcontractor_id = product.product_tmpl_id.seller_ids[-1].partner_id.id
|
||||
return bom_id
|
||||
|
||||
@@ -130,7 +130,7 @@ class QualityPoint(models.Model):
|
||||
|
||||
class QualityCheck(models.Model):
|
||||
_inherit = "quality.check"
|
||||
part_name = fields.Char('零件名称', related='product_id.part_name')
|
||||
part_name = fields.Char('零件名称', related='product_id.part_name', readonly=False, store=True)
|
||||
part_number = fields.Char('零件图号', related='product_id.part_number', readonly=False, store=True)
|
||||
material_name = fields.Char('材料名称', compute='_compute_material_name')
|
||||
|
||||
@@ -206,7 +206,15 @@ class QualityCheck(models.Model):
|
||||
('NG', 'NG')
|
||||
], string='出厂检验报告结果', default='OK')
|
||||
measure_operator = fields.Many2one('res.users', string='操机员')
|
||||
quality_manager = fields.Many2one('res.users', string='质检员')
|
||||
quality_manager = fields.Many2one('res.users', string='质检员', compute='_compute_quality_manager', store=True)
|
||||
|
||||
@api.depends('measure_line_ids')
|
||||
def _compute_quality_manager(self):
|
||||
for record in self:
|
||||
if record.measure_line_ids:
|
||||
record.quality_manager = record.env.user.id
|
||||
else:
|
||||
record.quality_manager = False
|
||||
|
||||
# 流水号(从1开始,最大99)
|
||||
serial_number = fields.Integer('流水号', default=1, readonly=True)
|
||||
@@ -336,7 +344,6 @@ class QualityCheck(models.Model):
|
||||
|
||||
# 7. 更新其他信息
|
||||
self.serial_number += 1
|
||||
self.quality_manager = self.env.user.id
|
||||
|
||||
if self.publish_status == 'canceled' and self.picking_id.state == 'done':
|
||||
self.upload_factory_report()
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<field name="model">quality.check.measure.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom" class="measureTable">
|
||||
<field name="sequence" class="measureTableSequence"/>
|
||||
<!-- <field name="sequence" class="measureTableSequence"/> -->
|
||||
<!-- <field name="column_nums"/> -->
|
||||
<field name="measure_item"/>
|
||||
<field name="measure_value1" attrs="{ 'column_invisible': [('parent.column_nums', '<', 1)] }"/>
|
||||
|
||||
@@ -271,9 +271,9 @@
|
||||
<field name="part_number" attrs="{'invisible': [('categ_type', '!=', '成品')], 'readonly': [('publish_status', '=', 'published')]}"/>
|
||||
<field name="material_name" attrs="{'invisible': [('categ_type', '!=', '成品')]}"/>
|
||||
<field name="total_qty" attrs="{'invisible': ['|', ('measure_on', '!=', 'product'), ('is_out_check', '=', False)]}"/>
|
||||
<field name="check_qty" attrs="{'invisible': [('measure_on', '!=', 'product')], 'readonly': [('publish_status', '=', 'published')]}"/>
|
||||
<field name="check_qty" attrs="{'invisible': ['|', ('measure_on', '!=', 'product'), ('is_out_check', '=', False)], 'readonly': [('publish_status', '=', 'published')]}"/>
|
||||
<!-- <field name="categ_type"/> -->
|
||||
<field name="report_number_id"/>
|
||||
<field name="report_number_id" attrs="{'invisible': ['|', ('measure_on', '!=', 'product'), ('is_out_check', '=', False)]}"/>
|
||||
<field name="column_nums" invisible="1"/>
|
||||
<field name="publish_status" invisible="1"/>
|
||||
<field name="show_lot_text" invisible="1"/>
|
||||
@@ -320,7 +320,7 @@
|
||||
<field name="team_id"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<field name="user_id" string="Control Person" invisible="1"/>
|
||||
<field name="measure_operator" string="操机员" attrs="{'readonly': [('publish_status', '=', 'published')]}"/>
|
||||
<field name="measure_operator" string="操机员" attrs="{'invisible': ['|', ('measure_on', '!=', 'product'), ('is_out_check', '=', False)], 'readonly': [('publish_status', '=', 'published')]}"/>
|
||||
|
||||
</group>
|
||||
</group>
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
<field name="lot_id" position="after">
|
||||
<field name="workorder_id" invisible="1"/>
|
||||
<field name="production_id" invisible="1"/>
|
||||
<field name="finished_lot_id" attrs="{'invisible': [('finished_lot_id', '=', False)]}" groups="stock.group_production_lot"/>
|
||||
<!-- <field name="finished_lot_id" attrs="{'invisible': [('finished_lot_id', '=', False)]}" groups="stock.group_production_lot"/> -->
|
||||
</field>
|
||||
<xpath expr="//field[@name='lot_id']" position="after">
|
||||
<field name="lot_id" attrs="{'invisible': [('workorder_id', '=', False)]}" groups="stock.group_production_lot" string="Component Lot/Serial"/>
|
||||
|
||||
@@ -32,6 +32,7 @@ class FixtureModel(models.Model):
|
||||
multi_mounting_type_id = fields.Many2one('sf.multi_mounting.type', string="联装类型")
|
||||
brand_id = fields.Many2one('sf.machine.brand', string="品牌")
|
||||
model_file = fields.Binary(string="图片")
|
||||
glb_url = fields.Char(string="图片")
|
||||
status = fields.Boolean('状态')
|
||||
active = fields.Boolean('有效', default=False)
|
||||
|
||||
|
||||
@@ -158,6 +158,8 @@
|
||||
<!-- <field name="upload_model_file" widget="many2many_binary"/>-->
|
||||
<field name="model_file" widget="Viewer3D" string="模型" readonly="1" force_save="1"
|
||||
attrs="{'invisible': [('model_file', '=', False)]}"/>
|
||||
<field name="glb_url" widget="Viewer3D" string="模型" readonly="1" force_save="1"
|
||||
attrs="{'invisible': [('glb_url', '=', False)]}"/>
|
||||
</group>
|
||||
</group>
|
||||
<notebook>
|
||||
|
||||
@@ -29,7 +29,7 @@ class Sf_Bf_Connect(http.Controller):
|
||||
bfm_process_order_list = json.loads(kw['bfm_process_order_list'])
|
||||
order_id = request.env['sale.order'].with_user(request.env.ref("base.user_admin")).sale_order_create(
|
||||
company_id, kw['delivery_name'], kw['delivery_telephone'], kw['delivery_address'],
|
||||
kw['delivery_end_date'], kw['payments_way'], kw['pay_way'])
|
||||
kw['delivery_end_date'], kw['payments_way'], kw['pay_way'], model_display_version=kw.get('model_display_version'))
|
||||
i = 1
|
||||
# 给sale_order的default_code字段赋值
|
||||
aa = request.env['sale.order'].sudo().search([('name', '=', order_id.name)])
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<field name="is_bill" invisible="True"/>
|
||||
<field name="logistics_status" invisible="True"/>
|
||||
<field name="logistics_way" invisible="True"/>
|
||||
<button string="物流下单" name="create_order" type="object" confirm="是否确认物流下单" class="btn-primary"
|
||||
<!-- <button string="物流下单" name="create_order" type="object" confirm="是否确认物流下单" class="btn-primary" -->
|
||||
attrs="{'invisible': ['|', '|', '|', ('check_out', '!=', 'OUT'), ('state', '!=', 'assigned'), ('is_bill', '=', True), ('logistics_way', '=', '自提')]}"/>
|
||||
<button string="获取物流面单" name="get_bill" type="object" confirm="是否获取物流面单" class="btn-primary"
|
||||
attrs="{'invisible': ['|', '|', '|', '|', ('check_out', '!=', 'OUT'), ('state', '!=', 'assigned'), ('logistics_status', '=', '2'), ('is_bill', '=', False), ('logistics_way', '=', '自提')]}"/>
|
||||
|
||||
@@ -44,7 +44,7 @@ class ResProductTemplate(models.Model):
|
||||
else:
|
||||
return self.env.ref('sf_dlm.product_uom_cubic_millimeter')
|
||||
|
||||
# model_file = fields.Binary('模型文件')
|
||||
model_file = fields.Binary('模型文件')
|
||||
|
||||
# 胚料的库存路线设置
|
||||
# def _get_routes(self, route_type):
|
||||
|
||||
@@ -16,15 +16,21 @@
|
||||
<field name='categ_id' class="custom_required" attrs="{'readonly': [('id', '!=', False)]}"/>
|
||||
<field name='is_bfm' invisible="1"/>
|
||||
<field name='categ_type' invisible="1"/>
|
||||
<field name='glb_url' invisible="1"/>
|
||||
<field name='part_name' attrs="{'invisible': [('categ_type', '!=', '成品')]}"/>
|
||||
<field name='part_number' attrs="{'invisible': [('categ_type', '!=', '成品')]}"/>
|
||||
<field name='manual_quotation' attrs="{'invisible':[('upload_model_file', '=', [])]}"/>
|
||||
<field name='manual_quotation' attrs="{'invisible':[('glb_url', '=', False)]}"/>
|
||||
<field name="is_customer_provided" attrs="{'invisible': [('categ_type', 'not in', ['成品', '坯料'])], 'readonly': True}" />
|
||||
<field name="upload_model_file"
|
||||
widget="many2many_binary"
|
||||
attrs="{'invisible': ['|', '|',('categ_type', '!=', '成品'),('categ_type', '=', False),('is_bfm','=', True)]}"/>
|
||||
<field name="model_name" invisible="1"/>
|
||||
<field name="upload_model_file" widget="many2many_binary" attrs="{'invisible': [('upload_model_file', '=', False)]}"/>
|
||||
<field name="model_url"
|
||||
widget="binary_download"
|
||||
filename_field="model_name"
|
||||
attrs="{'invisible': ['|', '|',('categ_type', '!=', '成品'),('categ_type', '=', False),('model_url', '=', False)]}"/>
|
||||
<field name="model_file" widget="Viewer3D" string="模型" readonly="1" force_save="1"
|
||||
attrs="{'invisible': ['|','|', ('categ_type', '!=', '成品'),('categ_type', '=', False),('model_file', '=', False)]}"/>
|
||||
<field name="glb_url" widget="Viewer3D" string="模型" readonly="1" force_save="1"
|
||||
attrs="{'invisible': ['|','|', ('categ_type', '!=', '成品'),('categ_type', '=', False),('glb_url', '=', False)]}"/>
|
||||
<field name='cutting_tool_type' invisible="1"/>
|
||||
<field name="fixture_material_type" invisible="1"/>
|
||||
<field name="embryo_model_type_id" string="模型类型" options="{'no_create': True}"
|
||||
@@ -68,6 +74,7 @@
|
||||
</field>
|
||||
<xpath expr="//field[@name='uom_id']" position="before">
|
||||
<field name="is_manual_processing" attrs="{'invisible': [('categ_type', 'not in', ['成品', '坯料'])], 'readonly': True}" />
|
||||
<field name="auto_machining" attrs="{'invisible': [('categ_type', 'not in', ['成品', '坯料'])], 'readonly': True}" />
|
||||
</xpath>
|
||||
<xpath expr="//label[@for='volume']" position="before">
|
||||
<label for="length" string="尺寸"
|
||||
|
||||
@@ -567,7 +567,7 @@ class Sf_Dashboard_Connect(http.Controller):
|
||||
"""
|
||||
res = {'status': 1, 'message': '成功', 'data': {}}
|
||||
# plan_obj = request.env['sf.production.plan'].sudo()
|
||||
plan_obj = request.env['mrp.production'].sudo()
|
||||
plan_obj = request.env['mrp.workorder'].sudo().search([('routing_type', '=', 'CNC加工')])
|
||||
line_list = ast.literal_eval(kw['line_list'])
|
||||
begin_time_str = kw['begin_time'].strip('"')
|
||||
end_time_str = kw['end_time'].strip('"')
|
||||
@@ -618,7 +618,7 @@ class Sf_Dashboard_Connect(http.Controller):
|
||||
start_time, end_time = time_interval
|
||||
|
||||
orders = plan_obj.search([
|
||||
('production_line_id.name', '=', line),
|
||||
('production_id.production_line_id.name', '=', line),
|
||||
('state', 'in', ['done']),
|
||||
(date_field_name, '>=', start_time.strftime('%Y-%m-%d %H:%M:%S')),
|
||||
(date_field_name, '<=', end_time.strftime('%Y-%m-%d %H:%M:%S')) # 包括结束时间
|
||||
@@ -638,18 +638,18 @@ class Sf_Dashboard_Connect(http.Controller):
|
||||
|
||||
for date in date_list:
|
||||
next_day = date + timedelta(days=1)
|
||||
orders = plan_obj.search([('production_line_id.name', '=', line), ('state', 'in', ['done']),
|
||||
orders = plan_obj.search([('production_id.production_line_id.name', '=', line), ('state', 'in', ['done']),
|
||||
(date_field_name, '>=', date.strftime('%Y-%m-%d 00:00:00')),
|
||||
(date_field_name, '<', next_day.strftime('%Y-%m-%d 00:00:00'))
|
||||
])
|
||||
|
||||
rework_orders = plan_obj.search(
|
||||
[('production_line_id.name', '=', line), ('state', 'in', ['rework']),
|
||||
[('production_id.production_line_id.name', '=', line), ('state', 'in', ['rework']),
|
||||
(date_field_name, '>=', date.strftime('%Y-%m-%d 00:00:00')),
|
||||
(date_field_name, '<', next_day.strftime('%Y-%m-%d 00:00:00'))
|
||||
])
|
||||
not_passed_orders = plan_obj.search(
|
||||
[('production_line_id.name', '=', line), ('state', 'in', ['scrap', 'cancel']),
|
||||
[('production_id.production_line_id.name', '=', line), ('state', 'in', ['scrap', 'cancel']),
|
||||
(date_field_name, '>=', date.strftime('%Y-%m-%d 00:00:00')),
|
||||
(date_field_name, '<', next_day.strftime('%Y-%m-%d 00:00:00'))
|
||||
])
|
||||
@@ -942,7 +942,7 @@ class Sf_Dashboard_Connect(http.Controller):
|
||||
# machine_list = ast.literal_eval(kw['machine_list'])
|
||||
# for item in machine_list:
|
||||
# machine_data = equipment_obj.search([('code', '=', item)])
|
||||
for log in maintenance_logs_obj.search([]):
|
||||
for log in maintenance_logs_obj.search([], order='id desc', limit=30):
|
||||
res['data'].append({
|
||||
'name': log.name,
|
||||
'alarm_time': log.alarm_time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
|
||||
@@ -27,7 +27,8 @@ class JikimoSaleRoutePicking(Sf_Bf_Connect):
|
||||
bfm_process_order_list = json.loads(kw['bfm_process_order_list'])
|
||||
order_id = request.env['sale.order'].with_user(request.env.ref("base.user_admin")).sale_order_create(
|
||||
company_id, kw['delivery_name'], kw['delivery_telephone'], kw['delivery_address'],
|
||||
kw['delivery_end_date'], kw['payments_way'], kw['pay_way'], kw['order_number'], state='draft')
|
||||
kw['delivery_end_date'], kw['payments_way'], kw['pay_way'], kw['order_number'], state='draft',
|
||||
model_display_version=kw.get('model_display_version'))
|
||||
i = 1
|
||||
# 给sale_order的default_code字段赋值
|
||||
# aa = request.env['sale.order'].sudo().search([('name', '=', order_id.name)])
|
||||
|
||||
@@ -5,6 +5,8 @@ import logging
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import traceback
|
||||
|
||||
import requests
|
||||
from itertools import groupby
|
||||
from collections import defaultdict, namedtuple
|
||||
@@ -25,6 +27,7 @@ class MrpProduction(models.Model):
|
||||
maintenance_count = fields.Integer(compute='_compute_maintenance_count', string="Number of maintenance requests")
|
||||
request_ids = fields.One2many('maintenance.request', 'production_id')
|
||||
model_file = fields.Binary('模型文件', related='product_id.model_file')
|
||||
glb_url = fields.Char('模型文件', related='product_id.glb_url')
|
||||
schedule_state = fields.Selection([('未排', '未排'), ('已排', '已排'), ('已完成', '已完成')],
|
||||
string='排程状态', default='未排')
|
||||
work_order_state = fields.Selection([('未排', '未排'), ('已排', '已排'), ('已完成', '已完成')],
|
||||
@@ -256,14 +259,46 @@ class MrpProduction(models.Model):
|
||||
], string='工序状态', default='待装夹')
|
||||
|
||||
# 零件图号
|
||||
part_number = fields.Char('零件图号', related='product_id.part_number', readonly=True)
|
||||
part_number = fields.Char('零件图号', compute='_compute_part_info', store=True)
|
||||
|
||||
# 上传零件图纸
|
||||
part_drawing = fields.Binary('零件图纸', related='product_id.machining_drawings', readonly=True)
|
||||
|
||||
quality_standard = fields.Binary('质检标准', related='product_id.quality_standard', readonly=True)
|
||||
|
||||
part_name = fields.Char(string='零件名称', related='product_id.part_name', readonly=True)
|
||||
part_name = fields.Char(string='零件名称', compute='_compute_part_info', store=True)
|
||||
@api.depends('product_id')
|
||||
def _compute_part_info(self):
|
||||
try:
|
||||
for production_id in self:
|
||||
if production_id.product_id.categ_id.type == '成品':
|
||||
production_id.part_number = production_id.product_id.part_number
|
||||
production_id.part_name = production_id.product_id.part_name
|
||||
elif production_id.product_id.categ_id.type == '坯料':
|
||||
product_name = ''
|
||||
match = re.search(r'(S\d{5}-\d)', production_id.product_id.name)
|
||||
# 如果匹配成功,提取结果
|
||||
if match:
|
||||
product_name = match.group(0)
|
||||
if production_id.sale_order_id:
|
||||
sale_order = production_id.sale_order_id
|
||||
else:
|
||||
sale_order_name = ''
|
||||
match = re.search(r'(S\d+)', production_id.product_id.name)
|
||||
if match:
|
||||
sale_order_name = match.group(0)
|
||||
sale_order = self.env['sale.order'].sudo().search(
|
||||
[('name', '=', sale_order_name)])
|
||||
logging.info("product_name is :%s" % product_name)
|
||||
filtered_order_line = sale_order.order_line.filtered(
|
||||
lambda production: re.search(f'{product_name}$', production.product_id.name)
|
||||
)
|
||||
if filtered_order_line:
|
||||
production_id.part_number = filtered_order_line.part_number
|
||||
production_id.part_name = filtered_order_line.part_name
|
||||
except Exception as e:
|
||||
traceback_error = traceback.format_exc()
|
||||
logging.error("制造订单零件图号 零件名称获取失败:%s" % traceback_error)
|
||||
|
||||
# 判断制造的产品类型
|
||||
production_product_type = fields.Selection([
|
||||
@@ -720,14 +755,16 @@ class MrpProduction(models.Model):
|
||||
'model_order_no': cnc.product_id.default_code,
|
||||
'user': cnc.env.user.name,
|
||||
'programme_way': programme_way,
|
||||
'model_file': '' if not cnc.product_id.model_file else base64.b64encode(
|
||||
cnc.product_id.model_file).decode('utf-8'),
|
||||
# 'model_file': '' if not cnc.product_id.model_file else base64.b64encode(
|
||||
# cnc.product_id.model_file).decode('utf-8'),
|
||||
# 'glb_url': cnc.product_id.glb_url,
|
||||
'part_name': cnc.product_id.part_name,
|
||||
'part_number': cnc.product_id.part_number,
|
||||
'machining_drawings': base64.b64encode(cnc.product_id.machining_drawings).decode(
|
||||
'utf-8') if cnc.product_id.machining_drawings else '',
|
||||
'machining_drawings_name': cnc.product_id.machining_drawings_name,
|
||||
'machining_drawings_mimetype': cnc.product_id.machining_drawings_mimetype,
|
||||
# 'model_id': cnc.product_id.model_id,
|
||||
}
|
||||
# 打印出除了 model_file 之外的所有键值对
|
||||
for key, value in res.items():
|
||||
|
||||
@@ -289,6 +289,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
cmm_ids = fields.One2many("sf.cmm.program", 'workorder_id', string="CMM程序")
|
||||
tray_code = fields.Char(string="托盘编码")
|
||||
glb_file = fields.Binary("glb模型文件", related='production_id.model_file')
|
||||
glb_url = fields.Char("glb模型文件", related='production_id.glb_url')
|
||||
is_subcontract = fields.Boolean(string='是否外协')
|
||||
surface_technics_parameters_id = fields.Many2one('sf.production.process.parameter', string="表面工艺可选参数")
|
||||
|
||||
@@ -735,7 +736,8 @@ class ResMrpWorkOrder(models.Model):
|
||||
local_filename = self.save_name + '.xls'
|
||||
local_file_path = os.path.join(local_dir_path, local_filename)
|
||||
logging.info('local_file_path:%s' % local_file_path)
|
||||
remote_path = '/home/ftp/ftp_root/ThreeTest/XT/Before/' + local_filename
|
||||
# remote_path = '/home/ftp/ftp_root/ThreeTest/XT/Before/' + local_filename
|
||||
remote_path = '/ThreeTest/XT/Before/' + local_filename
|
||||
logging.info('remote_path:%s' % remote_path)
|
||||
is_get_detection_file = self.env['ir.config_parameter'].sudo().get_param('is_get_detection_file')
|
||||
if not is_get_detection_file:
|
||||
@@ -1532,7 +1534,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
# workorder.rfid_code_old = rfid_code
|
||||
# workorder.rfid_code = False
|
||||
logging.info('workorder.rfid_code:%s' % workorder.rfid_code)
|
||||
# if is_production_id is True and record.routing_type in ['解除装夹', '表面工艺', '切割']:
|
||||
|
||||
if is_production_id is True:
|
||||
logging.info('product_qty:%s' % record.production_id.product_qty)
|
||||
for move_raw_id in record.production_id.move_raw_ids:
|
||||
@@ -1547,6 +1549,17 @@ class ResMrpWorkOrder(models.Model):
|
||||
# if raw_move:
|
||||
# raw_move.write({'state': 'done'})
|
||||
if record.production_id.state != 'rework':
|
||||
# 如果工单包含了外协工序,需要预留数量
|
||||
if self.move_raw_ids.move_orig_ids.subcontract_workorder_id:
|
||||
location_id = self.move_raw_ids.location_id
|
||||
quant = self.move_raw_ids.lot_ids.quant_ids.filtered(lambda q: q.location_id.id == location_id.id)
|
||||
if quant.reserved_quantity == 0:
|
||||
self.env['stock.quant']._update_reserved_quantity(
|
||||
self.move_raw_ids.product_id,
|
||||
location_id,
|
||||
quant.quantity,
|
||||
lot_id=quant.lot_id,
|
||||
)
|
||||
record.production_id.button_mark_done1()
|
||||
# record.production_id.state = 'done'
|
||||
|
||||
@@ -1850,7 +1863,7 @@ class CNCprocessing(models.Model):
|
||||
|
||||
# 将FTP的多面的程序单文件下载到临时目录
|
||||
def download_file_tmp(self, production_no, processing_panel):
|
||||
remotepath = os.path.join('/home/ftp/ftp_root/NC', production_no, 'return', processing_panel)
|
||||
remotepath = os.path.join('/', production_no, 'return', processing_panel)
|
||||
serverdir = os.path.join('/tmp', production_no, 'return', processing_panel)
|
||||
ftp_resconfig = self.env['res.config.settings'].get_values()
|
||||
ftp = FtpController(str(ftp_resconfig['ftp_host']), int(ftp_resconfig['ftp_port']), ftp_resconfig['ftp_user'],
|
||||
|
||||
@@ -30,6 +30,7 @@ class ResProductMo(models.Model):
|
||||
model_width = fields.Float('模型宽(mm)', digits=(16, 3))
|
||||
model_height = fields.Float('模型高(mm)', digits=(16, 3))
|
||||
model_volume = fields.Float('模型体积(m³)')
|
||||
model_area = fields.Float('模型表面积(m²)')
|
||||
model_machining_precision = fields.Selection(selection=_get_machining_precision, string='加工精度')
|
||||
model_processing_panel = fields.Char('模型加工面板')
|
||||
model_remark = fields.Char('模型备注说明')
|
||||
@@ -777,11 +778,40 @@ class ResProductMo(models.Model):
|
||||
manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
|
||||
machining_drawings = fields.Binary('2D加工图纸', readonly=True)
|
||||
quality_standard = fields.Binary('质检标准', readonly=True)
|
||||
part_name = fields.Char(string='零件名称', readonly=True)
|
||||
part_number = fields.Char(string='零件图号', readonly=True)
|
||||
part_name = fields.Char(string='零件名称', compute='_compute_related_product', readonly=True, store=True)
|
||||
part_number = fields.Char(string='零件图号', compute='_compute_related_product', readonly=True, store=True)
|
||||
machining_drawings_name = fields.Char(string='零件图号名称', readonly=True)
|
||||
machining_drawings_mimetype = fields.Char(string='零件图号类型', readonly=True)
|
||||
|
||||
model_url = fields.Char('模型文件地址')
|
||||
glb_url = fields.Char('glb文件地址')
|
||||
area = fields.Float('表面积(m²)')
|
||||
auto_machining = fields.Boolean('自动化加工(模型识别)', default=False)
|
||||
model_id = fields.Char('模型id')
|
||||
|
||||
|
||||
@api.depends('name')
|
||||
def _compute_related_product(self):
|
||||
for record in self:
|
||||
if record.categ_id.name == '坯料':
|
||||
product_name = ''
|
||||
match = re.search(r'(S\d{5}-\d)', record.name)
|
||||
# 如果匹配成功,提取结果
|
||||
if match:
|
||||
product_name = match.group(0)
|
||||
sale_order_name = ''
|
||||
match_sale = re.search(r'S(\d+)', record.name)
|
||||
if match_sale:
|
||||
sale_order_name = match_sale.group(0)
|
||||
sale_order = self.env['sale.order'].sudo().search(
|
||||
[('name', '=', sale_order_name)])
|
||||
if sale_order:
|
||||
filtered_order_line = sale_order.order_line.filtered(
|
||||
lambda order_line: re.search(f'{product_name}$', order_line.product_id.name)
|
||||
)
|
||||
record.part_number = filtered_order_line.product_id.part_number if filtered_order_line else None
|
||||
record.part_name = filtered_order_line.product_id.part_name if filtered_order_line else None
|
||||
|
||||
@api.constrains('tool_length')
|
||||
def _check_tool_length_size(self):
|
||||
if self.tool_length > 1000000:
|
||||
@@ -852,7 +882,7 @@ class ResProductMo(models.Model):
|
||||
copy_product_id = product_id.with_user(self.env.ref("base.user_admin")).copy()
|
||||
copy_product_id.product_tmpl_id.active = True
|
||||
model_type = self.env['sf.model.type'].search([], limit=1)
|
||||
attachment = self.attachment_create(item['model_name'], item['model_data'])
|
||||
# attachment = self.attachment_create(item['model_name'], item['model_data'])
|
||||
# 获取坯料冗余配置
|
||||
if not item.get('embryo_redundancy'):
|
||||
embryo_redundancy_id = model_type.embryo_tolerance_id
|
||||
@@ -875,10 +905,14 @@ class ResProductMo(models.Model):
|
||||
'length': item['model_long'],
|
||||
'width': item['model_width'],
|
||||
'height': item['model_height'],
|
||||
'volume': item['model_long'] * item['model_width'] * item['model_height'],
|
||||
'model_file': '' if not item['model_file'] else base64.b64decode(item['model_file']),
|
||||
'model_name': attachment.name if attachment else None,
|
||||
'upload_model_file': [(6, 0, [attachment.id])] if attachment else None,
|
||||
'volume': item['model_volume'],
|
||||
'area': item['model_area'],
|
||||
# 'model_file': '' if not item['model_file'] else base64.b64decode(item['model_file']),
|
||||
'model_url': item['model_url'],
|
||||
'glb_url': item['glb_url'],
|
||||
'model_name': item['model_name'],
|
||||
'auto_machining': item['auto_machining'],
|
||||
# 'upload_model_file': [(6, 0, [attachment.id])] if attachment else None,
|
||||
'list_price': item['price'],
|
||||
'materials_id': self.env['sf.production.materials'].search(
|
||||
[('materials_no', '=', item['texture_code'])]).id,
|
||||
@@ -898,6 +932,7 @@ class ResProductMo(models.Model):
|
||||
'part_name': item.get('part_name') or '',
|
||||
'machining_drawings_name': item.get('machining_drawings_name') or '',
|
||||
'machining_drawings_mimetype': item.get('machining_drawings_mimetype') or '',
|
||||
'model_id': item['model_id'],
|
||||
}
|
||||
tax_id = self.env['account.tax'].sudo().search(
|
||||
[('type_tax_use', '=', 'sale'), ('amount', '=', item.get('tax')), ('price_include', '=', 'True')])
|
||||
@@ -980,15 +1015,14 @@ class ResProductMo(models.Model):
|
||||
vals = {
|
||||
'name': '%s-%s-%s [%s %s-%s * %s * %s]' % ('R',
|
||||
order_id.name, i, materials_id.name, materials_type_id.name,
|
||||
item['model_long'] + embryo_redundancy_id.long,
|
||||
item['model_width'] + embryo_redundancy_id.width,
|
||||
item['model_height'] + embryo_redundancy_id.height),
|
||||
'length': item['model_long'] + embryo_redundancy_id.long,
|
||||
'width': item['model_width'] + embryo_redundancy_id.width,
|
||||
'height': item['model_height'] + embryo_redundancy_id.height,
|
||||
'volume': (item['model_long'] + embryo_redundancy_id.long) * (
|
||||
item['model_width'] + embryo_redundancy_id.width) * (
|
||||
item['model_height'] + embryo_redundancy_id.height),
|
||||
self.format_float(item['model_long'] + embryo_redundancy_id.long),
|
||||
self.format_float(item['model_width'] + embryo_redundancy_id.width),
|
||||
self.format_float(item['model_height'] + embryo_redundancy_id.height)),
|
||||
'length': self.format_float(item['model_long'] + embryo_redundancy_id.long),
|
||||
'width': self.format_float(item['model_width'] + embryo_redundancy_id.width),
|
||||
'height': self.format_float(item['model_height'] + embryo_redundancy_id.height),
|
||||
'volume': self.format_float(item['blank_volume']),
|
||||
'area': self.format_float(item['blank_area']),
|
||||
'embryo_model_type_id': model_type.id,
|
||||
'list_price': item['price'],
|
||||
'materials_id': materials_id.id,
|
||||
@@ -1081,6 +1115,9 @@ class ResProductMo(models.Model):
|
||||
base64_data = base64.b64encode(image_data)
|
||||
return base64_data
|
||||
|
||||
# 增加产品表面积
|
||||
|
||||
|
||||
|
||||
class ResProductFixture(models.Model):
|
||||
_inherit = 'product.template'
|
||||
@@ -1093,6 +1130,7 @@ class ResProductFixture(models.Model):
|
||||
fixture_material_type = fields.Char(string="夹具物料类型", related='fixture_material_id.name')
|
||||
multi_mounting_type_id = fields.Many2one('sf.multi_mounting.type', string="联装类型")
|
||||
model_file = fields.Binary(string="3D模型图")
|
||||
glb_url = fields.Char(string="3D模型图")
|
||||
|
||||
# 夹具物料基本参数
|
||||
diameter = fields.Float('直径(mm)', digits=(16, 2))
|
||||
|
||||
@@ -59,7 +59,7 @@ class QuickEasyOrder(models.Model):
|
||||
product_id = self.env.ref('jikimo_sale_multiple_supply_methods.product_template_default').sudo().with_context(active_test=False).product_variant_id
|
||||
# user_id = request.env.ref('base.user_admin').sudo()
|
||||
order_id = self.env['sale.order'].sale_order_create(company_id, 'XXXXX', 'XXXXX', 'XXXXX',
|
||||
str(datetime.now()), '现结', '支付宝', state='draft')
|
||||
str(datetime.now()), '现结', '支付宝', state='draft', model_display_version='v2')
|
||||
order_id.default_code = obj.name
|
||||
i = 1
|
||||
for item in res['bfm_process_order_list']:
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import logging
|
||||
import json
|
||||
import re
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
@@ -23,6 +25,9 @@ class SaleOrder(models.Model):
|
||||
|
||||
def confirm_to_supply_method(self):
|
||||
self.state = 'supply method'
|
||||
for line in self.order_line:
|
||||
if line.product_id.auto_machining:
|
||||
line.supply_method = 'automation'
|
||||
|
||||
def action_confirm(self):
|
||||
if self._get_forbidden_state_confirm() & set(self.mapped('state')):
|
||||
@@ -57,18 +62,25 @@ class SaleOrder(models.Model):
|
||||
|
||||
order_id = self
|
||||
product = line.product_id
|
||||
# 拼接方法需要的item结构
|
||||
# 拼接方法需要的item结构,成品的模型数据信息就是坯料的数据信息
|
||||
item = {
|
||||
'texture_code': product.materials_id.materials_no,
|
||||
'texture_type_code': product.materials_type_id.materials_no,
|
||||
'model_long': product.length,
|
||||
'model_width': product.width,
|
||||
'model_height': product.height,
|
||||
'blank_volume': product.model_volume,
|
||||
'blank_area': product.model_area,
|
||||
'price': product.list_price,
|
||||
'embryo_redundancy_id': line.embryo_redundancy_id,
|
||||
}
|
||||
product_name = ''
|
||||
match = re.search(r'(S\d{5}-\d)', product.name)
|
||||
# 如果匹配成功,提取结果
|
||||
if match:
|
||||
product_name = match.group(0)
|
||||
# 获取成品名结尾-n的n
|
||||
product_seria = int(product.name.split('-')[-1])
|
||||
product_seria = int(product_name.split('-')[-1])
|
||||
# 成品供货方式为采购则不生成bom
|
||||
if line.supply_method != 'purchase':
|
||||
bom_data = self.env['mrp.bom'].with_user(self.env.ref("base.user_admin")).get_bom(product)
|
||||
@@ -151,7 +163,7 @@ class SaleOrder(models.Model):
|
||||
'purchase',
|
||||
product_seria,
|
||||
product)
|
||||
if purchase_embryo == -3:
|
||||
if purchase_embryo and purchase_embryo == -3:
|
||||
raise UserError('该订单模型的材料型号暂未设置获取方式和供应商,请先配置再进行分配')
|
||||
else:
|
||||
# 产品配置bom
|
||||
@@ -198,3 +210,14 @@ class SaleOrderLine(models.Model):
|
||||
if vals['supply_method'] == 'purchase' and line.is_incoming_material:
|
||||
raise UserError('当前(%s)产品为客供料,不能选择外购' % ','.join(line.mapped('product_id.name')))
|
||||
return super(SaleOrderLine, self).write(vals)
|
||||
|
||||
cancel_auto_machining = fields.Boolean('是否取消自动化加工', compute='_compute_cancel_auto_machining', store=True)
|
||||
cancel_auto_machining_reason = fields.Char('更改供货原因')
|
||||
|
||||
@api.depends('product_id', 'supply_method')
|
||||
def _compute_cancel_auto_machining(self):
|
||||
for line in self:
|
||||
line.cancel_auto_machining = True if line.product_id.auto_machining \
|
||||
and line.supply_method != 'automation' else False
|
||||
|
||||
|
||||
|
||||
@@ -355,9 +355,9 @@ class StockRule(models.Model):
|
||||
)
|
||||
for p in production_process:
|
||||
logging.info('production_process:%s' % p.name)
|
||||
process_parameter = production_item.product_id.model_process_parameters_ids.filtered(
|
||||
process_parameters = production_item.product_id.model_process_parameters_ids.filtered(
|
||||
lambda pm: pm.process_id.id == p.id)
|
||||
if process_parameter:
|
||||
for process_parameter in process_parameters:
|
||||
i += 1
|
||||
route_production_process = self.env[
|
||||
'mrp.routing.workcenter'].search(
|
||||
@@ -688,7 +688,8 @@ class StockPicking(models.Model):
|
||||
# 如果当前工单是是制造订单的最后一个工艺外协工单
|
||||
if workorder == next((workorder for workorder in reversed(sorted_workorders) if workorder.is_subcontract),
|
||||
None):
|
||||
move_dest_id = item.move_raw_ids[0].id
|
||||
if item.move_raw_ids:
|
||||
move_dest_id = item.move_raw_ids[0].id
|
||||
else:
|
||||
# 从sorted_workorders中找到上一工单的move
|
||||
if len(sorted_workorders) > 1:
|
||||
@@ -724,6 +725,7 @@ class StockPicking(models.Model):
|
||||
moves_out._action_confirm()
|
||||
moves_out._assign_picking_post_process(new=new_picking)
|
||||
|
||||
|
||||
@api.depends('move_type', 'immediate_transfer', 'move_ids.state', 'move_ids.picking_id')
|
||||
def _compute_state(self):
|
||||
super(StockPicking, self)._compute_state()
|
||||
@@ -799,7 +801,7 @@ class ReStockMove(models.Model):
|
||||
continue
|
||||
logging.info('制造订单的调拨单 %s', move.origin)
|
||||
production_id = self.env['mrp.production'].sudo().search(
|
||||
[('name', '=', move.origin)], limit=1)
|
||||
[('name', '=', move.origin.split(',')[0] if move.origin else '')], limit=1)
|
||||
if not production_id:
|
||||
continue
|
||||
product_name = ''
|
||||
@@ -847,6 +849,7 @@ class ReStockMove(models.Model):
|
||||
# 'route_ids': False if not route else [(4, route.id)],
|
||||
'date_deadline': datetime.now(),
|
||||
'picking_type_id': picking_type_id,
|
||||
# 'is_subcontract': True,
|
||||
}
|
||||
return move_values
|
||||
|
||||
@@ -1116,6 +1119,13 @@ class ReStockMove(models.Model):
|
||||
if self.state != 'assigned':
|
||||
self.state = 'assigned'
|
||||
return self.action_show_details()
|
||||
|
||||
def _prepare_move_line_vals(self, quantity=None, reserved_quant=None):
|
||||
res = super(ReStockMove, self)._prepare_move_line_vals(quantity, reserved_quant)
|
||||
if self.subcontract_workorder_id:
|
||||
if self.subcontract_workorder_id.production_id.move_raw_ids.move_line_ids:
|
||||
res['lot_id'] = self.subcontract_workorder_id.production_id.move_raw_ids.move_line_ids[0].lot_id.id
|
||||
return res
|
||||
|
||||
|
||||
class ReStockQuant(models.Model):
|
||||
|
||||
@@ -450,7 +450,9 @@
|
||||
</button>
|
||||
</div>
|
||||
<field name="product_id" position="after">
|
||||
<field name="model_file" string="产品模型" readonly="1" widget="Viewer3D"/>
|
||||
<field name="model_file" string="产品模型" readonly="1" widget="Viewer3D" attrs="{'invisible': [('model_file', '=', False)]}"/>
|
||||
<field name="glb_url" widget="Viewer3D" string="模型" readonly="1" force_save="1"
|
||||
attrs="{'invisible': [('glb_url', '=', False)]}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -251,7 +251,8 @@
|
||||
<field name="date_planned_finished" invisible="1"/>
|
||||
<field name="duration" widget="mrp_timer"
|
||||
invisible="1" sum="real duration"/>
|
||||
<field name="glb_file" readonly="1" widget="Viewer3D" string="加工模型"/>
|
||||
<field name="glb_file" readonly="1" widget="Viewer3D" string="加工模型" attrs="{'invisible': [('glb_file', '=', False)]}"/>
|
||||
<field name="glb_url" readonly="1" widget="Viewer3D" string="加工模型" attrs="{'invisible': [('glb_url', '=', False)]}"/>
|
||||
<field name="manual_quotation" readonly="1"
|
||||
attrs="{'invisible': [('routing_type', 'not in', ['CNC加工', '人工线下加工'])]}"/>
|
||||
<field name="processing_panel" readonly="1"
|
||||
|
||||
@@ -18,9 +18,13 @@
|
||||
<xpath expr="//page/field[@name='order_line']/tree/field[@name='remark']" position="before">
|
||||
<field name="supply_method" attrs="{'invisible': [('state', '=', 'draft')], 'required': [('state', '=', 'supply method')]}" />
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='order_line']/tree/field[@name='model_glb_file']" position="before">
|
||||
<xpath expr="//field[@name='order_line']/tree/field[@name='product_template_id']" position="after">
|
||||
<field name="part_number" optional="show" class="section_and_note_text"/>
|
||||
</xpath>
|
||||
</xpath>
|
||||
<!-- <xpath expr="//field[@name='order_line']/tree/field[@name='remark']" position="before"> -->
|
||||
<!-- <field name="cancel_auto_machining" invisible="1"/> -->
|
||||
<!-- <field name="cancel_auto_machining_reason" optional="show" attrs="{'required': [('cancel_auto_machining', '=', True),('state', 'not in', ['draft', 'sent'])]}"/> -->
|
||||
<!-- </xpath> -->
|
||||
|
||||
<!-- <xpath expr="//header/button[@name='action_cancel']" position="attributes"> -->
|
||||
<!-- <attribute name="attrs">{'invisible': [('state', '!=', 'draft')]}</attribute> -->
|
||||
@@ -67,7 +71,7 @@
|
||||
|
||||
<record id="sale.action_quotations_with_onboarding" model="ir.actions.act_window">
|
||||
<field name="search_view_id" ref="jikimo_sale_order_view_search_inherit_quotation_supply_method"/>
|
||||
<field name="context">{'search_default_draft': 1}</field>
|
||||
<field name="context">{'search_default_supply_method': 1}</field>
|
||||
</record>
|
||||
|
||||
<record id="action_quotations_supply_method" model="ir.actions.act_window">
|
||||
|
||||
@@ -191,7 +191,8 @@ class SFMessageWork(models.Model):
|
||||
|
||||
def write(self, vals):
|
||||
res = super(SFMessageWork, self).write(vals)
|
||||
if ('leave_id' in vals and vals['leave_id'] is False or 'date_planned_start' in vals and vals['date_planned_start'] is False) \
|
||||
and self.schedule_state != '未排':
|
||||
self.add_queue('计划数据异常跟踪')
|
||||
for record in self:
|
||||
if ('leave_id' in vals and vals['leave_id'] is False or 'date_planned_start' in vals and vals['date_planned_start'] is False) \
|
||||
and record.schedule_state != '未排':
|
||||
record.add_queue('计划数据异常跟踪')
|
||||
return res
|
||||
|
||||
@@ -48,11 +48,11 @@
|
||||
<div class="col-6">
|
||||
<p>售后服务: <span t-field="o.company_id.phone"/></p>
|
||||
<p>公司名称: <span t-field="o.company_id.name"/></p>
|
||||
<p>公司网址: <span t-field="o.company_id.website"/></p>
|
||||
<p>公司邮箱: <span t-field="o.company_id.email"/></p>
|
||||
<p>加工工厂: <span t-field="o.company_id.factory_name"/></p>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<p>加工工厂: <span t-field="o.company_id.factory_name"/></p>
|
||||
<p>公司网址: <span t-field="o.company_id.website"/></p>
|
||||
<p>公司邮箱: <span t-field="o.company_id.email"/></p>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div style="border-top: 2px solid black;"></div> -->
|
||||
@@ -68,7 +68,7 @@
|
||||
<t t-call="sf_quality.report_quality_header"/>
|
||||
|
||||
|
||||
<div class="page" style="min-height: 800px; position: relative; padding-bottom: 150px;">
|
||||
<div class="page" style="min-height: 800px; position: relative; padding-bottom: 250px;">
|
||||
|
||||
<table class="table table-sm o_main_table mt-4" style="border: 1px solid black;">
|
||||
<tr>
|
||||
|
||||
@@ -26,6 +26,7 @@ class QualityCheck(models.Model):
|
||||
string='生产线')
|
||||
equipment_id = fields.Many2one(related='workorder_id.equipment_id', string='加工设备')
|
||||
model_file = fields.Binary(related='workorder_id.glb_file', string='加工模型')
|
||||
glb_url = fields.Char(related='workorder_id.glb_url', string='加工模型')
|
||||
|
||||
detection_report = fields.Binary(related='workorder_id.detection_report', readonly=True, string='检测报告')
|
||||
test_results = fields.Selection([("合格", "合格"), ("返工", "返工")], string="检测结果",
|
||||
|
||||
@@ -12,6 +12,7 @@ class SfQualityCncTest(models.Model):
|
||||
production_id = fields.Many2one(related='workorder_id.production_id', string='制造订单')
|
||||
product_id = fields.Many2one(related='workorder_id.product_id', string='产品')
|
||||
model_file = fields.Binary(related='workorder_id.glb_file', string='加工模型')
|
||||
glb_url = fields.Char(related='workorder_id.glb_url', string='加工模型')
|
||||
processing_panel = fields.Char(related='workorder_id.processing_panel', string='加工面')
|
||||
equipment_id = fields.Many2one(related='workorder_id.equipment_id', string='加工设备')
|
||||
production_line_id = fields.Many2one(related='workorder_id.production_line_id',
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
<field name="equipment_id" attrs="{'invisible': [('production_id', '=', False)]}"/>
|
||||
<field name="model_file" widget="Viewer3D" string="模型" readonly="1" force_save="1"
|
||||
attrs="{'invisible': ['|',('model_file', '=', False), ('production_id', '=', False)]}"/>
|
||||
<field name="glb_url" widget="Viewer3D" string="模型" readonly="1" force_save="1"
|
||||
attrs="{'invisible': ['|',('glb_url', '=', False), ('production_id', '=', False)]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='partner_id']" position="after">
|
||||
<field name="processing_panel" attrs="{'invisible': [('production_id', '=', False)]}"/>
|
||||
|
||||
@@ -87,7 +87,8 @@
|
||||
<field name="product_id"/>
|
||||
<field name="production_line_id"/>
|
||||
<field name="equipment_id"/>
|
||||
<field name="model_file" widget="Viewer3D"/>
|
||||
<field name="model_file" widget="Viewer3D" attrs="{'invisible': [('model_file', '=', False)]}"/>
|
||||
<field name="glb_url" widget="Viewer3D" attrs="{'invisible': [('glb_url', '=', False)]}"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="part_name"/>
|
||||
|
||||
@@ -314,7 +314,7 @@ class QuickEasyOrder(models.Model):
|
||||
company_id = self.env.ref('base.main_company').sudo()
|
||||
# user_id = request.env.ref('base.user_admin').sudo()
|
||||
order_id = self.env['sale.order'].sale_order_create(company_id, 'XXXXX', 'XXXXX', 'XXXXX',
|
||||
str(datetime.now()), '现结', '支付宝')
|
||||
str(datetime.now()), '现结', '支付宝', 'v2')
|
||||
i = 1
|
||||
# 给sale_order的default_code字段赋值
|
||||
aa = self.env['sale.order'].sudo().search([('name', '=', order_id.name)])
|
||||
|
||||
@@ -237,7 +237,7 @@ class QuickEasyOrder(models.Model):
|
||||
company_id = self.env.ref('base.main_company').sudo()
|
||||
# user_id = request.env.ref('base.user_admin').sudo()
|
||||
order_id = self.env['sale.order'].sale_order_create(company_id, 'XXXXX', 'XXXXX', 'XXXXX',
|
||||
str(datetime.now()), '现结', '支付宝')
|
||||
str(datetime.now()), '现结', '支付宝', 'v2')
|
||||
i = 1
|
||||
# 给sale_order的default_code字段赋值
|
||||
aa = self.env['sale.order'].sudo().search([('name', '=', order_id.name)])
|
||||
|
||||
@@ -61,9 +61,12 @@ class ReSaleOrder(models.Model):
|
||||
|
||||
order_code = fields.Char('平台订单号', readonly=True)
|
||||
|
||||
model_display_version = fields.Char('模型展示版本', default="v1")
|
||||
|
||||
# 业务平台分配工厂后在智能工厂先创建销售订单
|
||||
def sale_order_create(self, company_id, delivery_name, delivery_telephone, delivery_address,
|
||||
deadline_of_delivery, payments_way, pay_way, order_number, state='sale'):
|
||||
deadline_of_delivery, payments_way, pay_way, order_number, state='sale',
|
||||
model_display_version='v1'):
|
||||
now_time = datetime.datetime.now()
|
||||
partner = self.get_customer()
|
||||
data = {
|
||||
@@ -80,6 +83,7 @@ class ReSaleOrder(models.Model):
|
||||
'payments_way': payments_way,
|
||||
'pay_way': pay_way,
|
||||
'order_code': order_number,
|
||||
'model_display_version': model_display_version,
|
||||
}
|
||||
if deadline_of_delivery:
|
||||
# deadline_of_delivery字段存在为false字符串情况
|
||||
@@ -138,11 +142,15 @@ class ReSaleOrder(models.Model):
|
||||
product.materials_id.name),
|
||||
'price_unit': product.list_price,
|
||||
'product_uom_qty': item['number'],
|
||||
'model_glb_file': base64.b64decode(item['model_file']) if item['model_file'] else None,
|
||||
# 'model_glb_file': base64.b64decode(item['model_file']) if item['model_file'] else None,
|
||||
'model_url': item['model_url'],
|
||||
'glb_url': item['glb_url'],
|
||||
'remark': item.get('remark'),
|
||||
'embryo_redundancy_id': item.get('embryo_redundancy_id'),
|
||||
'is_incoming_material': True if item.get('embryo_redundancy_id') else False,
|
||||
'manual_quotation': item.get('manual_quotation')
|
||||
'manual_quotation': item.get('manual_quotation'),
|
||||
'model_id': item['model_id'],
|
||||
'delivery_end_date': item['delivery_end_date'],
|
||||
}
|
||||
return self.env['sale.order.line'].with_context(skip_procurement=True).create(vals)
|
||||
|
||||
@@ -245,6 +253,7 @@ class ResaleOrderLine(models.Model):
|
||||
# part_number = fields.Char('零件图号', related='product_id.part_number', readonly=True)
|
||||
part_name = fields.Char('零件名称', related='product_id.part_name', readonly=True)
|
||||
model_glb_file = fields.Binary('模型的glb文件', compute='_compute_model_glb_file', store=True)
|
||||
glb_url = fields.Char('glb文件地址', compute='_compute_model_glb_file', store=True)
|
||||
# product_template_id = fields.Many2one(
|
||||
# string="产品",
|
||||
# comodel_name='product.template',
|
||||
@@ -261,6 +270,10 @@ class ResaleOrderLine(models.Model):
|
||||
is_incoming_material = fields.Boolean('客供料', compute='_compute_is_incoming_material', store=True)
|
||||
embryo_redundancy_id = fields.Many2one('sf.embryo.redundancy', '坯料冗余')
|
||||
manual_quotation = fields.Boolean('人工编程', default=False)
|
||||
model_url = fields.Char('模型文件地址')
|
||||
model_id = fields.Char('模型id')
|
||||
|
||||
delivery_end_date = fields.Date('交货截止日期')
|
||||
|
||||
@api.depends('embryo_redundancy_id')
|
||||
def _compute_is_incoming_material(self):
|
||||
@@ -273,6 +286,8 @@ class ResaleOrderLine(models.Model):
|
||||
if line.product_template_id:
|
||||
if not line.model_glb_file:
|
||||
line.model_glb_file = line.product_id.product_tmpl_id.model_file
|
||||
if not line.glb_url:
|
||||
line.glb_url = line.product_id.product_tmpl_id.glb_url
|
||||
if not line.price_unit:
|
||||
line.price_unit = line.product_id.product_tmpl_id.list_price
|
||||
|
||||
|
||||
@@ -50,9 +50,13 @@
|
||||
<group>
|
||||
<field name="customer_id" context="{'is_customer': True }"
|
||||
options="{'no_create': True}" required="1"/>
|
||||
<field name="upload_model_file" widget="many2many_binary"/>
|
||||
<field name="upload_model_file" widget="many2many_binary" attrs="{'invisible': [('upload_model_file', '=', False)]}"/>
|
||||
<!-- <field name="model_url" widget="binary_download" filename_field="model_name" readonly="1" string="模型文件"
|
||||
attrs="{'invisible': [('model_url', '=', False)]}"/> -->
|
||||
<field name="model_file" widget="Viewer3D" string="模型" readonly="1" force_save="1"
|
||||
attrs="{'invisible': [('model_file', '=', False)]}"/>
|
||||
<!-- <field name="glb_url" widget="Viewer3D" string="模型" readonly="1" force_save="1"
|
||||
attrs="{'invisible': [('glb_url', '=', False)]}"/> -->
|
||||
<label for="model_length" string="尺寸(mm)"
|
||||
attrs='{"invisible": [("model_file","=",False)]}'/>
|
||||
<div class="test_model"
|
||||
|
||||
@@ -98,12 +98,15 @@
|
||||
<field name="deadline_of_delivery" readonly="0"/>
|
||||
<field name="payments_way" invisible="1"/>
|
||||
<field name="pay_way" invisible="1"/>
|
||||
<field name="model_display_version" invisible="1"/>
|
||||
<!-- <field name="schedule_status" readonly="1"/> -->
|
||||
</field>
|
||||
<xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="before">
|
||||
<field name="model_glb_file" widget="Viewer3D" optional="show"
|
||||
string="模型文件" attrs="{'readonly': [('state', 'in', ['draft'])], 'isInList': True}"/>
|
||||
<field name="part_name" optional="hide"/>
|
||||
string="模型文件" readonly="1" attrs="{'column_invisible': [('parent.model_display_version', '!=', 'v1')], 'isInList': True}"/>
|
||||
<field name="glb_url" widget="Viewer3D" optional="show"
|
||||
string="模型文件" readonly="1" attrs="{'column_invisible': [('parent.model_display_version', '!=', 'v2')], 'isInList': True}"/>
|
||||
<field name="part_name" optional="show"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='order_line']/tree/field[@name='price_subtotal']" position="after">
|
||||
<field name="remark"/>
|
||||
@@ -133,6 +136,10 @@
|
||||
<xpath expr="//field[@name='order_line']/tree/field[@name='product_uom']" position="attributes">
|
||||
<attribute name="optional">hide</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='order_line']/tree/field[@name='remark']" position="before">
|
||||
<field name="delivery_end_date" optional="hide"/>
|
||||
</xpath>
|
||||
|
||||
<field name="user_id" position="attributes">
|
||||
<attribute name="attrs">{'readonly': [('state', 'in', ['cancel','sale'])]}</attribute>
|
||||
</field>
|
||||
|
||||
@@ -88,13 +88,23 @@ class StockPicking(models.Model):
|
||||
self.send_to_bfm()
|
||||
return info
|
||||
|
||||
def _action_done(self):
|
||||
"""处理创建欠单时,新单据验证序列号无法使用问题"""
|
||||
todo_moves = self.move_ids.filtered(
|
||||
lambda self: self.state in ['draft', 'waiting', 'partially_available', 'assigned', 'confirmed'])
|
||||
res = super(StockPicking, self)._action_done()
|
||||
todo_move = todo_moves.filtered(lambda mv: mv.quantity_done == 0)
|
||||
if todo_move:
|
||||
todo_move.move_line_nosuggest_ids.write({'qty_done': 1})
|
||||
return res
|
||||
|
||||
def deal_move_ids(self, send_move_ids, send_move_line_ids):
|
||||
move_ids = [] # 本次发货单
|
||||
move_line_ids = [] # 本次发货单行
|
||||
if send_move_ids:
|
||||
for item in send_move_ids:
|
||||
val = {
|
||||
'name': item.product_id.upload_model_file.display_name,
|
||||
'name': item.product_id.upload_model_file.display_name if item.product_id.upload_model_file else item.product_id.model_name,
|
||||
'quantity_done': item.quantity_done,
|
||||
'date': date_utils.json_default(item.date) if item.date else None,
|
||||
'description_picking': item.description_picking,
|
||||
|
||||
@@ -27,7 +27,10 @@ export class StepViewer extends Component {
|
||||
formatUrl() {
|
||||
var url = '';
|
||||
if (this.props.value) {
|
||||
if (this.props.value.slice(-1) == 'b' && !isNaN(this.props.value.split(' ')[0])) {
|
||||
if (this.props.value.startsWith('http')) {
|
||||
// 从url读取文件内容
|
||||
url = this.props.value;
|
||||
} else if (this.props.value.slice(-1) == 'b' && !isNaN(this.props.value.split(' ')[0])) {
|
||||
var url_props = {
|
||||
base_url: session['web.base.url'],
|
||||
model: this.props.record.resModel,
|
||||
@@ -37,21 +40,19 @@ export class StepViewer extends Component {
|
||||
url = url_props['base_url'].replace('http://', 'https://') + '/web/content/' + url_props['model'] + '/' + url_props['id'] + '/' + url_props['field'] + '?download=true';
|
||||
// url = 'http://localhost:8069'+'/web/content/'+url_props['model']+'/'+url_props['id']+'/'+url_props['field']+'?download=true'
|
||||
// console.log('url111111', url)
|
||||
return url;
|
||||
|
||||
} else {
|
||||
url = "data:model/gltf-binary;base64," + this.props.value;
|
||||
// console.log('url2', url)
|
||||
return url;
|
||||
|
||||
// localStorage.setItem('url',url)
|
||||
// let new_url = localStorage.getItem(('url'))
|
||||
// var oViewer = document.getElementsByTagName('model-viewer')[0];
|
||||
// return new_url
|
||||
// url = "web_widget_model_viewer/static/src/images/not_model.png";
|
||||
}
|
||||
} else {
|
||||
// var oImg = document.getElementsByClassName('test')[0]
|
||||
// console.log(oImg)
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user