Skip to content

Commit

Permalink
Merge pull request #244 from lepistone/auto-ship-available
Browse files Browse the repository at this point in the history
sale_automatic_workflow: ship only available goods
  • Loading branch information
guewen committed Apr 28, 2016
2 parents c118301 + 7f52785 commit 96e5690
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sale_automatic_workflow/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

{
'name': 'Sale Automatic Workflow',
'version': '8.0.0.2.0',
'version': '8.0.0.3.0',
'category': 'Generic Modules/Others',
'license': 'AGPL-3',
'author': "Akretion,Camptocamp,Odoo Community Association (OCA)",
Expand Down
5 changes: 5 additions & 0 deletions sale_automatic_workflow/sale_workflow_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ class SaleWorkflowProcess(models.Model):
)
validate_invoice = fields.Boolean(string='Validate Invoice')
validate_picking = fields.Boolean(string='Confirm and Close Picking')
ship_only_available = fields.Boolean(
string='Ship only available goods',
help="When checked, the available quantity is shipped, and if so, a "
"backorder is created with the rest."
)
invoice_date_is_order_date = fields.Boolean(
string='Force Invoice Date',
help="When checked, the invoice date will be "
Expand Down
1 change: 1 addition & 0 deletions sale_automatic_workflow/sale_workflow_process_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<group string="Workflow Options">
<field name="validate_order"/>
<field name="validate_picking"/>
<field name="ship_only_available" attrs="{'invisible': [('validate_picking', '=', False)]}" />
<field name="create_invoice_on" attrs="{'readonly': [('order_policy', '!=', 'manual')]}" />
<field name="validate_invoice"/>
<field name="invoice_date_is_order_date"/>
Expand Down
12 changes: 10 additions & 2 deletions sale_automatic_workflow/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ def _create_invoice_from_picking(self, cr, uid, picking, vals,

@api.multi
def validate_picking(self):
self.force_assign()
self.do_transfer()
only_available = self.filtered(
'workflow_process_id.ship_only_available')
to_force = self - only_available
if only_available:
only_available.action_assign()
only_available.do_prepare_partial()
only_available.do_transfer()
if to_force:
to_force.force_assign()
to_force.do_transfer()
return True

0 comments on commit 96e5690

Please sign in to comment.