Merge branch 'feature/采购去掉审核' into develop
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="0">
|
||||
<data noupdate="1">
|
||||
<record id="sequence_workpiece_delivery" model="ir.sequence">
|
||||
<field name="name">工件配送</field>
|
||||
<field name="code">sf.workpiece.delivery</field>
|
||||
|
||||
@@ -735,7 +735,15 @@ class ResMrpWorkOrder(models.Model):
|
||||
def button_start(self):
|
||||
if self.routing_type == '装夹预调' and self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name:
|
||||
self.pro_code = self.production_id.move_raw_ids[0].move_line_ids[0].lot_id.name
|
||||
|
||||
if self.routing_type == '装夹预调':
|
||||
if not self.cnc_ids:
|
||||
raise UserError(_('该制造订单还未下发CNC程序,请稍后再试'))
|
||||
else:
|
||||
for item in self.cnc_ids:
|
||||
functional_cutting_tool = self.env['sf.functional.cutting.tool.entity'].search(
|
||||
[('tool_name_id.name', '=', item.cutting_tool_name)])
|
||||
if not functional_cutting_tool:
|
||||
raise UserError(_('该制造订单的CNC程序为%s没有对应的功能刀具%s' % item.cutting_tool_name))
|
||||
if self.routing_type == '解除装夹':
|
||||
'''
|
||||
记录开始时间
|
||||
|
||||
@@ -399,7 +399,7 @@ class ResProductMo(models.Model):
|
||||
|
||||
cutting_speed_ids = fields.One2many('sf.cutting.speed', 'product_template_id', string='切削速度Vc')
|
||||
feed_per_tooth_ids = fields.One2many('sf.feed.per.tooth', 'product_template_id', string='每齿走刀量fz')
|
||||
cutting_tool_diameter = fields.Float('直径(mm)')
|
||||
cutting_tool_diameter = fields.Float('刀具直径(mm)')
|
||||
cutting_tool_rear_angle = fields.Integer('后角(°)')
|
||||
cutting_tool_main_included_angle = fields.Integer('主偏角(°)')
|
||||
# 适用夹头型号可以多选
|
||||
|
||||
@@ -73,7 +73,9 @@
|
||||
<field name="arch" type="xml">
|
||||
<search string="Logs">
|
||||
<field name="name"/>
|
||||
<field name="interface_call_date"/>
|
||||
<group expand="0" string="分组">
|
||||
<field name="interface_call_date"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
attrs="{'invisible': ['|', '|', '|', ('production_state','in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done', 'cancel')), ('is_user_working', '!=', False)]}"/>
|
||||
<button name="button_pending" type="object" string="暂停" class="btn-warning"
|
||||
attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False)]}"/>
|
||||
<button name="button_finish" type="object" string="完成" class="btn-success"
|
||||
<button name="button_finish" type="object" string="完成" class="btn-success" confirm="是否确认完工"
|
||||
attrs="{'invisible': ['|', '|', ('production_state', 'in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('is_user_working', '=', False)]}"/>
|
||||
|
||||
<button name="%(mrp.act_mrp_block_workcenter_wo)d" type="action" string="阻塞"
|
||||
@@ -624,8 +624,8 @@
|
||||
<field name="model">sf.workpiece.delivery</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="工件配送">
|
||||
<filter string="上产线" name="up" domain="[('type', '=', '上产线')]"/>
|
||||
<filter string="下产线" name="down" domain="[('type', '=', '下产线' )]"/>
|
||||
<filter string="上产线" name="on_up" domain="[('type', '=', '上产线')]"/>
|
||||
<filter string="下产线" name="on_down" domain="[('type', '=', '下产线' )]"/>
|
||||
<field name="rfid_code"/>
|
||||
<field name="production_id"/>
|
||||
<field name="feeder_station_start_id"/>
|
||||
@@ -647,7 +647,7 @@
|
||||
<field name="name">工件配送</field>
|
||||
<field name="res_model">sf.workpiece.delivery</field>
|
||||
<field name="search_view_id" ref="sf_workpiece_delivery_search"/>
|
||||
<!-- <field name="context">{'search_default_on_up':1}</field>-->
|
||||
<field name="context">{'search_default_on_up':1}</field>
|
||||
<field name="view_mode">tree,search</field>
|
||||
<field name="domain">[('type','in',['上产线','下产线']),('workorder_state','=','done')]</field>
|
||||
</record>
|
||||
|
||||
@@ -17,7 +17,6 @@ from odoo.addons.sf_base.commons.common import Common
|
||||
from . import parser_and_calculate_work_time as pc
|
||||
|
||||
|
||||
|
||||
class QuickEasyOrder(models.Model):
|
||||
_name = 'quick.easy.order'
|
||||
_description = '简易下单'
|
||||
@@ -55,6 +54,7 @@ class QuickEasyOrder(models.Model):
|
||||
('success', '成功'),
|
||||
('fail', '失败')], string='模型上色状态')
|
||||
processing_time = fields.Integer('加工时长(min)')
|
||||
sale_order_id = fields.Many2one('sale.order', '销售订单号')
|
||||
|
||||
@api.depends('unit_price', 'quantity')
|
||||
def _compute_total_amount(self):
|
||||
@@ -89,7 +89,8 @@ class QuickEasyOrder(models.Model):
|
||||
obj = super(QuickEasyOrder, self).create(vals)
|
||||
# self.model_coloring(obj)
|
||||
logging.info('---------开始派单到工厂-------')
|
||||
self.distribute_to_factory(obj)
|
||||
sale_order = self.distribute_to_factory(obj)
|
||||
obj.sale_order_id = sale_order.id
|
||||
obj.state = '待接单'
|
||||
return obj
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ class QuickEasyOrder(models.Model):
|
||||
('success', '成功'),
|
||||
('fail', '失败')], string='模型上色状态')
|
||||
processing_time = fields.Integer('加工时长(min)')
|
||||
sale_order_id = fields.Many2one('sale.order', '销售订单号')
|
||||
|
||||
@api.depends('unit_price', 'quantity')
|
||||
def _compute_total_amount(self):
|
||||
@@ -79,12 +80,12 @@ class QuickEasyOrder(models.Model):
|
||||
base64_datas = base64_data.decode('utf-8')
|
||||
model_code = hashlib.sha1(base64_datas.encode('utf-8')).hexdigest()
|
||||
report_path = attachment._full_path(attachment.store_fname)
|
||||
vals['model_file'] = self.transition_glb_file(report_path, model_code)
|
||||
obj = super(QuickEasyOrder, self).create(vals)
|
||||
logging.info('---------向cloud生成模型库记录-------')
|
||||
self.model_coloring(obj)
|
||||
logging.info('---------开始派单到工厂-------')
|
||||
self.distribute_to_factory(obj)
|
||||
sale_order = self.distribute_to_factory(obj)
|
||||
obj.sale_order_id = sale_order.id
|
||||
obj.state = '待接单'
|
||||
return obj
|
||||
|
||||
@@ -264,6 +265,7 @@ class QuickEasyOrder(models.Model):
|
||||
product_bom_purchase = self.env['mrp.bom'].bom_create(product, 'normal', False)
|
||||
product_bom_purchase.bom_create_line_has(purchase_embryo)
|
||||
order_id.with_user(self.env.ref("base.user_admin")).sale_order_create_line(product, item)
|
||||
return order_id
|
||||
except Exception as e:
|
||||
# self.cr.rollback()
|
||||
return UserError('工厂创建销售订单和产品失败,请联系管理员')
|
||||
|
||||
@@ -141,6 +141,19 @@ class ResaleOrderLine(models.Model):
|
||||
model_glb_file = fields.Binary('模型的glb文件')
|
||||
check_status = fields.Selection(related='order_id.check_status')
|
||||
|
||||
@api.onchange('product_id')
|
||||
def _compute_model_glb_file(self):
|
||||
for line in self:
|
||||
if line.product_template_id:
|
||||
if not line.model_glb_file:
|
||||
line.update({
|
||||
'model_glb_file': line.product_id.product_tmpl_id.model_file,
|
||||
})
|
||||
if not line.price_unit:
|
||||
line.update({
|
||||
'price_unit': line.product_id.product_tmpl_id.list_price,
|
||||
})
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
@@ -151,23 +164,18 @@ class ProductTemplate(models.Model):
|
||||
class RePurchaseOrder(models.Model):
|
||||
_inherit = 'purchase.order'
|
||||
|
||||
check_status = fields.Selection([('pending', '待审核'), ('approved', '已审核'), ('fail', '不通过')], '审核状态')
|
||||
remark = fields.Text('备注')
|
||||
user_id = fields.Many2one(
|
||||
'res.users', string='买家', index=True, tracking=True,
|
||||
compute='_compute_user_id',
|
||||
store=True)
|
||||
|
||||
def button_confirming(self):
|
||||
self.write({'state': 'purchase', 'check_status': 'pending'})
|
||||
|
||||
@api.depends('partner_id')
|
||||
def _compute_user_id(self):
|
||||
if not self.user_id:
|
||||
if self.partner_id:
|
||||
self.user_id = self.partner_id.purchase_user_id.id
|
||||
self.check_status = 'pending'
|
||||
self.state = 'purchase'
|
||||
# self.state = 'purchase'
|
||||
else:
|
||||
self.user_id = self.env.user.id
|
||||
|
||||
@@ -190,28 +198,6 @@ class RePurchaseOrder(models.Model):
|
||||
if not line.taxes_id:
|
||||
raise UserError('请对【产品】中的【税】进行选择')
|
||||
|
||||
def write(self, vals):
|
||||
if self.env.user.has_group('sf_base.group_purchase_director'):
|
||||
if vals.get('check_status'):
|
||||
if vals['check_status'] in ('pending', False):
|
||||
vals['check_status'] = 'approved'
|
||||
return super().write(vals)
|
||||
|
||||
def button_confirm(self):
|
||||
for order in self:
|
||||
if order.state not in ['draft', 'sent', 'purchase']:
|
||||
continue
|
||||
order.order_line._validate_analytic_distribution()
|
||||
order._add_supplier_to_product()
|
||||
# Deal with double validation process
|
||||
if order._approval_allowed():
|
||||
order.button_approve()
|
||||
else:
|
||||
order.write({'state': 'to approve'})
|
||||
if order.partner_id not in order.message_partner_ids:
|
||||
order.message_subscribe([order.partner_id.id])
|
||||
return True
|
||||
|
||||
@api.onchange('order_line')
|
||||
def _onchange_order_line(self):
|
||||
for order in self:
|
||||
|
||||
@@ -99,6 +99,26 @@
|
||||
<field name="perm_read" eval="1"/>
|
||||
<field name="perm_write" eval="1"/>
|
||||
<field name="perm_create" eval="1"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.rule" id="quick_easy_order_rule_salemanager">
|
||||
<field name="name">销售经理只可以查看本人的快速订单</field>
|
||||
<field name="model_id" ref="model_quick_easy_order"/>
|
||||
<field name="domain_force">[('create_uid', '=',user.id)]</field>
|
||||
<field name="groups" eval="[(4, ref('sf_base.group_sale_salemanager'))]"/>
|
||||
<field name="perm_read" eval="1"/>
|
||||
<field name="perm_write" eval="0"/>
|
||||
<field name="perm_create" eval="0"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.rule" id="quick_easy_order_rule_director">
|
||||
<field name="name">销售总监查看所有快速订单</field>
|
||||
<field name="model_id" ref="model_quick_easy_order"/>
|
||||
<field name="domain_force">[(1,'=',1)]</field>
|
||||
<field name="groups" eval="[(4, ref('sf_base.group_sale_director'))]"/>
|
||||
<field name="perm_read" eval="1"/>
|
||||
<field name="perm_write" eval="1"/>
|
||||
<field name="perm_create" eval="1"/>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -32,8 +32,8 @@ access_stock_picking_group_quality_director,stock_picking_group_quality_director
|
||||
access_account_move_group_sale_salemanager,account_move_group_sale_salemanager,account.model_account_move,sf_base.group_sale_salemanager,1,0,0,0
|
||||
access_account_move_group_sale_director,account_move_group_sale_director,account.model_account_move,sf_base.group_sale_director,1,0,0,0
|
||||
access_resource_resource_group_sale_director,resource_resource_group_sale_director,resource.model_resource_resource,sf_base.group_sale_director,1,1,1,0
|
||||
access_mrp_bom_group_sale_salemanager,mrp_bom_group_sale_salemanager,mrp.model_mrp_bom,sf_base.group_sale_salemanager,1,0,0,0
|
||||
access_mrp_bom_group_sale_director,mrp_bom_group_sale_director,mrp.model_mrp_bom,sf_base.group_sale_director,1,0,0,0
|
||||
access_mrp_bom_group_sale_salemanager,mrp_bom_group_sale_salemanager,mrp.model_mrp_bom,sf_base.group_sale_salemanager,1,0,1,0
|
||||
access_mrp_bom_group_sale_director,mrp_bom_group_sale_director,mrp.model_mrp_bom,sf_base.group_sale_director,1,0,1,0
|
||||
access_mrp_bom_group_purchase,mrp_bom_group_purchase,mrp.model_mrp_bom,sf_base.group_purchase,1,0,0,0
|
||||
access_mrp_bom_group_purchase_director,mrp_bom_group_purchase_director,mrp.model_mrp_bom,sf_base.group_purchase_director,1,0,0,0
|
||||
access_mrp_bom_group_quality,mrp_bom_group_quality,mrp.model_mrp_bom,sf_base.group_quality,1,0,0,0
|
||||
|
||||
|
@@ -8,28 +8,15 @@
|
||||
<field name="arch" type="xml">
|
||||
<field name="partner_id" position="replace">
|
||||
<field name="partner_id" widget="res_partner_many2one" context="{'is_supplier': True }"/>
|
||||
<field name="check_status" invisible="1"/>
|
||||
</field>
|
||||
<field name="currency_id" position="after">
|
||||
<field name="remark" attrs="{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['pending','approved'])]}"/>
|
||||
<field name="remark" attrs="{'readonly': [('state', 'in', ['purchase'])]}"/>
|
||||
</field>
|
||||
<xpath expr="//form/header/button[@name='action_rfq_send'][1]" position="after">
|
||||
<button name="sf_sale.action_purchase_order_check_wizard" string="审核" type="action"
|
||||
context="{'default_order_id':active_id}" groups="sf_base.group_purchase_director"
|
||||
attrs="{'invisible': ['&',('check_status','in', ['approved','fail']),('state', 'in', ['purchase','draft'])]}"
|
||||
class="oe_highlight"/>
|
||||
|
||||
</xpath>
|
||||
<xpath expr="//form/header/button[@name='button_confirm'][2]" position="replace">
|
||||
<button name="button_confirm" type="object" context="{'validate_analytic': True}"
|
||||
string="确认订单" id="draft_confirm"
|
||||
groups="sf_base.group_purchase,sf_base.group_purchase_director"
|
||||
attrs="{'invisible': ['|','&','&', ('state', 'in', ['purchase','draft']), ('check_status', 'in', ['approved']), ('date_approve', '!=', False),'&', '&',('state', 'in', ['purchase', 'draft']),('check_status', 'in', [False, 'pending', 'fail']),('date_approve', '=', False)]}"
|
||||
/>
|
||||
<button name="button_confirming" type="object"
|
||||
string="确认订单" groups="sf_base.group_purchase,sf_base.group_purchase_director"
|
||||
attrs="{'invisible': ['&',('check_status','!=', False),('state', 'not in', ['draft','send'])]}"
|
||||
attrs="{'invisible': [('state', 'in', ['purchase'])]}"
|
||||
/>
|
||||
</xpath>
|
||||
<xpath expr="//form/header/button[@name='action_rfq_send'][1]" position="replace">
|
||||
@@ -93,43 +80,35 @@
|
||||
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='order_line']" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['approved'])]}
|
||||
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
|
||||
</attribute>
|
||||
</xpath>
|
||||
<field name="partner_ref" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['pending','approved'])]}
|
||||
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
|
||||
</attribute>
|
||||
</field>
|
||||
<field name="date_planned" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['pending','approved'])]}
|
||||
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
|
||||
</attribute>
|
||||
</field>
|
||||
<field name="receipt_reminder_email" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['pending','approved'])]}
|
||||
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
|
||||
</attribute>
|
||||
</field>
|
||||
<field name="user_id" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['pending','approved'])]}
|
||||
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
|
||||
</attribute>
|
||||
</field>
|
||||
<field name="origin" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['pending','approved'])]}
|
||||
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
|
||||
</attribute>
|
||||
</field>
|
||||
<field name="payment_term_id" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['pending','approved'])]}
|
||||
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
|
||||
</attribute>
|
||||
</field>
|
||||
<field name="fiscal_position_id" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['pending','approved'])]}
|
||||
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
|
||||
</attribute>
|
||||
</field>
|
||||
</field>
|
||||
@@ -153,13 +132,10 @@
|
||||
<field name="inherit_id" ref="purchase_stock.purchase_order_view_form_inherit"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="incoterm_id" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['pending','approved'])]}
|
||||
</attribute>
|
||||
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}</attribute>
|
||||
</field>
|
||||
<field name="incoterm_location" position="attributes">
|
||||
<attribute name="attrs">{'readonly': ['&',('state', 'in', ['purchase']),('check_status','in',
|
||||
['pending','approved'])]}
|
||||
<attribute name="attrs">{'readonly': [('state', 'in', ['purchase'])]}
|
||||
</attribute>
|
||||
</field>
|
||||
</field>
|
||||
@@ -171,14 +147,8 @@
|
||||
<field name="inherit_id" ref="purchase.purchase_order_view_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<tree position="attributes">
|
||||
<attribute name="default_order">check_status desc,date_approve asc</attribute>
|
||||
<attribute name="default_order">date_approve asc</attribute>
|
||||
</tree>
|
||||
<field name="amount_total" position="after">
|
||||
<field name="check_status" widget="badge"
|
||||
decoration-success="check_status == 'approved'"
|
||||
decoration-warning="check_status == 'pending'"
|
||||
decoration-danger="check_status == 'fail'"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
<field name="quantity"/>
|
||||
<field name="unit_price"/>
|
||||
<field name="price"/>
|
||||
<field name="sale_order_id"/>
|
||||
<field name="create_uid" string="创建人"/>
|
||||
<field name="create_date" string="创建时间"/>
|
||||
<field optional="hide" name="delivery_time"/>
|
||||
@@ -78,6 +79,8 @@
|
||||
<field name="quantity" options="{'format': false}"/>
|
||||
<field name="unit_price"/>
|
||||
<field name="price" options="{'format': false}"/>
|
||||
<field name="sale_order_id"
|
||||
attrs='{"invisible": [("sale_order_id","=",False)],"readonly": [("sale_order_id","!=",False)]}'/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
|
||||
Reference in New Issue
Block a user