!3081 添加功能

Merge pull request !3081 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2025-06-04 09:21:12 +00:00
committed by Gitee
10 changed files with 281 additions and 30 deletions
@@ -17,6 +17,9 @@ class ResGroups(models.Model):
users_to_unlink2 = self.users.filtered(lambda user: user.name != '叶华峰')
self.write({'users': [(3, user.id) for user in users_to_unlink]})
self.write({'users': [(3, user.id) for user in users_to_unlink2]})
def domain_unlink(self):
self.write({'users_ids': [(5, 0, 0)]})
self.write({'employee_ids': [(5, 0, 0)]})
self.write({'department_ids': [(5, 0, 0)]})
@@ -11,6 +11,7 @@
<xpath expr="//group" position="before">
<header>
<button class="oe_highlight" name="users_unlink" string="清除用户" type="object"/>
<button class="oe_highlight" name="domain_unlink" string="清除过滤" type="object"/>
<button class="oe_highlight" name="rule_unlink" string="清除规则权限" type="object"/>
</header>
</xpath>
@@ -62,6 +62,7 @@
<field name="work_end" invisible="1"/>
<field name="department_id" string="发布部门" invisible="1"/>
<field name="create_date1"/>
<field name="start_date"/>
</group>
</group>
<group>
+8
View File
@@ -8,6 +8,14 @@
<field name="company_id" eval="False"/>
</record>
<record id="purchase_order_sequence" model="ir.sequence">
<field name="name">采购订单编号</field>
<field name="code">purchase_order_sequence_code</field>
<field name="prefix">CG%(y)s%(month)s%(day)s</field>
<field name="padding">3</field>
<field name="company_id" eval="False"/>
</record>
<record id="purchase_service_orders_sequence" model="ir.sequence">
<field name="name">服务采购单编号</field>
<field name="code">purchase_service_orders_code</field>
@@ -5,16 +5,26 @@ from odoo import api, fields, models
class PurchaseOrder(models.Model):
_name = 'purchase.order'
_inherit = ['purchase.order', 'soong.workflow.mixin']
_description = '采购订单'
code = fields.Char(string="流水号",
default=lambda self: self.env['ir.sequence'].next_by_code('purchase_order_sequence_code'))
company_id = fields.Many2one('res.company', string="公司", default=lambda self: self.env.company)
user_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user)
department_id = fields.Many2one(related='user_id.employee_id.department_id', string="部门")
start_date = fields.Date(string="申请日期", default=fields.Date.today)
code = fields.Char(string="合同编号")
reason_text = fields.Text(string='申请事由')
document_ids = fields.Many2many('ir.attachment', string="附件")
urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
default='normal')
active = fields.Boolean('Active', default=True, tracking=True)
purchase_order_models_ids = fields.One2many('purchase.order.pay.line', 'purchase_id', string="付款详情")
def _get_default_name_title(self):
return self._description if self._description else self._name
name_title = fields.Char(default=_get_default_name_title, string="标题")
class PurchaseOrderPayLine(models.Model):
_name = "purchase.order.pay.line"
@@ -5,7 +5,7 @@ from odoo import api, fields, models
class PurchaseLowOrders(models.Model):
_name = 'purchase.low.orders'
_description = '低值易耗采购单'
_inherit = ['soong.workflow.mixin']
_inherit = ['soong.workflow.mixin', 'mail.thread', 'mail.activity.mixin']
name = fields.Char(string="标题")
code = fields.Char(string="合同编号", default=lambda self: self.env['ir.sequence'].next_by_code('purchase_low_orders_code'))
@@ -5,7 +5,7 @@ from odoo import api, fields, models
class PurchaseServiceOrders(models.Model):
_name = 'purchase.service.orders'
_description = '服务采购单'
_inherit = ['soong.workflow.mixin']
_inherit = ['soong.workflow.mixin', 'mail.thread', 'mail.activity.mixin']
name = fields.Char(string="标题")
code = fields.Char(string="合同编号", default=lambda self: self.env['ir.sequence'].next_by_code('purchase_service_orders_code'))
@@ -5,33 +5,251 @@
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="after">
<field name="company_id"/>
<field name="user_id"/>
<field name="department_id"/>
<field name="start_date"/>
<field name="code"/>
<field name="reason_text"/>
<field name="document_ids" widget="preview_many2many"/>
</xpath>
<xpath expr="//field[@name='partner_ref']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='currency_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//page[@name='products']" position="after">
<page string="付款详情">
<field name="purchase_order_models_ids">
<tree editable="bottom">
<field name="purchase_id" column_invisible="1"/>
<field name="payment_stage"/>
<field name="amount"/>
<field name="payment_date"/>
<field name="remake"/>
</tree>
</field>
</page>
<xpath expr="//form" position="replace">
<form>
<sheet>
<widget name="web_ribbon" title="普件" bg_color="text-bg-success"
invisible="urgency_level != 'normal'"/>
<widget name="web_ribbon" title="急件" bg_color="text-bg-warning"
invisible="urgency_level != 'urgent'"/>
<widget name="web_ribbon" title="特级" bg_color="text-bg-danger"
invisible="urgency_level != 'emergency'"/>
<group col="3">
<group>
<field name="code" string="流水号" readonly="1"/>
</group>
<group>
<field name="urgency_level" readonly="1"/>
</group>
<group/>
</group>
<div class="col-12 text-center">
<h1>
<field name="name_title" readonly="1"/>
</h1>
</div>
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name" string="标题"/>
</h1>
</div>
<group string="审批信息">
<field name="company_id" invisible="1"/>
<field name="user_id"/>
<field name="partner_id"/>
<field name="date_order"/>
<field name="date_planned"/>
<field name="department_id" invisible="1"/>
<field name="start_date"/>
<field name="reason_text"/>
<field name="document_ids" widget="preview_many2many"/>
</group>
<notebook>
<page string="产品" name="products">
<field name="tax_country_id" invisible="1"/>
<field name="order_line" widget="section_and_note_one2many" mode="tree,kanban"
context="{'default_state': 'draft'}" readonly="state in ('done', 'cancel')">
<tree string="Purchase Order Lines" editable="bottom">
<field name="tax_calculation_rounding_method" column_invisible="True"/>
<field name="display_type" column_invisible="True"/>
<field name="company_id" column_invisible="True"/>
<field name="currency_id" column_invisible="True"/>
<field name="state" column_invisible="True"/>
<field name="product_type" column_invisible="True"/>
<field name="product_uom" column_invisible="True" groups="!uom.group_uom"/>
<field name="product_uom_category_id" column_invisible="True"/>
<field name="invoice_lines" column_invisible="True"/>
<field name="sequence" widget="handle"/>
<field name="product_id"
readonly="state in ('purchase', 'to approve', 'done', 'cancel')"
required="not display_type" width="35%"
context="{'partner_id':parent.partner_id, 'quantity':product_qty, 'company_id': parent.company_id}"
force_save="1" domain="[('purchase_ok', '=', True)]"/>
<field name="name" widget="section_and_note_text"/>
<field name="date_planned" optional="hide" required="not display_type" force_save="1"/>
<field name="analytic_distribution" widget="analytic_distribution" optional="hide"
groups="analytic.group_analytic_accounting"
options="{'product_field': 'product_id', 'business_domain': 'purchase_order', 'amount_field': 'price_subtotal'}"/>
<field name="product_qty"/>
<field name="qty_received_manual" column_invisible="True"/>
<field name="qty_received_method" column_invisible="True"/>
<field name="qty_received" string="Received"
column_invisible="parent.state not in ('purchase', 'done')"
readonly="qty_received_method != 'manual'" optional="show"/>
<field name="qty_invoiced" string="Billed"
column_invisible="parent.state not in ('purchase', 'done')" optional="show"/>
<field name="product_packaging_qty"
invisible="not product_id or not product_packaging_id"
groups="product.group_stock_packaging" optional="show"/>
<field name="product_packaging_id" invisible="not product_id"
context="{'default_product_id': product_id, 'tree_view_ref':'product.product_packaging_tree_view', 'form_view_ref':'product.product_packaging_form_view'}"
groups="product.group_stock_packaging" optional="show"/>
<field name="price_unit" readonly="qty_invoiced != 0"/>
<button name="action_purchase_history" type="object" icon="fa-history"
title="Purchase History" invisible="not id"/>
<field name="taxes_id" widget="many2many_tags"
domain="[('type_tax_use', '=', 'purchase'), ('company_id', 'parent_of', parent.company_id), ('country_id', '=', parent.tax_country_id), ('active', '=', True)]"
context="{'default_type_tax_use': 'purchase', 'search_view_ref': 'account.account_tax_view_search'}"
options="{'no_create': True}" optional="show"/>
<field name="discount" string="折扣%" readonly="qty_invoiced != 0" optional="hide"/>
<field name="price_subtotal" string="不含税价"/>
<field name="price_total" string="含税"
column_invisible="parent.tax_calculation_rounding_method == 'round_globally'"
optional="hide"/>
</tree>
<form string="Purchase Order Line">
<field name="tax_calculation_rounding_method" invisible="1"/>
<field name="state" invisible="1"/>
<field name="display_type" invisible="1"/>
<field name="company_id" invisible="1"/>
<group invisible="display_type">
<group>
<field name="product_uom_category_id" invisible="1"/>
<field name="product_id" context="{'partner_id': parent.partner_id}"
widget="many2one_barcode"
domain="[('purchase_ok', '=', True), '|', ('company_id', '=', False), ('company_id', '=', parent.company_id)]"
readonly="state in ('purchase', 'to approve', 'done', 'cancel')"/>
<field name="qty_received_method" invisible="1"/>
<field name="qty_received" string="已收"
invisible="parent.state not in ('purchase', 'done')"
readonly="qty_received_method != 'manual'"/>
<field name="qty_invoiced" string="Billed Quantity"
invisible="parent.state not in ('purchase', 'done')"/>
<field name="product_packaging_qty"
invisible="not product_id or not product_packaging_id"
groups="product.group_stock_packaging"/>
<field name="product_packaging_id" invisible="not product_id"
context="{'default_product_id': product_id, 'tree_view_ref':'product.product_packaging_tree_view', 'form_view_ref':'product.product_packaging_form_view'}"
groups="product.group_stock_packaging"/>
<field name="price_unit"/>
<field name="taxes_id" widget="many2many_tags"
domain="[('type_tax_use', '=', 'purchase'), ('company_id', 'parent_of', parent.company_id), ('country_id', '=', parent.tax_country_id)]"
options="{'no_create': True}"/>
</group>
<group>
<field name="date_planned" widget="date" required="not display_type"/>
<field name="analytic_distribution" widget="analytic_distribution"
groups="analytic.group_analytic_accounting"
options="{'product_field': 'product_id', 'business_domain': 'purchase_order'}"/>
</group>
<group>
<notebook colspan="4">
<page string="Notes" name="notes">
<field name="name"/>
</page>
<page string="Invoices and Incoming Shipments"
name="invoices_incoming_shiptments">
<field name="invoice_lines"/>
</page>
</notebook>
</group>
</group>
<label for="name" string="Section Name (eg. Products, Services)"
invisible="display_type != 'line_section'"/>
<label for="name" string="Note" invisible="display_type != 'line_note'"/>
<field name="name" nolabel="1" invisible="not display_type"/>
</form>
<kanban class="o_kanban_mobile">
<field name="name"/>
<field name="product_id"/>
<field name="product_qty"/>
<field name="price_subtotal"/>
<field name="price_tax"/>
<field name="price_total"/>
<field name="price_unit"/>
<field name="display_type"/>
<field name="taxes_id"/>
<field name="tax_calculation_rounding_method"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_card oe_kanban_global_click {{ record.display_type.raw_value ? 'o_is_' + record.display_type.raw_value : '' }}">
<t t-if="!record.display_type.raw_value">
<div class="row">
<div class="col-8">
<strong>
<span t-esc="record.product_id.value"/>
</strong>
</div>
<div class="col-4">
<strong>
<span>
Tax excl.:
<t t-esc="record.price_subtotal.value"
class="float-end text-end"/>
</span>
</strong>
</div>
</div>
<div class="row">
<div class="col-8 text-muted">
<span>
Quantity:
<t t-esc="record.product_qty.value"/>
<t t-esc="record.product_uom.value" groups="uom.group_uom"/>
</span>
</div>
<div class="col-4"
t-if="record.tax_calculation_rounding_method.raw_value === 'round_per_line'">
<strong>
<span>
Tax incl.:
<t t-esc="record.price_total.value"/>
</span>
</strong>
</div>
</div>
<div class="row">
<div class="col-12 text-muted">
<span>
Unit Price:
<t t-esc="record.price_unit.value"/>
</span>
</div>
</div>
</t>
<div t-elif="record.display_type.raw_value === 'line_section' || record.display_type.raw_value === 'line_note'"
class="row">
<div class="col-12">
<span t-esc="record.name.value"/>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
<group>
<group>
<field colspan="2" name="notes" nolabel="1"
placeholder="Define your terms and conditions ..."/>
</group>
<group class="oe_subtotal_footer">
<field name="tax_totals" widget="account-tax-totals-field" nolabel="1" colspan="2"
readonly="1"/>
</group>
</group>
<div class="clearfix"/>
</page>
<page string="付款详情">
<field name="purchase_order_models_ids">
<tree editable="bottom">
<field name="purchase_id" column_invisible="1"/>
<field name="payment_stage"/>
<field name="amount"/>
<field name="payment_date"/>
<field name="remake"/>
</tree>
</field>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids"/>
<field name="activity_ids"/>
<field name="message_ids"/>
</div>
</form>
</xpath>
</field>
</record>
@@ -91,6 +91,11 @@
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids"/>
<field name="activity_ids"/>
<field name="message_ids"/>
</div>
</form>
</field>
</record>
@@ -110,6 +110,11 @@
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids"/>
<field name="activity_ids"/>
<field name="message_ids"/>
</div>
</form>
</field>
</record>