Browse Source

[S0046] 0046 - Faciliter la réception de marchandises: Add a button to copy all qty in done column at reception

pull/15/head v1.0-2017-02-26
tfrancoi 8 years ago
committed by Thibault Francois
parent
commit
b688266c67
  1. 2
      beesdoo_inventory/__openerp__.py
  2. 12
      beesdoo_inventory/models/stock.py
  3. 4
      beesdoo_inventory/views/stock.xml

2
beesdoo_inventory/__openerp__.py

@ -20,7 +20,7 @@
'version': '0.1', 'version': '0.1',
# any module necessary for this one to work correctly # any module necessary for this one to work correctly
'depends': ['delivery'],
'depends': ['delivery', 'beesdoo_base'],
# always loaded # always loaded
'data': [ 'data': [

12
beesdoo_inventory/models/stock.py

@ -8,7 +8,7 @@ class StockPicking(models.Model):
responsible = fields.Many2one('res.partner', string="Responsible") responsible = fields.Many2one('res.partner', string="Responsible")
def _add_follower(self): def _add_follower(self):
if(self.responsible):
if(self.responsible):
types = self.env['mail.message.subtype'].search(['|',('res_model','=','stock.picking'),('name','=','Discussions')]) types = self.env['mail.message.subtype'].search(['|',('res_model','=','stock.picking'),('name','=','Discussions')])
self.env['mail.followers'].create({'res_model' : 'stock.picking', self.env['mail.followers'].create({'res_model' : 'stock.picking',
'res_id' : self.id, 'res_id' : self.id,
@ -23,6 +23,14 @@ class StockPicking(models.Model):
@api.model @api.model
def create(self, values): def create(self, values):
print "Values", values
picking = super(StockPicking, self).create(values) picking = super(StockPicking, self).create(values)
picking._add_follower() picking._add_follower()
return picking
return picking
@api.multi
def copy_qty(self):
self.ensure_one()
for pack_operation in self.pack_operation_product_ids:
pack_operation.qty_done = pack_operation.product_qty
return True

4
beesdoo_inventory/views/stock.xml

@ -23,6 +23,10 @@
<field name="backorder_id" position="after"> <field name="backorder_id" position="after">
<field name="responsible" /> <field name="responsible" />
</field> </field>
<button name="do_new_transfer" position="before">
<button name="copy_qty" string="Copy Pack Quantity" states="partially_available,assigned" type="object" class="oe_highlight"
attrs="{'invisible': ['|', ('picking_type_code', '!=', 'incoming')]}"/>
</button>
</field> </field>
</record> </record>
Loading…
Cancel
Save