Accept Merge Request #1677: (feature/成品调拨单优化_1 -> develop)
Merge Request: 1、询价单的确认按钮权限添加;2、成品调拨单添加对应的坯料采购单和坯料外协单跳转链接 Created By: @禹翔辉 Reviewed By: @马广威 Approved By: @马广威 Accepted By: @禹翔辉 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1677?initial=true
This commit is contained in:
@@ -9,12 +9,16 @@
|
||||
<xpath expr="//header/button[@name='action_view_picking']" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//header/button[@name='button_confirm']" position="replace">
|
||||
</xpath>
|
||||
<xpath expr="//header/button[@name='button_confirm']" position="replace">
|
||||
</xpath>
|
||||
<xpath expr="//header/button[@name='action_rfq_send'][1]" position="before">
|
||||
<button name="button_confirm" type="object" states="sent" string="Confirm Order"
|
||||
context="{'validate_analytic': True}" class="oe_highlight" id="bid_confirm"
|
||||
data-hotkey="v"/>
|
||||
<button name="button_confirm" type="object" states="draft" context="{'validate_analytic': True}"
|
||||
string="Confirm Order" id="draft_confirm"/>
|
||||
<button name="button_confirm" type="object" string="确认订单"
|
||||
context="{'validate_analytic': True}" class="oe_highlight" id="draft_confirm"
|
||||
groups="sf_base.group_purchase,sf_base.group_purchase_director"
|
||||
attrs="{'invisible': [('state', 'in', ['purchase', 'done', 'cancel'])]}"
|
||||
/>
|
||||
<button name="action_view_picking"
|
||||
string="接收产品" class="oe_highlight" type="object"
|
||||
attrs="{'invisible': ['|', '|' , ('is_shipped', '=', True), ('state','not in', ('purchase','done')), ('incoming_picking_count', '=', 0)]}"
|
||||
@@ -25,12 +29,7 @@
|
||||
<xpath expr="//header/button[@name='button_cancel'][2]" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//header/button[@name='button_confirm'][3]" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//header/button[@name='button_confirm'][4]" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
|
||||
|
||||
<field name="partner_id" position="replace">
|
||||
<field name="partner_id" widget="res_partner_many2one" context="{'is_supplier': True }"/>
|
||||
@@ -38,13 +37,6 @@
|
||||
<field name="currency_id" position="after">
|
||||
<field name="remark" attrs="{'readonly': [('state', 'in', ['purchase'])]}" string="订单备注"/>
|
||||
</field>
|
||||
<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', 'cancel'])]}"
|
||||
/>
|
||||
</xpath>
|
||||
<xpath expr="//form/header/button[@name='action_rfq_send'][1]" position="replace">
|
||||
<button name="action_rfq_send" states="draft" string="通过Email发送采购单" type="object"
|
||||
context="{'send_rfq':True}" class="oe_highlight" data-hotkey="g"
|
||||
@@ -81,10 +73,6 @@
|
||||
<xpath expr="//form/header/button[@name='action_create_invoice'][2]" position="attributes">
|
||||
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//form/header/button[@name='button_confirm']" position="attributes">
|
||||
<attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>
|
||||
<!-- <button name="action_create_invoice" string="创建账单" type="object" class="oe_highlight" context="{'create_bill':True}" attrs="{'invisible': ['|', ('state', 'not in', ('purchase', 'done')), ('invoice_status', 'in', ('no', 'invoiced'))]}" data-hotkey="w" groups="sf_base.group_purchase,sf_base.group_purchase_director"/> -->
|
||||
</xpath>
|
||||
<!-- <xpath expr="//form/header/button[@name='action_create_invoice[2]']" position="attributes">-->
|
||||
<!-- <attribute name="groups">sf_base.group_purchase,sf_base.group_purchase_director</attribute>-->
|
||||
<!-- </xpath>-->
|
||||
|
||||
@@ -13,6 +13,74 @@ _logger = logging.getLogger(__name__)
|
||||
class StockPicking(models.Model):
|
||||
_inherit = 'stock.picking'
|
||||
|
||||
pro_purchase_count = fields.Integer('坯料采购单数量', compute='_compute_pro_purchase_count', store=True)
|
||||
|
||||
@api.depends('name')
|
||||
def _compute_pro_purchase_count(self):
|
||||
for sp in self:
|
||||
if sp:
|
||||
po_ids = self.env['purchase.order'].sudo().search([
|
||||
('origin', 'like', sp.name), ('purchase_type', '=', 'standard')])
|
||||
if po_ids:
|
||||
sp.pro_purchase_count = len(po_ids)
|
||||
|
||||
def pro_purchase_order(self):
|
||||
"""
|
||||
坯料采购
|
||||
"""
|
||||
po_ids = self.env['purchase.order'].sudo().search([
|
||||
('origin', 'like', self.name), ('purchase_type', '=', 'standard')])
|
||||
action = {
|
||||
'res_model': 'purchase.order',
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
if len(po_ids) == 1:
|
||||
action.update({
|
||||
'view_mode': 'form',
|
||||
'res_id': po_ids.id,
|
||||
})
|
||||
else:
|
||||
action.update({
|
||||
'name': _("采购订单列表"),
|
||||
'domain': [('id', 'in', po_ids.ids)],
|
||||
'view_mode': 'tree,form',
|
||||
})
|
||||
return action
|
||||
|
||||
pro_out_purchase_count = fields.Integer('坯料外协单数量', compute='_compute_pro_out_purchase_count', store=True)
|
||||
|
||||
@api.depends('name')
|
||||
def _compute_pro_out_purchase_count(self):
|
||||
for sp in self:
|
||||
if sp:
|
||||
po_ids = self.env['purchase.order'].sudo().search([
|
||||
('origin', 'like', sp.name), ('purchase_type', '=', 'consignment')])
|
||||
if po_ids:
|
||||
sp.pro_out_purchase_count = len(po_ids)
|
||||
|
||||
def pro_out_purchase_order(self):
|
||||
"""
|
||||
坯料外协
|
||||
"""
|
||||
po_ids = self.env['purchase.order'].sudo().search([
|
||||
('origin', 'like', self.name), ('purchase_type', '=', 'consignment')])
|
||||
action = {
|
||||
'res_model': 'purchase.order',
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
if len(po_ids) == 1:
|
||||
action.update({
|
||||
'view_mode': 'form',
|
||||
'res_id': po_ids.id,
|
||||
})
|
||||
else:
|
||||
action.update({
|
||||
'name': _("外协订单列表"),
|
||||
'domain': [('id', 'in', po_ids.ids)],
|
||||
'view_mode': 'tree,form',
|
||||
})
|
||||
return action
|
||||
|
||||
# 重写验证,下发发货到bfm
|
||||
def button_validate(self):
|
||||
info = super(StockPicking, self).button_validate()
|
||||
|
||||
@@ -1,6 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<record id="add_check_out_view_picking_form" model="ir.ui.view">
|
||||
<field name="name">添加坯料采购单链接</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//form//sheet//div[@name='button_box']//button[@name='action_picking_move_tree']" position="before">
|
||||
<button class="oe_stat_button" name="pro_purchase_order" type="object" icon="fa-credit-card"
|
||||
attrs="{'invisible': [('pro_purchase_count', '=', 0)]}">
|
||||
<div class="o_field_widget o_stat_info">
|
||||
<span class="o_stat_value"><field name="pro_purchase_count"/></span>
|
||||
<span class="o_stat_text">坯料采购</span>
|
||||
</div>
|
||||
</button>
|
||||
<button class="oe_stat_button" name="pro_out_purchase_order" type="object" icon="fa-credit-card"
|
||||
attrs="{'invisible': [('pro_out_purchase_count', '=', 0)]}">
|
||||
<div class="o_field_widget o_stat_info">
|
||||
<span class="o_stat_value"><field name="pro_out_purchase_count"/></span>
|
||||
<span class="o_stat_text">坯料外协</span>
|
||||
</div>
|
||||
</button>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user