diff options
| -rwxr-xr-x | fixco_custom/models/stock_picking.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fixco_custom/models/stock_picking.py b/fixco_custom/models/stock_picking.py index 45757f2..56bb913 100755 --- a/fixco_custom/models/stock_picking.py +++ b/fixco_custom/models/stock_picking.py @@ -164,7 +164,14 @@ class StockPicking(models.Model): res = super(StockPicking, self).button_validate() - if self.name.startswith('BU/IN') and self.origin.startswith('Return of BU/OUT') and self.state == 'done': + if ( + self.name + and self.origin + and self.name.startswith('BU/IN') + and self.origin.startswith('Return of BU/OUT') + and self.state == 'done' + ): + self.automatic_reversed_invoice() # if self.name.startswith('BU/OUT') and self.origin.startswith('SO/'): # self.create_invoices() |
