Skip to content

Commit

Permalink
[ADD][F#28475][S#17530]Batch send to scales
Browse files Browse the repository at this point in the history
  • Loading branch information
Nguyen Van Tin committed Jun 8, 2018
1 parent e74cf4b commit b8a15ba
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 9 deletions.
1 change: 1 addition & 0 deletions louve_addons/product_to_scale_bizerba/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# -*- coding: utf-8 -*-
from . import models
from . import wizard
1 change: 1 addition & 0 deletions louve_addons/product_to_scale_bizerba/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
'security/ir.model.access.csv',
'data/ir_config_parameter.xml',
'data/ir_cron.xml',
'wizard/confirm_update_wizard_view.xml',
'views/view_product_product.xml',
'views/view_product_uom.xml',
'views/view_product_scale_system.xml',
Expand Down
15 changes: 15 additions & 0 deletions louve_addons/product_to_scale_bizerba/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -542,3 +542,18 @@ msgstr "product.scale.system.product.line"
msgid "range of the x2Many Fields"
msgstr "Index des champs x2Many"

#. module: product_to_scale_bizerba
#: model:ir.actions.act_window,name:product_to_scale_bizerba.action_product_scale_force_update
#: model:ir.ui.menu,name:product_to_scale_bizerba.menu_product_scale_update
msgid "Force Update"
msgstr "Renvoyer tous les produits aux balances"

#. module: product_to_scale_bizerba
#: model:ir.ui.view,arch_db:product_to_scale_bizerba.view_confirm_update_wizard_form
msgid "Confirm"
msgstr "Confirmer"

#. module: product_to_scale_bizerba
#: model:ir.ui.view,arch_db:product_to_scale_bizerba.view_confirm_update_wizard_form
msgid "Cancel"
msgstr "Annuler"
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,3 @@ def unlink(self, cr, uid, ids, context=None):
cr, uid, 'unlink', product, context=context)
return super(product_product, self).unlink(
cr, uid, ids, context=context)

def send_all_scale_write(self, cr, uid, ids, context=None):
product_to_send_ids = self.search(cr, uid, [
('scale_group_id', '!=', False)])
if product_to_send_ids:
self.browse(cr, uid, product_to_send_ids, context=context).send_scale_write()
return True
8 changes: 8 additions & 0 deletions louve_addons/product_to_scale_bizerba/views/action.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,12 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<field name="view_mode">tree,form</field>
</record>

<record id="action_product_scale_force_update" model="ir.actions.act_window">
<field name="name">Force Update</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">confirm.update.wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
</record>

</data></openerp>
4 changes: 4 additions & 0 deletions louve_addons/product_to_scale_bizerba/views/menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
parent="menu_scale_root" sequence="3"
action="action_product_scale_log"/>

<menuitem id="menu_product_scale_update"
parent="menu_scale_root" sequence="20"
action="action_product_scale_force_update"/>

</data></openerp>
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
colspan="2"/>
<button name="send_scale_unlink" type="object" string="Manual Deletion in the Scale System"
colspan="2"/>
<button name="send_all_scale_write" type="object" string="Force Update"
colspan="2"/>
</group>
</group>
</page>
Expand Down
6 changes: 6 additions & 0 deletions louve_addons/product_to_scale_bizerba/wizard/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.fr/>)
# @author: La Louve
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html

from . import confirm_update_wizard
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.fr/>)
# @author: La Louve
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html

from openerp import models, fields, api


class ConfirmUpdateWizard(models.TransientModel):
_name = 'confirm.update.wizard'
_description = 'Confirm Update Wizard'

@api.multi
def confirm_update(self):
self.ensure_one()
products_to_send = self.env['product.product'].search([
('scale_group_id', '!=', False)])
products_to_send.send_scale_write()
return True
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="view_confirm_update_wizard_form" model="ir.ui.view">
<field name="name">view.confirm.update.wizard.form</field>
<field name="model">confirm.update.wizard</field>
<field name="arch" type="xml">
<form string="Confirmation">
<footer>
<button name="confirm_update" type="object" string="Confirm" class="btn btn-primary o_sale_confirm"/>
<button name="button_cancel" special="cancel" string="Cancel" class="oe_link"/>
</footer>
</form>
</field>
</record>

<record id="action_product_scale_force_update" model="ir.actions.act_window">
<field name="name">Force Update</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">confirm.update.wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>

</odoo>

0 comments on commit b8a15ba

Please sign in to comment.