diff --git a/issue2961002_20001_30001.diff b/issue2961002_20001_30001.diff new file mode 100644 index 0000000..5f8e4c2 --- /dev/null +++ b/issue2961002_20001_30001.diff @@ -0,0 +1,116 @@ +Index: tax.py +=================================================================== + +--- ./modules/account/tax.py ++++ ./modules/account/tax.py +@@ -802,49 +802,52 @@ + + if self.template: + vals = self.template._get_tax_value(tax=self) +- if (self.template.invoice_account +- and self.invoice_account.id != template2account.get( +- self.template.invoice_account.id)): ++ if (self.template.invoice_account and (not self.invoice_account ++ or self.invoice_account.id != template2account.get( ++ self.template.invoice_account.id))): + vals['invoice_account'] = template2account.get( + self.template.invoice_account.id) + elif (not self.template.invoice_account + and self.invoice_account): + vals['invoice_account'] = None +- if (self.template.credit_note_account +- and self.credit_note_account.id != template2account.get( +- self.template.credit_note_account.id)): ++ if (self.template.credit_note_account and (not ++ self.credit_note_account or ++ self.credit_note_account.id != template2account.get( ++ self.template.credit_note_account.id))): + vals['credit_note_account'] = template2account.get( + self.template.credit_note_account.id) + elif (not self.template.credit_note_account + and self.credit_note_account): + vals['credit_note_account'] = None +- if (self.template.invoice_base_code +- and self.invoice_base_code.id != template2tax_code.get( +- self.template.invoice_base_code.id)): ++ if (self.template.invoice_base_code and (not self.invoice_base_code ++ or self.invoice_base_code.id != template2tax_code.get( ++ self.template.invoice_base_code.id))): + vals['invoice_base_code'] = template2tax_code.get( + self.template.invoice_base_code.id) + elif (not self.template.invoice_base_code + and self.invoice_base_code): + vals['invoice_base_code'] = None +- if (self.template.invoice_tax_code +- and self.invoice_tax_code.id != template2tax_code.get( +- self.template.invoice_tax_code.id)): ++ if (self.template.invoice_tax_code and (not self.invoice_tax_code ++ or self.invoice_tax_code.id != template2tax_code.get( ++ self.template.invoice_tax_code.id))): + vals['invoice_tax_code'] = template2tax_code.get( + self.template.invoice_tax_code.id) + elif (not self.template.invoice_tax_code + and self.invoice_tax_code): + vals['invoice_tax_code'] = None +- if (self.template.credit_note_base_code +- and self.credit_note_base_code.id != template2tax_code.get( +- self.template.credit_note_base_code.id)): ++ if (self.template.credit_note_base_code and (not ++ self.credit_note_base_code or ++ self.credit_note_base_code.id != template2tax_code.get( ++ self.template.credit_note_base_code.id))): + vals['credit_note_base_code'] = template2tax_code.get( + self.template.credit_note_base_code.id) + elif (not self.template.credit_note_base_code + and self.credit_note_base_code): + vals['credit_note_base_code'] = None +- if (self.template.credit_note_tax_code +- and self.credit_note_tax_code.id != template2tax_code.get( +- self.template.credit_note_tax_code.id)): ++ if (self.template.credit_note_tax_code and (not ++ self.credit_note_tax_code or ++ self.credit_note_tax_code.id != template2tax_code.get( ++ self.template.credit_note_tax_code.id))): + vals['credit_note_tax_code'] = template2tax_code.get( + self.template.credit_note_tax_code.id) + elif (not self.template.credit_note_tax_code +@@ -1118,8 +1121,6 @@ + res = {} + if not rule_line or rule_line.group != self.group: + res['group'] = self.group.id if self.group else None +- if not rule_line or rule_line.origin_tax != self.origin_tax: +- res['origin_tax'] = self.origin_tax.id if self.origin_tax else None + if not rule_line or rule_line.sequence != self.sequence: + res['sequence'] = self.sequence + if not rule_line or rule_line.template != self: +@@ -1271,16 +1272,19 @@ + vals = self.template._get_tax_rule_line_value(rule_line=self) + if self.rule.id != template2rule[self.template.rule.id]: + vals['rule'] = template2rule[self.template.rule.id] +- if self.origin_tax: +- if self.template.origin_tax: +- if self.origin_tax.id != \ +- template2tax[self.template.origin_tax.id]: +- vals['origin_tax'] = template2tax[ +- self.template.origin_tax.id] +- if self.tax: +- if self.template.tax: +- if self.tax.id != template2tax[self.template.tax.id]: +- vals['tax'] = template2tax[self.template.tax.id] ++ if self.template.origin_tax: ++ if (not self.origin_tax or self.origin_tax.id != ++ template2tax[self.template.origin_tax.id]): ++ vals['origin_tax'] = template2tax[ ++ self.template.origin_tax.id] ++ elif self.origin_tax: ++ vals['origin_tax'] = None ++ if self.template.tax: ++ if (not self.tax or self.tax.id != ++ template2tax[self.template.tax.id]): ++ vals['tax'] = template2tax[self.template.tax.id] ++ elif self.tax: ++ vals['tax'] = None + if vals: + self.write([self], vals) + template2rule_line[self.template.id] = self.id + diff --git a/series b/series index 0d90cd5..b4643f2 100644 --- a/series +++ b/series @@ -10,3 +10,4 @@ add_db_client.diff issue2661002_20001.diff issue101_226.diff issue2731002_20001.diff +issue2961002_20001_30001.diff