@@ -42,7 +42,6 @@ def check_company(self):
4242 ).format (move .name_get ()[0 ][- 1 ])
4343 )
4444
45- @api .multi
4645 def button_cancel (self ):
4746 res = super ().button_cancel ()
4847 if self :
@@ -55,7 +54,6 @@ def button_cancel(self):
5554 dep_lines .filtered (lambda l : not l .asset_accounting_info_ids ).unlink ()
5655 return res
5756
58- @api .multi
5957 @api .depends (
6058 "asset_accounting_info_ids" ,
6159 "asset_accounting_info_ids.asset_id" ,
@@ -75,27 +73,29 @@ def _compute_asset_data(self):
7573 }
7674 )
7775
78- @api .multi
7976 def _compute_hide_link_asset_button (self ):
80- valid_account_ids = self .get_valid_accounts ()
77+ valid_account_ids = (
78+ self .get_valid_accounts ()
79+ ) # todo verificare che venga fatto solo su invoice_line_ids
8180 if not valid_account_ids :
8281 self .update ({"hide_link_asset_button" : True })
8382 else :
8483 for move in self :
8584 move .hide_link_asset_button = (
8685 not any (
8786 [
88- l .account_id .id in valid_account_ids .ids
89- for l in move .line_ids
87+ line .account_id .id in valid_account_ids .ids
88+ for line in move .line_ids
9089 ]
9190 )
9291 or move .state != "posted"
9392 )
9493
95- @api .multi
9694 def open_wizard_manage_asset (self ):
9795 self .ensure_one ()
98- lines = self .line_ids .filtered (lambda l : not l .asset_accounting_info_ids )
96+ lines = self .line_ids .filtered (
97+ lambda line : not line .asset_accounting_info_ids
98+ ) # todo verificare che venga fatto solo su invoice_line_ids
9999 if not lines :
100100 raise ValidationError (_ ("Every line is already linked to an asset." ))
101101
@@ -105,11 +105,12 @@ def open_wizard_manage_asset(self):
105105 ctx .update (
106106 {
107107 "default_company_id" : self .company_id .id ,
108- "default_dismiss_date" : self .date or fields . Date . today () ,
108+ "default_dismiss_date" : self .invoice_date or self . invoice_date_due ,
109109 "default_move_ids" : [(6 , 0 , self .ids )],
110110 "default_move_line_ids" : [(6 , 0 , lines .ids )],
111- "default_purchase_date" : self .date or fields . Date . today () ,
111+ "default_purchase_date" : self .invoice_date or self . invoice_date_due ,
112112 "move_ids" : self .ids ,
113+ # "default_move_type": "entry", # todo verificare
113114 }
114115 )
115116 act .update ({"context" : ctx })
0 commit comments