Commit 7a97a33e by 夏超

[fix] 新增工序特殊产品计薪批量导入

parent ce80781f
......@@ -17,7 +17,9 @@
'views/iniherit_work_order_view.xml',
'views/inherit_roke_product.xml',
'views/inherit_roke_routing_line.xml',
'views/inherit_view_roke_process_form.xml',
'wizard/assign_workcenter_wizard_view.xml',
'wizard/product_import_wizard_view.xml',
],
'qweb': [
"static/src/xml/roke_craft_design.xml",
......
......@@ -2,3 +2,4 @@ from . import inherit_roke_work_order
from . import inherit_production_task
from . import inherit_roke_routing
from . import inherit_roke_product
from . import inherit_roke_process
from odoo import models, fields, api
class InheritRokeProcess(models.Model):
_inherit = 'roke.process'
def action_import_products(self):
# 这里实现批量导入逻辑
# 例如,打开一个向导来选择产品
return {
'type': 'ir.actions.act_window',
'name': '批量导入产品',
'res_model': 'product.import.wizard',
'view_mode': 'form',
'target': 'new',
}
<odoo>
<data>
<record id="inherit_view_roke_process_form" model="ir.ui.view">
<field name="name">inherit.view.roke.process.form</field>
<field name="model">roke.process</field>
<field name="inherit_id" ref="roke_mes_salary.view_roke_salary_inherit_process_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_salary_ids']" position="before">
<button name="action_import_products" type="object" string="批量导入" class="oe_highlight"/>
</xpath>
</field>
</record>
</data>
</odoo>
\ No newline at end of file
from . import assign_workcenter_wizard
from . import product_import_wizard
from odoo import models, fields, api
class ProductImportWizard(models.TransientModel):
_name = 'product.import.wizard'
_description = '产品导入向导'
product_ids = fields.Many2many('roke.product', string='选择产品')
def import_products(self):
active_id = self.env.context.get('active_id')
process = self.env['roke.process'].browse(active_id)
process.product_salary_ids = [(0, 0, {"product_id": v}) for v in self.product_ids.ids]
<odoo>
<data>
<record id="view_product_import_wizard_form" model="ir.ui.view">
<field name="name">product.import.wizard.form</field>
<field name="model">product.import.wizard</field>
<field name="arch" type="xml">
<form string="批量导入产品">
<sheet>
<field name="product_ids" widget="many2many_tags"/>
<footer>
<button string="导入" type="object" name="import_products" class="oe_highlight"/>
<button string="取消" class="oe_link" special="cancel"/>
</footer>
</sheet>
</form>
</field>
</record>
</data>
</odoo>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment